Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(breaking): remove undocumented enabledTestsMap config #10787

Merged
merged 4 commits into from Nov 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
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
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
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
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
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
Expand Up @@ -201,7 +201,6 @@ export default async function runJest({
if (globalConfig.onlyFailures) {
if (failedTestsCache) {
allTests = failedTestsCache.filterTests(allTests);
globalConfig = failedTestsCache.updateConfig(globalConfig);
SimenB marked this conversation as resolved.
Show resolved Hide resolved
} else {
allTests = sequencer.allFailedTests(allTests);
}
Expand Down
9 changes: 1 addition & 8 deletions packages/jest-jasmine2/src/index.ts
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
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
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