Skip to content

Commit 51f85c6

Browse files
authored
[heft-jest-plugin] Fix --test-path-pattern being ignored on Jest 30 (#5828)
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.
1 parent 96dcd10 commit 51f85c6

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@rushstack/heft-jest-plugin",
5+
"comment": "Fix an issue where the `--test-path-pattern` parameter was ignored, causing all tests to run. In Jest 30 the `Config.Argv` field was renamed from `testPathPattern` to `testPathPatterns`.",
6+
"type": "patch"
7+
}
8+
],
9+
"packageName": "@rushstack/heft-jest-plugin",
10+
"email": "iclanton@users.noreply.github.com"
11+
}

heft-plugins/heft-jest-plugin/src/JestPlugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ export default class JestPlugin implements IHeftTaskPlugin<IJestPluginOptions> {
627627

628628
testNamePattern: options.testNamePattern,
629629
testPathIgnorePatterns: options.testPathIgnorePatterns ? [options.testPathIgnorePatterns] : undefined,
630-
testPathPattern: options.testPathPattern ? [options.testPathPattern] : undefined,
630+
testPathPatterns: options.testPathPattern ? [options.testPathPattern] : undefined,
631631
testTimeout: options.testTimeout,
632632
maxWorkers: options.maxWorkers,
633633

0 commit comments

Comments
 (0)