From f0e6d5b6260c5699000751e0dc58dbb894d4d74f Mon Sep 17 00:00:00 2001 From: Jason Palmer Date: Wed, 1 Aug 2018 07:33:17 -0400 Subject: [PATCH 1/3] Update testURL default value from about:blank to localhost --- packages/jest-config/src/defaults.js | 2 +- packages/jest-config/src/valid_config.js | 2 +- packages/jest-validate/src/__tests__/fixtures/jest_config.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/jest-config/src/defaults.js b/packages/jest-config/src/defaults.js index a4fc55e3be98..2ab932fce4cc 100644 --- a/packages/jest-config/src/defaults.js +++ b/packages/jest-config/src/defaults.js @@ -72,7 +72,7 @@ export default ({ testRegex: '', testResultsProcessor: null, testRunner: 'jasmine2', - testURL: 'about:blank', + testURL: 'http://localhost', timers: 'real', transform: null, transformIgnorePatterns: [NODE_MODULES_REGEXP], diff --git a/packages/jest-config/src/valid_config.js b/packages/jest-config/src/valid_config.js index 0079b1019dd1..9dd1f21abb95 100644 --- a/packages/jest-config/src/valid_config.js +++ b/packages/jest-config/src/valid_config.js @@ -96,7 +96,7 @@ export default ({ testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.jsx?$', testResultsProcessor: 'processor-node-module', testRunner: 'jasmine2', - testURL: 'about:blank', + testURL: 'http://localhost', timers: 'real', transform: { '^.+\\.js$': '/preprocessor.js', diff --git a/packages/jest-validate/src/__tests__/fixtures/jest_config.js b/packages/jest-validate/src/__tests__/fixtures/jest_config.js index bd11f9b35a27..742dce16ac5a 100644 --- a/packages/jest-validate/src/__tests__/fixtures/jest_config.js +++ b/packages/jest-validate/src/__tests__/fixtures/jest_config.js @@ -51,7 +51,7 @@ const defaultConfig = { testPathIgnorePatterns: [NODE_MODULES_REGEXP], testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.jsx?$', testResultsProcessor: null, - testURL: 'about:blank', + testURL: 'http://localhost', timers: 'real', transformIgnorePatterns: [NODE_MODULES_REGEXP], useStderr: false, @@ -116,7 +116,7 @@ const validConfig = { testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.jsx?$', testResultsProcessor: 'processor-node-module', testRunner: 'jasmine2', - testURL: 'about:blank', + testURL: 'http://localhost', timers: 'real', transform: { '^.+\\.js$': '/preprocessor.js', From b73250761d0a9949594d1923fb00ae45ed5c58d7 Mon Sep 17 00:00:00 2001 From: Jason Palmer Date: Wed, 1 Aug 2018 08:13:06 -0400 Subject: [PATCH 2/3] Update snapshots --- e2e/__tests__/__snapshots__/show_config.test.js.snap | 2 +- .../jest-cli/src/lib/__tests__/__snapshots__/init.test.js.snap | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/__tests__/__snapshots__/show_config.test.js.snap b/e2e/__tests__/__snapshots__/show_config.test.js.snap index f6a773eaa247..e12bb522fdff 100644 --- a/e2e/__tests__/__snapshots__/show_config.test.js.snap +++ b/e2e/__tests__/__snapshots__/show_config.test.js.snap @@ -59,7 +59,7 @@ exports[`--showConfig outputs config info and exits 1`] = ` ], \\"testRegex\\": \\"\\", \\"testRunner\\": \\"<>/jest-jasmine2/build/index.js\\", - \\"testURL\\": \\"about:blank\\", + \\"testURL\\": \\"http://localhost\\", \\"timers\\": \\"real\\", \\"transform\\": [ [ diff --git a/packages/jest-cli/src/lib/__tests__/__snapshots__/init.test.js.snap b/packages/jest-cli/src/lib/__tests__/__snapshots__/init.test.js.snap index 8123bb5ac5d1..283bf34d2b16 100644 --- a/packages/jest-cli/src/lib/__tests__/__snapshots__/init.test.js.snap +++ b/packages/jest-cli/src/lib/__tests__/__snapshots__/init.test.js.snap @@ -174,7 +174,7 @@ module.exports = { // testRunner: \\"jasmine2\\", // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href - // testURL: \\"about:blank\\", + // testURL: \\"http://localhost\\", // Setting this value to \\"fake\\" allows the use of fake timers for functions such as \\"setTimeout\\" // timers: \\"real\\", From 0f83b9be60aedfe2695751855ef35eeed6441fcc Mon Sep 17 00:00:00 2001 From: Jason Palmer Date: Wed, 1 Aug 2018 09:22:50 -0400 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 34a678f8f119..50edbedf48b5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ### Fixes +- `[jest-config]` Update default config for testURL from 'about:blank' to 'http://localhost' to address latest JSDOM security warning. ([#6792](https://github.com/facebook/jest/pull/6792)) - `[jest-circus]` Fix retryTimes so errors are reset before re-running ([#6762](https://github.com/facebook/jest/pull/6762)) - `[docs]` Update `expect.objectContaining()` description ([#6754](https://github.com/facebook/jest/pull/6754)) - `[babel-jest]` Make `getCacheKey()` take into account `createTransformer` options ([#6699](https://github.com/facebook/jest/pull/6699))