diff --git a/e2e/__tests__/__snapshots__/showConfig.test.ts.snap b/e2e/__tests__/__snapshots__/showConfig.test.ts.snap index 9c644c2b47e6..39a4f66fbb43 100644 --- a/e2e/__tests__/__snapshots__/showConfig.test.ts.snap +++ b/e2e/__tests__/__snapshots__/showConfig.test.ts.snap @@ -35,7 +35,6 @@ exports[`--showConfig outputs config info and exits 1`] = ` ], "moduleNameMapper": [], "modulePathIgnorePatterns": [], - "name": "[md5 hash]", "prettierPath": "prettier", "resetMocks": false, "resetModules": false, diff --git a/e2e/__tests__/multiProjectRunner.test.ts b/e2e/__tests__/multiProjectRunner.test.ts index ba4d129e00c1..04379fbc19b4 100644 --- a/e2e/__tests__/multiProjectRunner.test.ts +++ b/e2e/__tests__/multiProjectRunner.test.ts @@ -513,14 +513,6 @@ describe("doesn't bleed module file extensions resolution with multiple workers" expect(configs).toHaveLength(2); - const [{name: name1}, {name: name2}] = configs; - - expect(name1).toEqual(expect.any(String)); - expect(name2).toEqual(expect.any(String)); - expect(name1).toHaveLength(32); - expect(name2).toHaveLength(32); - expect(name1).not.toEqual(name2); - const {stderr} = runJest(DIR, [ '--no-watchman', '-w=2', @@ -556,14 +548,6 @@ describe("doesn't bleed module file extensions resolution with multiple workers" expect(configs).toHaveLength(2); - const [{name: name1}, {name: name2}] = configs; - - expect(name1).toEqual(expect.any(String)); - expect(name2).toEqual(expect.any(String)); - expect(name1).toHaveLength(32); - expect(name2).toHaveLength(32); - expect(name1).not.toEqual(name2); - const {stderr} = runJest(DIR, ['--no-watchman', '-w=2']); expect(stderr).toMatch('Ran all test suites in 2 projects.'); diff --git a/packages/jest-config/src/ValidConfig.ts b/packages/jest-config/src/ValidConfig.ts index 4fa4022acc8c..2c802af7c886 100644 --- a/packages/jest-config/src/ValidConfig.ts +++ b/packages/jest-config/src/ValidConfig.ts @@ -58,6 +58,7 @@ const initialOptions: Config.InitialOptions = { platforms: ['ios', 'android'], throwOnModuleCollision: false, }, + id: 'string', json: false, lastCommit: false, logHeapUsage: true, @@ -71,7 +72,6 @@ const initialOptions: Config.InitialOptions = { }, modulePathIgnorePatterns: ['/build/'], modulePaths: ['/shared/vendor/modules'], - name: 'string', noStackTrace: false, notify: false, notifyMode: 'failure-change', diff --git a/packages/jest-config/src/__tests__/normalize.test.js b/packages/jest-config/src/__tests__/normalize.test.js index eb7ba42ad4a5..23a429367ce3 100644 --- a/packages/jest-config/src/__tests__/normalize.test.js +++ b/packages/jest-config/src/__tests__/normalize.test.js @@ -79,7 +79,7 @@ it('picks a name based on the rootDir', () => { rootDir, }, {}, - ).options.name, + ).options.id, ).toBe(expected); }); @@ -100,11 +100,11 @@ it('keeps custom names based on the rootDir', () => { expect( normalize( { - name: 'custom-name', + id: 'custom-name', rootDir: '/root/path/foo', }, {}, - ).options.name, + ).options.id, ).toBe('custom-name'); }); diff --git a/packages/jest-config/src/normalize.ts b/packages/jest-config/src/normalize.ts index 9f6f35062759..324c786f561b 100644 --- a/packages/jest-config/src/normalize.ts +++ b/packages/jest-config/src/normalize.ts @@ -361,8 +361,8 @@ const normalizeMissingOptions = ( configPath: Config.Path | null | undefined, projectIndex: number, ): Config.InitialOptionsWithRootDir => { - if (!options.name) { - options.name = createHash('md5') + if (!options.id) { + options.id = createHash('md5') .update(options.rootDir) // In case we load config from some path that has the same root dir .update(configPath || '') @@ -885,12 +885,12 @@ export default function normalize( case 'findRelatedTests': case 'forceCoverageMatch': case 'forceExit': + case 'id': case 'lastCommit': case 'listTests': case 'logHeapUsage': case 'maxConcurrency': case 'mapCoverage': - case 'name': case 'noStackTrace': case 'notify': case 'notifyMode': diff --git a/packages/jest-core/src/__tests__/SearchSource.test.ts b/packages/jest-core/src/__tests__/SearchSource.test.ts index fbc4513ef1f6..85e409bfa001 100644 --- a/packages/jest-core/src/__tests__/SearchSource.test.ts +++ b/packages/jest-core/src/__tests__/SearchSource.test.ts @@ -40,7 +40,7 @@ const toPaths = (tests: Array) => tests.map(({path}) => path); let findMatchingTests: (config: Config.ProjectConfig) => Promise; describe('SearchSource', () => { - const name = 'SearchSource'; + const id = 'SearchSource'; let searchSource: SearchSource; describe('isTestFilePath', () => { @@ -49,7 +49,7 @@ describe('SearchSource', () => { beforeEach(() => { config = normalize( { - name, + id, rootDir: '.', roots: [], }, @@ -68,7 +68,7 @@ describe('SearchSource', () => { if (process.platform !== 'win32') { config = normalize( { - name, + id, rootDir: '.', roots: [], testMatch: undefined, @@ -117,8 +117,8 @@ describe('SearchSource', () => { it('finds tests matching a pattern via testRegex', () => { const {options: config} = normalize( { + id, moduleFileExtensions: ['js', 'jsx', 'txt'], - name, rootDir, testMatch: undefined, testRegex: 'not-really-a-test', @@ -141,8 +141,8 @@ describe('SearchSource', () => { it('finds tests matching a pattern via testMatch', () => { const {options: config} = normalize( { + id, moduleFileExtensions: ['js', 'jsx', 'txt'], - name, rootDir, testMatch: ['**/not-really-a-test.txt', '!**/do-not-match-me.txt'], testRegex: '', @@ -165,8 +165,8 @@ describe('SearchSource', () => { it('finds tests matching a JS regex pattern', () => { const {options: config} = normalize( { + id, moduleFileExtensions: ['js', 'jsx'], - name, rootDir, testMatch: undefined, testRegex: 'test.jsx?', @@ -187,8 +187,8 @@ describe('SearchSource', () => { it('finds tests matching a JS glob pattern', () => { const {options: config} = normalize( { + id, moduleFileExtensions: ['js', 'jsx'], - name, rootDir, testMatch: ['**/test.js?(x)'], testRegex: '', @@ -209,7 +209,7 @@ describe('SearchSource', () => { it('finds tests with default file extensions using testRegex', () => { const {options: config} = normalize( { - name, + id, rootDir, testMatch: undefined, testRegex, @@ -230,7 +230,7 @@ describe('SearchSource', () => { it('finds tests with default file extensions using testMatch', () => { const {options: config} = normalize( { - name, + id, rootDir, testMatch, testRegex: '', @@ -251,7 +251,7 @@ describe('SearchSource', () => { it('finds tests with parentheses in their rootDir when using testMatch', () => { const {options: config} = normalize( { - name, + id, rootDir: path.resolve(__dirname, 'test_root_with_(parentheses)'), testMatch: ['**/__testtests__/**/*'], testRegex: undefined, @@ -271,8 +271,8 @@ describe('SearchSource', () => { it('finds tests with similar but custom file extensions', () => { const {options: config} = normalize( { + id, moduleFileExtensions: ['js', 'jsx'], - name, rootDir, testMatch, }, @@ -292,8 +292,8 @@ describe('SearchSource', () => { it('finds tests with totally custom foobar file extensions', () => { const {options: config} = normalize( { + id, moduleFileExtensions: ['js', 'foobar'], - name, rootDir, testMatch, }, @@ -313,8 +313,8 @@ describe('SearchSource', () => { it('finds tests with many kinds of file extensions', () => { const {options: config} = normalize( { + id, moduleFileExtensions: ['js', 'jsx'], - name, rootDir, testMatch, }, @@ -334,7 +334,7 @@ describe('SearchSource', () => { it('finds tests using a regex only', () => { const {options: config} = normalize( { - name, + id, rootDir, testMatch: undefined, testRegex, @@ -355,7 +355,7 @@ describe('SearchSource', () => { it('finds tests using a glob only', () => { const {options: config} = normalize( { - name, + id, rootDir, testMatch, testRegex: '', @@ -402,7 +402,7 @@ describe('SearchSource', () => { 'haste_impl.js', ), }, - name: 'SearchSource-findRelatedTests-tests', + id: 'SearchSource-findRelatedTests-tests', rootDir, }, {} as Config.Argv, @@ -454,8 +454,8 @@ describe('SearchSource', () => { beforeEach(done => { const {options: config} = normalize( { + id, moduleFileExtensions: ['js', 'jsx', 'foobar'], - name, rootDir, testMatch, }, @@ -513,7 +513,7 @@ describe('SearchSource', () => { if (process.platform !== 'win32') { const config = normalize( { - name, + id, rootDir: '.', roots: ['/foo/bar/prefix'], }, @@ -546,7 +546,7 @@ describe('SearchSource', () => { '../../../jest-haste-map/src/__tests__/haste_impl.js', ), }, - name: 'SearchSource-findRelatedSourcesFromTestsInChangedFiles-tests', + id: 'SearchSource-findRelatedSourcesFromTestsInChangedFiles-tests', rootDir, }, {} as Config.Argv, diff --git a/packages/jest-runtime/src/__mocks__/createRuntime.js b/packages/jest-runtime/src/__mocks__/createRuntime.js index 1512da0cb3eb..08645138935d 100644 --- a/packages/jest-runtime/src/__mocks__/createRuntime.js +++ b/packages/jest-runtime/src/__mocks__/createRuntime.js @@ -27,7 +27,7 @@ module.exports = async function createRuntime(filename, config) { 'haste_impl.js', ), }, - name: 'Runtime-' + filename.replace(/\W/, '-') + '.tests', + id: 'Runtime-' + filename.replace(/\W/, '-') + '.tests', rootDir: path.resolve(path.dirname(filename), 'test_root'), ...config, }, diff --git a/packages/jest-types/src/Config.ts b/packages/jest-types/src/Config.ts index 8bfc411710f7..89ddfd13d7de 100644 --- a/packages/jest-types/src/Config.ts +++ b/packages/jest-types/src/Config.ts @@ -146,7 +146,7 @@ export type InitialOptions = Partial<{ }; modulePathIgnorePatterns: Array; modulePaths: Array; - name: string; + id: string; noStackTrace: boolean; notify: boolean; notifyMode: string;