From a161ea534e8c3f062f8330596ab56d7b356d6a7f Mon Sep 17 00:00:00 2001 From: aleclarson Date: Thu, 6 Dec 2018 13:03:42 -0500 Subject: [PATCH 1/2] fix: always resolve "jest-environment-jsdom" from jest-config Closes #7064 --- CHANGELOG.md | 1 + packages/jest-config/src/normalize.js | 10 ++++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1953f9889dd0..6b33ff22797d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ - `[jest-config]` Add `haste.computeSha1` option to compute the sha-1 of the files in the haste map ([#7345](https://github.com/facebook/jest/pull/7345)) - `[expect]` `expect(Infinity).toBeCloseTo(Infinity)` Treats `Infinity` as equal in toBeCloseTo matcher ([#7405](https://github.com/facebook/jest/pull/7405)) - `[jest-worker]` Add node worker-thread support to jest-worker ([#7408](https://github.com/facebook/jest/pull/7408)) +- `[jest-config]` Always resolve jest-environment-jsdom from jest-config ([#7476](https://github.com/facebook/jest/pull/7476)) ### Fixes diff --git a/packages/jest-config/src/normalize.js b/packages/jest-config/src/normalize.js index b29e3e690091..1d7a22b6752f 100644 --- a/packages/jest-config/src/normalize.js +++ b/packages/jest-config/src/normalize.js @@ -401,12 +401,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; From 7ed9dc634425dc632edc3b4f20d6e167ebaeb2bc Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Tue, 25 Dec 2018 12:47:35 +0100 Subject: [PATCH 2/2] update snapshot --- e2e/__tests__/__snapshots__/show_config.test.js.snap | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/__tests__/__snapshots__/show_config.test.js.snap b/e2e/__tests__/__snapshots__/show_config.test.js.snap index b8da903ee666..3464293d2b45 100644 --- a/e2e/__tests__/__snapshots__/show_config.test.js.snap +++ b/e2e/__tests__/__snapshots__/show_config.test.js.snap @@ -52,7 +52,7 @@ exports[`--showConfig outputs config info and exits 1`] = ` \\"setupFilesAfterEnv\\": [], \\"skipFilter\\": false, \\"snapshotSerializers\\": [], - \\"testEnvironment\\": \\"jest-environment-jsdom\\", + \\"testEnvironment\\": \\"<>/jest-environment-jsdom/build/index.js\\", \\"testEnvironmentOptions\\": {}, \\"testLocationInResults\\": false, \\"testMatch\\": [