Skip to content

Commit 1535af7

Browse files
authored
Allow to pass findRelatedTests and nonFlagArgs to updateConfigAndRun (#10659)
1 parent 9b9020b commit 1535af7

5 files changed

Lines changed: 18 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
### Features
44

5+
- `[jest-core]` Add `findRelatedTests` and `nonFlagArgs` in allowed config options for `updateConfigAndRun` in watch plugins ([#10659](https://github.com/facebook/jest/pull/10659))
6+
57
### Fixes
68

79
### Chore & Maintenance

packages/jest-core/src/__tests__/watch.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ describe('Watch mode flows', () => {
617617
${'✖︎'} | ${'errorOnDeprecated'}
618618
${'✖︎'} | ${'expand'}
619619
${'✖︎'} | ${'filter'}
620-
${'︎'} | ${'findRelatedTests'}
620+
${'︎'} | ${'findRelatedTests'}
621621
${'✖︎'} | ${'forceExit'}
622622
${'✖︎'} | ${'globalSetup'}
623623
${'✖︎'} | ${'globalTeardown'}
@@ -626,7 +626,7 @@ describe('Watch mode flows', () => {
626626
${'✖︎'} | ${'listTests'}
627627
${'✖︎'} | ${'logHeapUsage'}
628628
${'✖︎'} | ${'maxWorkers'}
629-
${'︎'} | ${'nonFlagArgs'}
629+
${'︎'} | ${'nonFlagArgs'}
630630
${'✖︎'} | ${'noSCM'}
631631
${'✖︎'} | ${'noStackTrace'}
632632
${'✔︎'} | ${'notify'}

packages/jest-core/src/lib/update_global_config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ export default (
7272
newConfig.coverageReporters = options.coverageReporters;
7373
}
7474

75+
if (options.findRelatedTests !== undefined) {
76+
newConfig.findRelatedTests = options.findRelatedTests;
77+
}
78+
79+
if (options.nonFlagArgs !== undefined) {
80+
newConfig.nonFlagArgs = options.nonFlagArgs;
81+
}
82+
7583
if (options.noSCM) {
7684
newConfig.noSCM = true;
7785
}

packages/jest-core/src/watch.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ export default function watch(
107107
collectCoverageOnlyFrom,
108108
coverageDirectory,
109109
coverageReporters,
110+
findRelatedTests,
110111
mode,
112+
nonFlagArgs,
111113
notify,
112114
notifyMode,
113115
onlyFailures,
@@ -126,7 +128,9 @@ export default function watch(
126128
collectCoverageOnlyFrom,
127129
coverageDirectory,
128130
coverageReporters,
131+
findRelatedTests,
129132
mode,
133+
nonFlagArgs,
130134
notify,
131135
notifyMode,
132136
onlyFailures,

packages/jest-watcher/src/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ export type AllowedConfigOptions = Partial<
5656
| 'collectCoverageOnlyFrom'
5757
| 'coverageDirectory'
5858
| 'coverageReporters'
59+
| 'findRelatedTests'
60+
| 'nonFlagArgs'
5961
| 'notify'
6062
| 'notifyMode'
6163
| 'onlyFailures'

0 commit comments

Comments
 (0)