[heft-jest-plugin] Fix --test-path-pattern being ignored on Jest 30#5828
Open
iclanton wants to merge 1 commit into
Open
[heft-jest-plugin] Fix --test-path-pattern being ignored on Jest 30#5828iclanton wants to merge 1 commit into
iclanton wants to merge 1 commit into
Conversation
Jest 30 renamed the Config.Argv field from testPathPattern to testPathPatterns (plural). The Heft Jest plugin was still writing the old key, so jest-config silently ignored it and every test ran.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
heft test --test-path-pattern <regex>was silently running every test in a project. The Heft Jest plugin was passing the regex to Jest under the field nametestPathPattern(singular) onConfig.Argv.Root cause
In Jest 30, the
Config.Argvproperty was renamed fromtestPathPattern(singular) totestPathPatterns(plural).jest-confignow treats the old name as deprecated and ignores it, which causes Jest to run with no path filter at all.See
jest-configv30:Fix
Write the argv as
testPathPatterns(plural). The user-facing CLI parameter and theIJestPluginOptions.testPathPatternoption are unchanged.Repro
In
libraries/rush-lib:Before the fix this ran the entire suite. After the fix it correctly runs only
ChangeFile.test.js.