Skip to content

Commit b6d5752

Browse files
palmerj3thymikee
authored andcommitted
Update testURL default value from about:blank to localhost (#6792)
## Summary Updates jests default value for testURL from 'about:blank' to 'http://localhost'. This ensures that JSDOM doesn't throw a security error for tests using the jsdom environment. Should fix #6766
1 parent fb2a6ac commit b6d5752

6 files changed

Lines changed: 7 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
### Fixes
1010

11+
- `[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))
1112
- `[jest-circus]` Fix retryTimes so errors are reset before re-running ([#6762](https://github.com/facebook/jest/pull/6762))
1213
- `[docs]` Update `expect.objectContaining()` description ([#6754](https://github.com/facebook/jest/pull/6754))
1314
- `[babel-jest]` Make `getCacheKey()` take into account `createTransformer` options ([#6699](https://github.com/facebook/jest/pull/6699))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ exports[`--showConfig outputs config info and exits 1`] = `
5959
],
6060
\\"testRegex\\": \\"\\",
6161
\\"testRunner\\": \\"<<REPLACED_JEST_PACKAGES_DIR>>/jest-jasmine2/build/index.js\\",
62-
\\"testURL\\": \\"about:blank\\",
62+
\\"testURL\\": \\"http://localhost\\",
6363
\\"timers\\": \\"real\\",
6464
\\"transform\\": [
6565
[

packages/jest-cli/src/lib/__tests__/__snapshots__/init.test.js.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ module.exports = {
174174
// testRunner: \\"jasmine2\\",
175175
176176
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
177-
// testURL: \\"about:blank\\",
177+
// testURL: \\"http://localhost\\",
178178
179179
// Setting this value to \\"fake\\" allows the use of fake timers for functions such as \\"setTimeout\\"
180180
// timers: \\"real\\",

packages/jest-config/src/defaults.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export default ({
7272
testRegex: '',
7373
testResultsProcessor: null,
7474
testRunner: 'jasmine2',
75-
testURL: 'about:blank',
75+
testURL: 'http://localhost',
7676
timers: 'real',
7777
transform: null,
7878
transformIgnorePatterns: [NODE_MODULES_REGEXP],

packages/jest-config/src/valid_config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export default ({
9696
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.jsx?$',
9797
testResultsProcessor: 'processor-node-module',
9898
testRunner: 'jasmine2',
99-
testURL: 'about:blank',
99+
testURL: 'http://localhost',
100100
timers: 'real',
101101
transform: {
102102
'^.+\\.js$': '<rootDir>/preprocessor.js',

packages/jest-validate/src/__tests__/fixtures/jest_config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const defaultConfig = {
5151
testPathIgnorePatterns: [NODE_MODULES_REGEXP],
5252
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.jsx?$',
5353
testResultsProcessor: null,
54-
testURL: 'about:blank',
54+
testURL: 'http://localhost',
5555
timers: 'real',
5656
transformIgnorePatterns: [NODE_MODULES_REGEXP],
5757
useStderr: false,
@@ -116,7 +116,7 @@ const validConfig = {
116116
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.jsx?$',
117117
testResultsProcessor: 'processor-node-module',
118118
testRunner: 'jasmine2',
119-
testURL: 'about:blank',
119+
testURL: 'http://localhost',
120120
timers: 'real',
121121
transform: {
122122
'^.+\\.js$': '<rootDir>/preprocessor.js',

0 commit comments

Comments
 (0)