Skip to content

Commit

Permalink
Remove testPathPattern from GlobalConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonchinn178 committed Sep 22, 2023
1 parent 6713c2c commit a4efd87
Show file tree
Hide file tree
Showing 17 changed files with 2 additions and 23 deletions.
1 change: 0 additions & 1 deletion e2e/__tests__/__snapshots__/showConfig.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ exports[`--showConfig outputs config info and exits 1`] = `
"printBasicPrototype": false
},
"testFailureExitCode": 1,
"testPathPattern": "",
"testPathPatterns": [],
"testSequencer": "<<REPLACED_JEST_PACKAGES_DIR>>/jest-test-sequencer/build/index.js",
"updateSnapshot": "none",
Expand Down
1 change: 0 additions & 1 deletion packages/jest-config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion packages/jest-config/src/normalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
1 change: 0 additions & 1 deletion packages/jest-core/src/__tests__/SearchSource.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ describe('getNoTestsFoundMessage', () => {
function createGlobalConfig(options?: Partial<Config.GlobalConfig>) {
return makeGlobalConfig({
rootDir: '/root/dir',
testPathPattern: '/path/pattern',
testPathPatterns: ['/path/pattern'],
...options,
});
Expand Down
3 changes: 0 additions & 3 deletions packages/jest-core/src/__tests__/watch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,6 @@ describe('Watch mode flows', () => {
${'✖︎'} | ${'skipFilter'}
${'✖︎'} | ${'testFailureExitCode'}
${'✔︎'} | ${'testNamePattern'}
${'✔︎'} | ${'testPathPattern'}
${'✔︎'} | ${'testPathPatterns'}
${'✖︎'} | ${'testResultsProcessor'}
${'✔︎'} | ${'updateSnapshot'}
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ exports[`prints the config object 1`] = `
"snapshotFormat": {},
"testFailureExitCode": 1,
"testNamePattern": "",
"testPathPattern": "",
"testPathPatterns": [],
"testSequencer": "@jest/test-sequencer",
"testTimeout": 5000,
Expand Down
1 change: 0 additions & 1 deletion packages/jest-core/src/plugins/FailedTestsInteractive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export default class FailedTestsInteractivePlugin extends BaseWatchPlugin {
updateConfigAndRun({
mode: 'watch',
testNamePattern: failure ? `^${failure.fullName}$` : '',
testPathPattern: failure?.path || '',
testPathPatterns: failure ? [failure.path] : [],
});

Expand Down
2 changes: 1 addition & 1 deletion packages/jest-core/src/plugins/TestPathPattern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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],
});
});
Expand Down
5 changes: 0 additions & 5 deletions packages/jest-core/src/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ export default async function watch(
onlyFailures,
reporters,
testNamePattern,
testPathPattern,
testPathPatterns,
updateSnapshot,
verbose,
Expand All @@ -142,7 +141,6 @@ export default async function watch(
onlyFailures,
reporters,
testNamePattern,
testPathPattern,
testPathPatterns,
updateSnapshot,
verbose,
Expand Down Expand Up @@ -410,7 +408,6 @@ export default async function watch(
globalConfig = updateGlobalConfig(globalConfig, {
mode: 'watchAll',
testNamePattern: '',
testPathPattern: '',
testPathPatterns: [],
});
startRun(globalConfig);
Expand All @@ -419,7 +416,6 @@ export default async function watch(
updateConfigAndRun({
mode: 'watch',
testNamePattern: '',
testPathPattern: '',
testPathPatterns: [],
});
break;
Expand All @@ -433,7 +429,6 @@ export default async function watch(
globalConfig = updateGlobalConfig(globalConfig, {
mode: 'watch',
testNamePattern: '',
testPathPattern: '',
testPathPatterns: [],
});
startRun(globalConfig);
Expand Down
1 change: 0 additions & 1 deletion packages/jest-types/src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,6 @@ export type GlobalConfig = {
errorOnDeprecated: boolean;
testFailureExitCode: number;
testNamePattern?: string;
testPathPattern: string;
testPathPatterns: Array<string>;
testResultsProcessor?: string;
testSequencer: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-util/src/TestPathPatterns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 0 additions & 1 deletion packages/jest-watcher/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ export type AllowedConfigOptions = Partial<
| 'onlyFailures'
| 'reporters'
| 'testNamePattern'
| 'testPathPattern'
| 'testPathPatterns'
| 'updateSnapshot'
| 'verbose'
Expand Down
1 change: 0 additions & 1 deletion packages/test-utils/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ const DEFAULT_GLOBAL_CONFIG: Config.GlobalConfig = {
snapshotFormat: {},
testFailureExitCode: 1,
testNamePattern: '',
testPathPattern: '',
testPathPatterns: [],
testResultsProcessor: undefined,
testSequencer: '@jest/test-sequencer',
Expand Down

0 comments on commit a4efd87

Please sign in to comment.