Skip to content

Commit 7b980a2

Browse files
kbukum1Copilot
andcommitted
Fix TitleBuilder prefix not applied when production check is unavailable
Extract production_dependencies? helper that rescues when the ecosystem's production check is not registered (e.g. in API-path mode or isolated test contexts), defaulting to production=true. Register npm_and_yarn production check in the TitleBuilder spec to ensure correct dev/prod prefix selection in tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 3345354 commit 7b980a2

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

common/spec/dependabot/pull_request_creator/message_builder/components/title_builder_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@
77

88
namespace = Dependabot::PullRequestCreator::MessageBuilder
99
RSpec.describe namespace::Components::TitleBuilder do
10+
before do
11+
Dependabot::Dependency.register_production_check(
12+
"npm_and_yarn",
13+
lambda do |groups|
14+
return true if groups.empty?
15+
return true if groups.include?("optionalDependencies")
16+
17+
groups.include?("dependencies")
18+
end
19+
)
20+
end
21+
1022
describe "#build" do
1123
context "with no prefix" do
1224
subject(:builder) do

0 commit comments

Comments
 (0)