Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes [weekly 1.2k] [npm_and_yarn] YN00xx errors #11424

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions npm_and_yarn/lib/dependabot/npm_and_yarn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ module NpmAndYarn
REQUIREMENT_NOT_PROVIDED: /(?<dep>.*)(.*?)doesn't provide (?<pkg>.*)(.*?), requested by (?<parent>.*)/
}.freeze, T::Hash[String, Regexp])

YN0086_DEPS_RESOLUTION_FAILED = /peer dependencies are incorrectly met/

# registry returns malformed response
REGISTRY_NOT_REACHABLE = /Received malformed response from registry for "(?<ver>.*)". The registry may be down./

Expand Down Expand Up @@ -351,6 +353,13 @@ def self.sanitize_resolvability_message(error_message, dependencies, yarn_lock)
Dependabot::DependencyNotFound.new(message)
end
}
},
"YN0086" => {
message: "deps resolution failed",
handler: lambda { |message, _error, _params|
msg = message.match(YN0086_DEPS_RESOLUTION_FAILED)
Dependabot::DependencyFileNotResolvable.new(msg || message)
}
}
}.freeze, T::Hash[String, {
message: T.any(String, NilClass),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,28 @@
end
end

context "when the error message contains a deps resolution failed error" do
let(:error_message) do
"[YN0001]: Exception error, Detail: ➤ YN0000: · Yarn 4.5.1" \
"➤ YN0000: ┌ Resolution step" \
"::group::Resolution step" \
"➤ YN0085: │ + @testing-library/user-event@npm:14.6.1" \
"::endgroup::" \
"➤ YN0000: └ Completed in 0s 466ms" \
"➤ YN0060: │ react-dom is ...... non-overlapping ranges." \
"➤ YN0060: │ redux is listed by your non-overlapping ranges." \
"➤ YN0086: │ Some peer dependencies are incorrectly met by your project;" \
"➤ YN0086: │ Some peer dependencies are incorrectly met by dependencies;" \
end

it "raises a DependencyFileNotResolvable error" do
expect do
error_handler.handle_yarn_error(error, { yarn_lock: yarn_lock })
end.to raise_error(Dependabot::DependencyFileNotResolvable,
/peer dependencies are incorrectly met/)
end
end

context "when the error message contains SUB_DEP_LOCAL_PATH_TEXT" do
let(:error_message) { "Some error occurred: refers to a non-existing file" }

Expand Down
Loading