diff --git a/e2e/__tests__/multiProjectRunner.test.ts b/e2e/__tests__/multiProjectRunner.test.ts index ba4d129e00c1..aec58f3164f9 100644 --- a/e2e/__tests__/multiProjectRunner.test.ts +++ b/e2e/__tests__/multiProjectRunner.test.ts @@ -347,7 +347,7 @@ test('resolves projects and their properly', () => { }, }), 'project1.conf.json': JSON.stringify({ - name: 'project1', + id: 'project1', rootDir: './project1', // root dir should be this project's directory setupFiles: ['/project1_setup.js'], @@ -357,7 +357,7 @@ test('resolves projects and their properly', () => { 'project1/project1_setup.js': 'global.project1 = true;', 'project2/__tests__/test.test.js': `test('project2', () => expect(global.project2).toBe(true))`, 'project2/project2.conf.json': JSON.stringify({ - name: 'project2', + id: 'project2', rootDir: '../', // root dir is set to the top level setupFiles: ['/project2/project2_setup.js'], // rootDir shold be of the testEnvironment: 'node', @@ -513,7 +513,7 @@ describe("doesn't bleed module file extensions resolution with multiple workers" expect(configs).toHaveLength(2); - const [{name: name1}, {name: name2}] = configs; + const [{id: name1}, {id: name2}] = configs; expect(name1).toEqual(expect.any(String)); expect(name2).toEqual(expect.any(String)); @@ -556,7 +556,7 @@ describe("doesn't bleed module file extensions resolution with multiple workers" expect(configs).toHaveLength(2); - const [{name: name1}, {name: name2}] = configs; + const [{id: name1}, {id: name2}] = configs; expect(name1).toEqual(expect.any(String)); expect(name2).toEqual(expect.any(String)); diff --git a/e2e/__tests__/showConfig.test.ts b/e2e/__tests__/showConfig.test.ts index 0ef9c2a51ef5..8e850c0870cf 100644 --- a/e2e/__tests__/showConfig.test.ts +++ b/e2e/__tests__/showConfig.test.ts @@ -34,7 +34,7 @@ test('--showConfig outputs config info and exits', () => { .replace(/\\\\\.pnp\\\\\.\[\^[/\\]+\]\+\$/g, '<>') .replace(/\\\\(?:([^.]+?)|$)/g, '/$1') .replace(/"cacheDirectory": "(.+)"/g, '"cacheDirectory": "/tmp/jest"') - .replace(/"name": "(.+)"/g, '"name": "[md5 hash]"') + .replace(/"id": "(.+)"/g, '"id": "[md5 hash]"') .replace(/"version": "(.+)"/g, '"version": "[version]"') .replace(/"maxWorkers": (\d+)/g, '"maxWorkers": "[maxWorkers]"') .replace(/"\S*show-config-test/gm, '"<>') diff --git a/packages/jest-config/src/ValidConfig.ts b/packages/jest-config/src/ValidConfig.ts index c22337e0feaf..077b1567dc8d 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', injectGlobals: true, json: false, lastCommit: false, @@ -72,7 +73,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/index.ts b/packages/jest-config/src/index.ts index c0cc2326a7ec..c2238c3aea85 100644 --- a/packages/jest-config/src/index.ts +++ b/packages/jest-config/src/index.ts @@ -186,6 +186,7 @@ const groupOptions = ( globalTeardown: options.globalTeardown, globals: options.globals, haste: options.haste, + id: options.id, injectGlobals: options.injectGlobals, moduleDirectories: options.moduleDirectories, moduleFileExtensions: options.moduleFileExtensions, @@ -193,7 +194,6 @@ const groupOptions = ( moduleNameMapper: options.moduleNameMapper, modulePathIgnorePatterns: options.modulePathIgnorePatterns, modulePaths: options.modulePaths, - name: options.name, prettierPath: options.prettierPath, resetMocks: options.resetMocks, resetModules: options.resetModules, diff --git a/packages/jest-config/src/normalize.ts b/packages/jest-config/src/normalize.ts index fcd19c4db403..dce3e9b78b74 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 || '') @@ -891,7 +891,7 @@ export default function normalize( case 'logHeapUsage': case 'maxConcurrency': case 'mapCoverage': - case 'name': + case 'id': case 'noStackTrace': case 'notify': case 'notifyMode': diff --git a/packages/jest-types/src/Config.ts b/packages/jest-types/src/Config.ts index c492b08740df..ef28fb5d6774 100644 --- a/packages/jest-types/src/Config.ts +++ b/packages/jest-types/src/Config.ts @@ -161,7 +161,7 @@ export type InitialOptions = Partial<{ }; modulePathIgnorePatterns: Array; modulePaths: Array; - name: string; + id: string; noStackTrace: boolean; notify: boolean; notifyMode: string;