diff --git a/e2e/__tests__/__snapshots__/showConfig.test.ts.snap b/e2e/__tests__/__snapshots__/showConfig.test.ts.snap index fad9b1278dc3..c50c1778805d 100644 --- a/e2e/__tests__/__snapshots__/showConfig.test.ts.snap +++ b/e2e/__tests__/__snapshots__/showConfig.test.ts.snap @@ -138,7 +138,6 @@ exports[`--showConfig outputs config info and exits 1`] = ` "printBasicPrototype": false }, "testFailureExitCode": 1, - "testPathPattern": "", "testPathPatterns": [], "testSequencer": "<>/jest-test-sequencer/build/index.js", "updateSnapshot": "none", diff --git a/packages/jest-config/src/index.ts b/packages/jest-config/src/index.ts index 66fd142c4b41..7be4d3708258 100644 --- a/packages/jest-config/src/index.ts +++ b/packages/jest-config/src/index.ts @@ -131,7 +131,6 @@ const groupOptions = ( snapshotFormat: options.snapshotFormat, testFailureExitCode: options.testFailureExitCode, testNamePattern: options.testNamePattern, - testPathPattern: options.testPathPattern, testPathPatterns: options.testPathPatterns, testResultsProcessor: options.testResultsProcessor, testSequencer: options.testSequencer, diff --git a/packages/jest-config/src/normalize.ts b/packages/jest-config/src/normalize.ts index b21e5ad2eed5..dd1bccb6d5ab 100644 --- a/packages/jest-config/src/normalize.ts +++ b/packages/jest-config/src/normalize.ts @@ -999,7 +999,6 @@ export default async function normalize( newOptions.nonFlagArgs = argv._?.map(arg => `${arg}`); const testPathPatterns = buildTestPathPatterns(argv); newOptions.testPathPatterns = testPathPatterns.patterns; - newOptions.testPathPattern = testPathPatterns.regexString; newOptions.json = !!argv.json; newOptions.testFailureExitCode = parseInt( diff --git a/packages/jest-core/src/__tests__/SearchSource.test.ts b/packages/jest-core/src/__tests__/SearchSource.test.ts index 01b013505929..21ef1683e5fa 100644 --- a/packages/jest-core/src/__tests__/SearchSource.test.ts +++ b/packages/jest-core/src/__tests__/SearchSource.test.ts @@ -109,7 +109,6 @@ describe('SearchSource', () => { const {searchSource, config} = await initSearchSource(initialOptions); const {tests: paths} = await searchSource.getTestPaths({ ...config, - testPathPattern: '', testPathPatterns: [], }); return paths.map(({path: p}) => path.relative(rootDir, p)).sort(); diff --git a/packages/jest-core/src/__tests__/__snapshots__/watchFilenamePatternMode.test.js.snap b/packages/jest-core/src/__tests__/__snapshots__/watchFilenamePatternMode.test.js.snap index e505641b8604..2f831f62a006 100644 --- a/packages/jest-core/src/__tests__/__snapshots__/watchFilenamePatternMode.test.js.snap +++ b/packages/jest-core/src/__tests__/__snapshots__/watchFilenamePatternMode.test.js.snap @@ -92,7 +92,6 @@ exports[`Watch mode flows Pressing "P" enters pattern mode 9`] = ` Object { "onlyChanged": false, "passWithNoTests": true, - "testPathPattern": "p.*3", "testPathPatterns": Array [ "p.*3", ], diff --git a/packages/jest-core/src/__tests__/getNoTestsFoundMessage.test.ts b/packages/jest-core/src/__tests__/getNoTestsFoundMessage.test.ts index f0f026c802bf..19fd684dea0a 100644 --- a/packages/jest-core/src/__tests__/getNoTestsFoundMessage.test.ts +++ b/packages/jest-core/src/__tests__/getNoTestsFoundMessage.test.ts @@ -18,7 +18,6 @@ describe('getNoTestsFoundMessage', () => { function createGlobalConfig(options?: Partial) { return makeGlobalConfig({ rootDir: '/root/dir', - testPathPattern: '/path/pattern', testPathPatterns: ['/path/pattern'], ...options, }); diff --git a/packages/jest-core/src/__tests__/watch.test.js b/packages/jest-core/src/__tests__/watch.test.js index 07385b59a808..8920963123a1 100644 --- a/packages/jest-core/src/__tests__/watch.test.js +++ b/packages/jest-core/src/__tests__/watch.test.js @@ -671,7 +671,6 @@ describe('Watch mode flows', () => { ${'✖︎'} | ${'skipFilter'} ${'✖︎'} | ${'testFailureExitCode'} ${'✔︎'} | ${'testNamePattern'} - ${'✔︎'} | ${'testPathPattern'} ${'✔︎'} | ${'testPathPatterns'} ${'✖︎'} | ${'testResultsProcessor'} ${'✔︎'} | ${'updateSnapshot'} @@ -899,7 +898,6 @@ describe('Watch mode flows', () => { await nextTick(); expect(runJestMock.mock.calls[0][0].globalConfig).toMatchObject({ - testPathPattern: 'file', testPathPatterns: ['file'], watch: true, watchAll: false, @@ -924,7 +922,6 @@ describe('Watch mode flows', () => { expect(runJestMock.mock.calls[1][0].globalConfig).toMatchObject({ testNamePattern: 'test', - testPathPattern: 'file', testPathPatterns: ['file'], watch: true, watchAll: false, diff --git a/packages/jest-core/src/lib/__tests__/__snapshots__/logDebugMessages.test.ts.snap b/packages/jest-core/src/lib/__tests__/__snapshots__/logDebugMessages.test.ts.snap index 8621ebf28bc5..0087fa7f5351 100644 --- a/packages/jest-core/src/lib/__tests__/__snapshots__/logDebugMessages.test.ts.snap +++ b/packages/jest-core/src/lib/__tests__/__snapshots__/logDebugMessages.test.ts.snap @@ -109,7 +109,6 @@ exports[`prints the config object 1`] = ` "snapshotFormat": {}, "testFailureExitCode": 1, "testNamePattern": "", - "testPathPattern": "", "testPathPatterns": [], "testSequencer": "@jest/test-sequencer", "testTimeout": 5000, diff --git a/packages/jest-core/src/plugins/FailedTestsInteractive.ts b/packages/jest-core/src/plugins/FailedTestsInteractive.ts index 6effde8159c0..864f78a7d86c 100644 --- a/packages/jest-core/src/plugins/FailedTestsInteractive.ts +++ b/packages/jest-core/src/plugins/FailedTestsInteractive.ts @@ -58,7 +58,6 @@ export default class FailedTestsInteractivePlugin extends BaseWatchPlugin { updateConfigAndRun({ mode: 'watch', testNamePattern: failure ? `^${failure.fullName}$` : '', - testPathPattern: failure?.path || '', testPathPatterns: failure ? [failure.path] : [], }); diff --git a/packages/jest-core/src/plugins/TestPathPattern.ts b/packages/jest-core/src/plugins/TestPathPattern.ts index 8242e83e67fa..c777b7183027 100644 --- a/packages/jest-core/src/plugins/TestPathPattern.ts +++ b/packages/jest-core/src/plugins/TestPathPattern.ts @@ -48,7 +48,7 @@ class TestPathPatternPlugin extends BaseWatchPlugin { testPathPatternPrompt.run( (value: string) => { - updateConfigAndRun({mode: 'watch', testPathPattern: value, testPathPatterns: [value]}); + updateConfigAndRun({mode: 'watch', testPathPatterns: [value]}); res(); }, rej, diff --git a/packages/jest-core/src/plugins/UpdateSnapshotsInteractive.ts b/packages/jest-core/src/plugins/UpdateSnapshotsInteractive.ts index 16b3ecbe4579..44eeaf20c572 100644 --- a/packages/jest-core/src/plugins/UpdateSnapshotsInteractive.ts +++ b/packages/jest-core/src/plugins/UpdateSnapshotsInteractive.ts @@ -70,7 +70,6 @@ class UpdateSnapshotInteractivePlugin extends BaseWatchPlugin { updateConfigAndRun({ mode: 'watch', testNamePattern: assertion ? `^${assertion.fullName}$` : '', - testPathPattern: assertion ? assertion.path : '', testPathPatterns: assertion ? [assertion.path] : [], updateSnapshot: shouldUpdateSnapshot ? 'all' : 'none', diff --git a/packages/jest-core/src/plugins/__tests__/FailedTestsInteractive.test.js b/packages/jest-core/src/plugins/__tests__/FailedTestsInteractive.test.js index 379b919a79cf..4b64a2a2c3dc 100644 --- a/packages/jest-core/src/plugins/__tests__/FailedTestsInteractive.test.js +++ b/packages/jest-core/src/plugins/__tests__/FailedTestsInteractive.test.js @@ -40,7 +40,6 @@ describe('FailedTestsInteractive', () => { expect(mockUpdate).toHaveBeenCalledWith({ mode: 'watch', testNamePattern: `^${testAggregate.testResults[0].testResults[0].fullName}$`, - testPathPattern: testAggregate.testResults[0].testFilePath, testPathPatterns: [testAggregate.testResults[0].testFilePath], }); }); diff --git a/packages/jest-core/src/watch.ts b/packages/jest-core/src/watch.ts index c0c6e36954f6..be3d042aa194 100644 --- a/packages/jest-core/src/watch.ts +++ b/packages/jest-core/src/watch.ts @@ -121,7 +121,6 @@ export default async function watch( onlyFailures, reporters, testNamePattern, - testPathPattern, testPathPatterns, updateSnapshot, verbose, @@ -142,7 +141,6 @@ export default async function watch( onlyFailures, reporters, testNamePattern, - testPathPattern, testPathPatterns, updateSnapshot, verbose, @@ -410,7 +408,6 @@ export default async function watch( globalConfig = updateGlobalConfig(globalConfig, { mode: 'watchAll', testNamePattern: '', - testPathPattern: '', testPathPatterns: [], }); startRun(globalConfig); @@ -419,7 +416,6 @@ export default async function watch( updateConfigAndRun({ mode: 'watch', testNamePattern: '', - testPathPattern: '', testPathPatterns: [], }); break; @@ -433,7 +429,6 @@ export default async function watch( globalConfig = updateGlobalConfig(globalConfig, { mode: 'watch', testNamePattern: '', - testPathPattern: '', testPathPatterns: [], }); startRun(globalConfig); diff --git a/packages/jest-types/src/Config.ts b/packages/jest-types/src/Config.ts index 7f16de8f9c78..b444716e4c6a 100644 --- a/packages/jest-types/src/Config.ts +++ b/packages/jest-types/src/Config.ts @@ -412,7 +412,6 @@ export type GlobalConfig = { errorOnDeprecated: boolean; testFailureExitCode: number; testNamePattern?: string; - testPathPattern: string; testPathPatterns: Array; testResultsProcessor?: string; testSequencer: string; diff --git a/packages/jest-util/src/TestPathPatterns.ts b/packages/jest-util/src/TestPathPatterns.ts index fb20d9762ff3..2770b8728b8d 100644 --- a/packages/jest-util/src/TestPathPatterns.ts +++ b/packages/jest-util/src/TestPathPatterns.ts @@ -28,7 +28,7 @@ export default class TestPathPatterns { this.patterns = patterns; } - get regexString(): string { + private get regexString(): string { if (this._regexString !== null) { return this._regexString; } diff --git a/packages/jest-watcher/src/types.ts b/packages/jest-watcher/src/types.ts index 718b5534c46f..fe69d836187b 100644 --- a/packages/jest-watcher/src/types.ts +++ b/packages/jest-watcher/src/types.ts @@ -62,7 +62,6 @@ export type AllowedConfigOptions = Partial< | 'onlyFailures' | 'reporters' | 'testNamePattern' - | 'testPathPattern' | 'testPathPatterns' | 'updateSnapshot' | 'verbose' diff --git a/packages/test-utils/src/config.ts b/packages/test-utils/src/config.ts index 1e66e86e604b..5aff9e0a15af 100644 --- a/packages/test-utils/src/config.ts +++ b/packages/test-utils/src/config.ts @@ -55,7 +55,6 @@ const DEFAULT_GLOBAL_CONFIG: Config.GlobalConfig = { snapshotFormat: {}, testFailureExitCode: 1, testNamePattern: '', - testPathPattern: '', testPathPatterns: [], testResultsProcessor: undefined, testSequencer: '@jest/test-sequencer',