Skip to content

Commit

Permalink
fix: respect runInBand being passed in watch mode (#14578)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB authored Sep 27, 2023
1 parent 2461639 commit f9398b1
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions e2e/__tests__/__snapshots__/showConfig.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ exports[`--showConfig outputs config info and exits 1`] = `
"passWithNoTests": false,
"projects": [],
"rootDir": "<<REPLACED_ROOT_DIR>>",
"runInBand": false,
"runTestsByPath": false,
"seed": <<RANDOM_SEED>>,
"skipFilter": false,
Expand Down
14 changes: 14 additions & 0 deletions packages/jest-config/src/__tests__/normalize.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
1 change: 1 addition & 0 deletions packages/jest-config/src/normalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit f9398b1

Please sign in to comment.