Skip to content

Fix flaky upgrade-dependency-version test#7242

Merged
knutwannheden merged 2 commits intomainfrom
fix-flaky-upgrade-dependency-version-test
Apr 2, 2026
Merged

Fix flaky upgrade-dependency-version test#7242
knutwannheden merged 2 commits intomainfrom
fix-flaky-upgrade-dependency-version-test

Conversation

@knutwannheden
Copy link
Copy Markdown
Contributor

Motivation

The UpgradeDependencyVersion test "skips npm install when resolved version already satisfies new constraint" was asserting that lodash@^4.17.20 resolves to exactly 4.17.23. With the release of lodash 4.18.1, npm now resolves it to 4.18.1, causing the test to fail on CI.

Summary

  • Replace exact version assertion (toBe("4.17.23")) with semver.satisfies(version, "^4.17.23") so the test is resilient to future lodash releases
  • The test still validates its core intent: that the resolved version satisfies the new constraint and npm install was skipped

Test plan

  • Ran the specific test: npx vitest run test/javascript/recipes/upgrade-dependency-version.test.ts -t "skips npm install" — passes

The test asserted an exact resolved version (4.17.23) for lodash
when using a ^4.17.20 constraint, but npm now resolves to 4.18.1.
Use semver.satisfies() instead to check that the resolved version
satisfies the constraint, making the test resilient to new lodash
releases.
Same issue as the upgrade-dependency-version test: the lock file
version assertion used startsWith("4.17.") which breaks now that
lodash 4.18.1 exists. Use semver.satisfies() instead.
@knutwannheden knutwannheden merged commit e498e16 into main Apr 2, 2026
@knutwannheden knutwannheden deleted the fix-flaky-upgrade-dependency-version-test branch April 2, 2026 11:21
@github-project-automation github-project-automation bot moved this from In Progress to Done in OpenRewrite Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant