Skip to content

Commit

Permalink
Update testPathPatterns in updateGlobalConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonchinn178 committed Sep 22, 2023
1 parent 993fc50 commit 518c357
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/jest-core/src/lib/updateGlobalConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import type {Config} from '@jest/types';
import {replacePathSepForRegex} from 'jest-regex-util';
import {TestPathPatterns} from 'jest-util';
import type {AllowedConfigOptions} from 'jest-watcher';

type ExtraConfigOptions = Partial<
Expand All @@ -31,15 +31,14 @@ export default function updateGlobalConfig(
newConfig.testNamePattern = options.testNamePattern || '';
}

if (options.testPathPattern !== undefined) {
newConfig.testPathPattern =
replacePathSepForRegex(options.testPathPattern) || '';
if (options.testPathPatterns !== undefined) {
newConfig.testPathPatterns = options.testPathPatterns;
}

newConfig.onlyChanged =
!newConfig.watchAll &&
!newConfig.testNamePattern &&
!newConfig.testPathPattern;
!new TestPathPatterns(newConfig).isSet();

if (typeof options.bail === 'boolean') {
newConfig.bail = options.bail ? 1 : 0;
Expand Down

0 comments on commit 518c357

Please sign in to comment.