Skip to content

Commit 67a02d3

Browse files
aleclarsonSimenB
authored andcommitted
fix: always resolve "jest-environment-jsdom" from jest-config (#7476)
Closes #7064
1 parent 7f19e6e commit 67a02d3

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
- `[jest-config]` Allow `bail` setting to be configured with a number allowing tests to abort after `n` of failures ([#7335](https://github.com/facebook/jest/pull/7335))
4343
- `[jest-config]` Allow % based configuration of `--max-workers` ([#7494](https://github.com/facebook/jest/pull/7494))
4444
- `[jest-runner]` Instantiate the test environment class with the current `testPath` ([#7442](https://github.com/facebook/jest/pull/7442))
45+
- `[jest-config]` Always resolve jest-environment-jsdom from jest-config ([#7476](https://github.com/facebook/jest/pull/7476))
4546

4647
### Fixes
4748

e2e/__tests__/__snapshots__/show_config.test.js.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ exports[`--showConfig outputs config info and exits 1`] = `
5252
\\"setupFilesAfterEnv\\": [],
5353
\\"skipFilter\\": false,
5454
\\"snapshotSerializers\\": [],
55-
\\"testEnvironment\\": \\"jest-environment-jsdom\\",
55+
\\"testEnvironment\\": \\"<<REPLACED_JEST_PACKAGES_DIR>>/jest-environment-jsdom/build/index.js\\",
5656
\\"testEnvironmentOptions\\": {},
5757
\\"testLocationInResults\\": false,
5858
\\"testMatch\\": [

packages/jest-config/src/normalize.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -416,12 +416,10 @@ export default function normalize(options: InitialOptions, argv: Argv) {
416416
options = setupPreset(options, options.preset);
417417
}
418418

419-
if (options.testEnvironment) {
420-
options.testEnvironment = getTestEnvironment({
421-
rootDir: options.rootDir,
422-
testEnvironment: options.testEnvironment,
423-
});
424-
}
419+
options.testEnvironment = getTestEnvironment({
420+
rootDir: options.rootDir,
421+
testEnvironment: options.testEnvironment || 'jsdom',
422+
});
425423

426424
if (!options.roots && options.testPathDirs) {
427425
options.roots = options.testPathDirs;

0 commit comments

Comments
 (0)