Skip to content

Commit

Permalink
Raise when old PNPM version is used
Browse files Browse the repository at this point in the history
  • Loading branch information
deivid-rodriguez committed Nov 1, 2023
1 parent 60f0a14 commit 907b518
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 7 additions & 1 deletion npm_and_yarn/lib/dependabot/npm_and_yarn/file_fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,13 @@ def guess_yarn_version
def pnpm_version
return @pnpm_version if defined?(@pnpm_version)

@pnpm_version = package_manager.requested_version("pnpm") || guess_pnpm_version
version = package_manager.requested_version("pnpm") || guess_pnpm_version

if version && Version.new(version.to_s) < Version.new("7")
raise ToolVersionNotSupported.new("PNPM", version.to_s, "7.*, 8.*")
end

@pnpm_version = version
end

def guess_pnpm_version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,10 +344,9 @@
.to match_array(%w(package.json pnpm-lock.yaml))
end

it "parses the version as 6" do
expect(file_fetcher_instance.ecosystem_versions).to eq(
{ package_managers: { "pnpm" => 6 } }
)
it "raises tool version not supported error" do
expect { file_fetcher_instance.ecosystem_versions }
.to raise_error(Dependabot::ToolVersionNotSupported)
end
end

Expand Down

0 comments on commit 907b518

Please sign in to comment.