Skip to content

Commit 9deb6eb

Browse files
Copilotpavera
andcommitted
Address review comments: fix misleading comment, remove redundant stubs
- Update comment in bun PackageJsonUpdater to accurately describe the raise behavior (matches npm_and_yarn version) - Remove redundant enable_private_registry_for_corepack stub in file_updater_spec.rb (was stubbed true then overridden to false) - Remove same redundant stub in npm_lockfile_updater_spec.rb Co-authored-by: pavera <660677+pavera@users.noreply.github.com>
1 parent 3f4acc4 commit 9deb6eb

3 files changed

Lines changed: 3 additions & 6 deletions

File tree

bun/lib/dependabot/bun/file_updater/package_json_updater.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ def updated_package_json_content
6161
# "dependencies" list. For example, the dependencies object can contain same name dependency
6262
# "dep" => "1.0.0" and "dev" => "1.0.1" while package.json can only contain "dep" => "1.0.0".
6363
# The other dependency is not present in package.json so we don't have to update it — this is
64-
# most likely a transitive dependency which only needs an update in the lockfile. We avoid
65-
# throwing an exception and let the update continue.
64+
# most likely a transitive dependency which only needs an update in the lockfile. For a batch
65+
# with a single unique dependency name we tolerate this no-op update, but when multiple unique
66+
# dependencies are being updated and none change the content we treat that as unexpected and raise.
6667
raise "Expected content to change!" if content == new_content && unique_deps_count > 1
6768

6869
content = new_content

npm_and_yarn/spec/dependabot/npm_and_yarn/file_updater/npm_lockfile_updater_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@
6969
FileUtils.mkdir_p(tmp_path)
7070
allow(Dependabot::Experiments).to receive(:enabled?)
7171
.with(:enable_corepack_for_npm_and_yarn).and_return(enable_corepack_for_npm_and_yarn)
72-
allow(Dependabot::Experiments).to receive(:enabled?)
73-
.with(:enable_private_registry_for_corepack).and_return(true)
7472
allow(Dependabot::Experiments).to receive(:enabled?)
7573
.with(:enable_private_registry_for_corepack).and_return(false)
7674
end

npm_and_yarn/spec/dependabot/npm_and_yarn/file_updater_spec.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@
6666
FileUtils.mkdir_p(tmp_path)
6767
allow(Dependabot::Experiments).to receive(:enabled?)
6868
.with(:enable_corepack_for_npm_and_yarn).and_return(enable_corepack_for_npm_and_yarn)
69-
allow(Dependabot::Experiments).to receive(:enabled?)
70-
.with(:enable_private_registry_for_corepack).and_return(true)
7169
allow(Dependabot::Experiments).to receive(:enabled?)
7270
.with(:enable_private_registry_for_corepack).and_return(false)
7371
end

0 commit comments

Comments
 (0)