Skip to content

Commit

Permalink
Fixes Dependabot::SharedHelpers::HelperSubprocessFailed - nested alia…
Browse files Browse the repository at this point in the history
…ses not supported (#10292)

* Handles nested dependencies issues and adds relevant test cases
  • Loading branch information
sachin-sandhu authored Jul 26, 2024
1 parent 0014240 commit f97969f
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def updated_lockfile_reponse(response)
/401 Unauthorized - GET (?<url>.*) - unauthenticated: User cannot be authenticated with the token provided./
NPM_PACKAGE_REGISTRY = "https://npm.pkg.github.com"
EOVERRIDE = /EOVERRIDE\n *.* Override for (?<deps>.*) conflicts with direct dependency/
NESTED_ALIAS = /nested aliases not supported/

# TODO: look into fixing this in npm, seems like a bug in the git
# downloader introduced in npm 7
Expand Down Expand Up @@ -531,6 +532,11 @@ def handle_npm_updater_error(error)
raise Dependabot::DependencyFileNotResolvable, msg
end

if error_message.match(NESTED_ALIAS)
msg = "Nested aliases are not supported in NPM versions earlier than 6.9.0."
raise Dependabot::DependencyFileNotResolvable, msg
end

raise error
end
# rubocop:enable Metrics/AbcSize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -788,4 +788,24 @@
expect { updated_npm_lock_content }.to raise_error(Dependabot::DependencyFileNotResolvable)
end
end

context "with a dependency with nested aliases not supported" do
let(:files) { project_dependency_files("npm/simple_with_nested_deps") }
let(:dependency_name) { "express" }
let(:version) { "4.19.2" }
let(:previous_version) { "^4.17.1" }
let(:requirements) do
[{
file: "package.json",
requirement: "^4.17.1",
groups: ["devDependencies"],
source: nil
}]
end
let(:previous_requirements) { requirements }

it "raises a helpful error" do
expect { updated_npm_lock_content }.to raise_error(Dependabot::DependencyFileNotResolvable)
end
end
end

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "xyz",
"version": "0.36.1",
"type": "module",
"description": "xxx",
"repository": "git+https://github.com/waltfy/PROTO_TEST.git",
"homepage": "https://github.com/waltfy/PROTO_TEST#readme",
"bugs": "https://github.com/waltfy/PROTO_TEST/issues",
"author": "",
"contributors": [],
"engines": {
"node": ">=12"
},
"main": "generators/app/index.js",
"typings": "generators/app/index.d.ts",
"files": [
"/generators"
],
"keywords": [],
"scripts": {
"build": "tsc -p tsconfig.build.json && npm run copy:templates"
},
"dependencies": {
"@docusaurus/theme-search-algolia": "^2.0.0-beta.9"
}
}

0 comments on commit f97969f

Please sign in to comment.