Skip to content

Commit

Permalink
Remove custom error handling for when plugins don't support composer v1
Browse files Browse the repository at this point in the history
The test was failing because the dependencies used didn't support PHP 8.

However, when I updated them to the oldest version that still supported
PHP 8, then they worked fine against the newest version of composer.

When I dug into it, I realized that because composer 1 was deprecated a
while back, any plugins that don't support the newest version of
composer v1 won't support PHP 8.2, and so the emitted error message is
about deps not working with PHP 8. While still technically possible, the
reality is that the error of allowing a modern PHP version but not a new
version of a deprecated composer major version just isn't going to
happen. And in the worst case that I'm somehow wrong, this isn't that
big of a deal, as the job will fail either way, it just now fails with
a subprocess unknown failure and prints the warning message for a human
to interpret.

So I removed the custom error handling and the associated test.
  • Loading branch information
jeffwidman authored and “Thavachelvam committed Jan 10, 2025
1 parent 19e2bd5 commit b3246c4
Showing 1 changed file with 4 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,36 +205,10 @@
end
end

context "with a plugin that conflicts with the current composer version v1" do
let(:project_name) { "v1/outdated_flex" }
let(:dependency) do
Dependabot::Dependency.new(
name: "symphony/lock",
version: "4.1.3",
requirements: [{
file: "composer.json",
requirement: "^4.1",
groups: ["runtime"],
source: nil
}],
previous_version: "4.1.1",
previous_requirements: [{
file: "composer.json",
requirement: "^4.1",
groups: ["runtime"],
source: nil
}],
package_manager: "composer"
)
end

it "raises a helpful error" do
expect { updated_lockfile_content }.to raise_error do |error|
expect(error.message).to start_with("One of your Composer plugins is not compatible")
expect(error).to be_a Dependabot::DependencyFileNotResolvable
end
end
end
# We stopped testing/handling errors for plugins that conflict with the current version of composer v1
# because composer v1 was deprecated before PHP 8.2 was released, which Dependabot now runs on.
# So any plugins that are new enough to support PHP 8 will definitely support the newest version
# of composer v1.

context "with a plugin that conflicts with the current composer version v2" do
let(:project_name) { "outdated_flex" }
Expand Down

0 comments on commit b3246c4

Please sign in to comment.