Skip to content

Commit

Permalink
chore(breaking): remove undocumented enabledTestsMap config (#10787)
Browse files Browse the repository at this point in the history
  • Loading branch information
thymikee authored Nov 6, 2020
1 parent c732ed9 commit 4f84f61
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 33 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

- `[*]` [**BREAKING**] Only support Node LTS releases and Node 15 ([#10685](https://github.com/facebook/jest/pull/10685))
- `[*]` [**BREAKING**] Add `exports` field to all `package.json`s ([#9921](https://github.com/facebook/jest/pull/9921))
- `[jest-config]` [**BREAKING**] Remove `enabledTestsMap` config, use `filter` instead ([#10787](https://github.com/facebook/jest/pull/10787))
- `[jest-resolve]` [**BREAKING**] Migrate to ESM ([#10688](https://github.com/facebook/jest/pull/10688))

### Performance
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 @@ -123,7 +123,6 @@ const groupOptions = (
coverageThreshold: options.coverageThreshold,
detectLeaks: options.detectLeaks,
detectOpenHandles: options.detectOpenHandles,
enabledTestsMap: options.enabledTestsMap,
errorOnDeprecated: options.errorOnDeprecated,
expand: options.expand,
filter: options.filter,
Expand Down
10 changes: 0 additions & 10 deletions packages/jest-core/src/FailedTestsCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

import type {TestResult} from '@jest/test-result';
import type {Config} from '@jest/types';
import type {Test} from 'jest-runner';

type TestMap = Record<string, Record<string, boolean>>;
Expand Down Expand Up @@ -38,13 +37,4 @@ export default class FailedTestsCache {

this._enabledTestsMap = Object.freeze(this._enabledTestsMap);
}

updateConfig(globalConfig: Config.GlobalConfig): Config.GlobalConfig {
if (!this._enabledTestsMap) {
return globalConfig;
}
const newConfig: Config.GlobalConfig = {...globalConfig};
newConfig.enabledTestsMap = this._enabledTestsMap;
return Object.freeze(newConfig);
}
}
6 changes: 0 additions & 6 deletions packages/jest-core/src/__tests__/FailedTestsCache.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,5 @@ describe('FailedTestsCache', () => {
path: '/path/to/failed_2.js',
},
]);
expect(failedTestsCache.updateConfig({})).toMatchObject({
enabledTestsMap: {
'/path/to/failed_1.js': {'test 3': true, 'test 4': true},
'/path/to/failed_2.js': {'test 5': true},
},
});
});
});
1 change: 0 additions & 1 deletion packages/jest-core/src/__tests__/watch.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,6 @@ describe('Watch mode flows', () => {
${'✖︎'} | ${'coverageThreshold'}
${'✖︎'} | ${'detectLeaks'}
${'✖︎'} | ${'detectOpenHandles'}
${'✖︎'} | ${'enabledTestsMap'}
${'✖︎'} | ${'errorOnDeprecated'}
${'✖︎'} | ${'expand'}
${'✖︎'} | ${'filter'}
Expand Down
1 change: 0 additions & 1 deletion packages/jest-core/src/runJest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ export default async function runJest({
if (globalConfig.onlyFailures) {
if (failedTestsCache) {
allTests = failedTestsCache.filterTests(allTests);
globalConfig = failedTestsCache.updateConfig(globalConfig);
} else {
allTests = sequencer.allFailedTests(allTests);
}
Expand Down
9 changes: 1 addition & 8 deletions packages/jest-jasmine2/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,7 @@ async function jasmine2(
}
}

if (globalConfig.enabledTestsMap) {
env.specFilter = (spec: Spec) => {
const suiteMap =
globalConfig.enabledTestsMap &&
globalConfig.enabledTestsMap[spec.result.testPath];
return (suiteMap && suiteMap[spec.result.fullName]) || false;
};
} else if (globalConfig.testNamePattern) {
if (globalConfig.testNamePattern) {
const testNameRegex = new RegExp(globalConfig.testNamePattern, 'i');
env.specFilter = (spec: Spec) => testNameRegex.test(spec.getFullName());
}
Expand Down
5 changes: 0 additions & 5 deletions packages/jest-types/src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,6 @@ export type GlobalConfig = {
coverageThreshold?: CoverageThreshold;
detectLeaks: boolean;
detectOpenHandles: boolean;
enabledTestsMap?: {
[key: string]: {
[key: string]: boolean;
};
};
expand: boolean;
filter?: Path;
findRelatedTests: boolean;
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 @@ -20,7 +20,6 @@ const DEFAULT_GLOBAL_CONFIG: Config.GlobalConfig = {
coverageThreshold: {global: {}},
detectLeaks: false,
detectOpenHandles: false,
enabledTestsMap: undefined,
errorOnDeprecated: false,
expand: false,
filter: undefined,
Expand Down

0 comments on commit 4f84f61

Please sign in to comment.