diff --git a/CHANGELOG.md b/CHANGELOG.md index 151c2adf68a2..b5618701be14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ - `[babel-plugin-jest-hoist]` Use `denylist` instead of the deprecated `blacklist` for Babel 8 support ([#14109](https://github.com/jestjs/jest/pull/14109)) - `[expect]` Check error instance type for `toThrow/toThrowError` ([#14576](https://github.com/jestjs/jest/pull/14576)) - `[jest-circus]` [**BREAKING**] Prevent false test failures caused by promise rejections handled asynchronously ([#14315](https://github.com/jestjs/jest/pull/14315)) +- `[jest-config]` Make sure to respect `runInBand` option ([#14578](https://github.com/facebook/jest/pull/14578)) - `[@jest/expect-utils]` Fix comparison of `DataView` ([#14408](https://github.com/jestjs/jest/pull/14408)) - `[jest-leak-detector]` Make leak-detector more aggressive when running GC ([#14526](https://github.com/jestjs/jest/pull/14526)) - `[jest-util]` Make sure `isInteractive` works in a browser ([#14552](https://github.com/jestjs/jest/pull/14552)) diff --git a/e2e/__tests__/__snapshots__/showConfig.test.ts.snap b/e2e/__tests__/__snapshots__/showConfig.test.ts.snap index 332667b5f4fc..ff4075946605 100644 --- a/e2e/__tests__/__snapshots__/showConfig.test.ts.snap +++ b/e2e/__tests__/__snapshots__/showConfig.test.ts.snap @@ -130,6 +130,7 @@ exports[`--showConfig outputs config info and exits 1`] = ` "passWithNoTests": false, "projects": [], "rootDir": "<>", + "runInBand": false, "runTestsByPath": false, "seed": <>, "skipFilter": false, diff --git a/packages/jest-config/src/__tests__/normalize.test.ts b/packages/jest-config/src/__tests__/normalize.test.ts index 38bd2e473a1a..61429eab0208 100644 --- a/packages/jest-config/src/__tests__/normalize.test.ts +++ b/packages/jest-config/src/__tests__/normalize.test.ts @@ -2215,3 +2215,17 @@ describe('randomize', () => { expect(options.randomize).toBeFalsy(); }); }); + +describe('runInBand', () => { + test('always set it', async () => { + const {options} = await normalize({rootDir: '/root/'}, {} as Config.Argv); + expect(options.runInBand).toBe(false); + }); + + test('respect argv', async () => { + const {options} = await normalize({rootDir: '/root/'}, { + runInBand: true, + } as Config.Argv); + expect(options.runInBand).toBe(true); + }); +}); diff --git a/packages/jest-config/src/normalize.ts b/packages/jest-config/src/normalize.ts index 25ef99b2e954..6ca2b3e6c847 100644 --- a/packages/jest-config/src/normalize.ts +++ b/packages/jest-config/src/normalize.ts @@ -1092,6 +1092,7 @@ export default async function normalize( 10, ); newOptions.maxWorkers = getMaxWorkers(argv, options); + newOptions.runInBand = argv.runInBand || false; if (newOptions.testRegex.length > 0 && options.testMatch) { throw createConfigError(