Skip to content

Commit

Permalink
Allow to pass findRelatedTests and nonFlagArgs to `updateConfigAn…
Browse files Browse the repository at this point in the history
…dRun` (#10659)
  • Loading branch information
wclr committed Oct 23, 2020
1 parent 9b9020b commit 1535af7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,8 @@

### Features

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

### Fixes

### Chore & Maintenance
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-core/src/__tests__/watch.test.js
Expand Up @@ -617,7 +617,7 @@ describe('Watch mode flows', () => {
${'✖︎'} | ${'errorOnDeprecated'}
${'✖︎'} | ${'expand'}
${'✖︎'} | ${'filter'}
${'︎'} | ${'findRelatedTests'}
${'︎'} | ${'findRelatedTests'}
${'✖︎'} | ${'forceExit'}
${'✖︎'} | ${'globalSetup'}
${'✖︎'} | ${'globalTeardown'}
Expand All @@ -626,7 +626,7 @@ describe('Watch mode flows', () => {
${'✖︎'} | ${'listTests'}
${'✖︎'} | ${'logHeapUsage'}
${'✖︎'} | ${'maxWorkers'}
${'︎'} | ${'nonFlagArgs'}
${'︎'} | ${'nonFlagArgs'}
${'✖︎'} | ${'noSCM'}
${'✖︎'} | ${'noStackTrace'}
${'✔︎'} | ${'notify'}
Expand Down
8 changes: 8 additions & 0 deletions packages/jest-core/src/lib/update_global_config.ts
Expand Up @@ -72,6 +72,14 @@ export default (
newConfig.coverageReporters = options.coverageReporters;
}

if (options.findRelatedTests !== undefined) {
newConfig.findRelatedTests = options.findRelatedTests;
}

if (options.nonFlagArgs !== undefined) {
newConfig.nonFlagArgs = options.nonFlagArgs;
}

if (options.noSCM) {
newConfig.noSCM = true;
}
Expand Down
4 changes: 4 additions & 0 deletions packages/jest-core/src/watch.ts
Expand Up @@ -107,7 +107,9 @@ export default function watch(
collectCoverageOnlyFrom,
coverageDirectory,
coverageReporters,
findRelatedTests,
mode,
nonFlagArgs,
notify,
notifyMode,
onlyFailures,
Expand All @@ -126,7 +128,9 @@ export default function watch(
collectCoverageOnlyFrom,
coverageDirectory,
coverageReporters,
findRelatedTests,
mode,
nonFlagArgs,
notify,
notifyMode,
onlyFailures,
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-watcher/src/types.ts
Expand Up @@ -56,6 +56,8 @@ export type AllowedConfigOptions = Partial<
| 'collectCoverageOnlyFrom'
| 'coverageDirectory'
| 'coverageReporters'
| 'findRelatedTests'
| 'nonFlagArgs'
| 'notify'
| 'notifyMode'
| 'onlyFailures'
Expand Down

0 comments on commit 1535af7

Please sign in to comment.