diff --git a/npm_and_yarn/lib/dependabot/npm_and_yarn/file_fetcher.rb b/npm_and_yarn/lib/dependabot/npm_and_yarn/file_fetcher.rb index 1f154039d6..f0d8a69c10 100644 --- a/npm_and_yarn/lib/dependabot/npm_and_yarn/file_fetcher.rb +++ b/npm_and_yarn/lib/dependabot/npm_and_yarn/file_fetcher.rb @@ -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 diff --git a/npm_and_yarn/spec/dependabot/npm_and_yarn/file_fetcher_spec.rb b/npm_and_yarn/spec/dependabot/npm_and_yarn/file_fetcher_spec.rb index d6fd047997..9eb46a965d 100644 --- a/npm_and_yarn/spec/dependabot/npm_and_yarn/file_fetcher_spec.rb +++ b/npm_and_yarn/spec/dependabot/npm_and_yarn/file_fetcher_spec.rb @@ -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