Skip to content

Commit

Permalink
fix: always resolve "jest-environment-jsdom" from jest-config (jestjs…
Browse files Browse the repository at this point in the history
  • Loading branch information
aleclarson authored and captain-yossarian committed Jul 18, 2019
1 parent 6f41adb commit 6799d48
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
- `[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))
- `[jest-config]` Allow % based configuration of `--max-workers` ([#7494](https://github.com/facebook/jest/pull/7494))
- `[jest-runner]` Instantiate the test environment class with the current `testPath` ([#7442](https://github.com/facebook/jest/pull/7442))
- `[jest-config]` Always resolve jest-environment-jsdom from jest-config ([#7476](https://github.com/facebook/jest/pull/7476))

### Fixes

Expand Down
2 changes: 1 addition & 1 deletion e2e/__tests__/__snapshots__/show_config.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ exports[`--showConfig outputs config info and exits 1`] = `
\\"setupFilesAfterEnv\\": [],
\\"skipFilter\\": false,
\\"snapshotSerializers\\": [],
\\"testEnvironment\\": \\"jest-environment-jsdom\\",
\\"testEnvironment\\": \\"<<REPLACED_JEST_PACKAGES_DIR>>/jest-environment-jsdom/build/index.js\\",
\\"testEnvironmentOptions\\": {},
\\"testLocationInResults\\": false,
\\"testMatch\\": [
Expand Down
10 changes: 4 additions & 6 deletions packages/jest-config/src/normalize.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,12 +416,10 @@ export default function normalize(options: InitialOptions, argv: Argv) {
options = setupPreset(options, options.preset);
}

if (options.testEnvironment) {
options.testEnvironment = getTestEnvironment({
rootDir: options.rootDir,
testEnvironment: options.testEnvironment,
});
}
options.testEnvironment = getTestEnvironment({
rootDir: options.rootDir,
testEnvironment: options.testEnvironment || 'jsdom',
});

if (!options.roots && options.testPathDirs) {
options.roots = options.testPathDirs;
Expand Down

0 comments on commit 6799d48

Please sign in to comment.