Skip to content

Commit

Permalink
Update testURL default value from about:blank to localhost (#6792)
Browse files Browse the repository at this point in the history
## 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
  • Loading branch information
palmerj3 authored and thymikee committed Aug 1, 2018
1 parent fb2a6ac commit b6d5752
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
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 @@ -59,7 +59,7 @@ exports[`--showConfig outputs config info and exits 1`] = `
],
\\"testRegex\\": \\"\\",
\\"testRunner\\": \\"<<REPLACED_JEST_PACKAGES_DIR>>/jest-jasmine2/build/index.js\\",
\\"testURL\\": \\"about:blank\\",
\\"testURL\\": \\"http://localhost\\",
\\"timers\\": \\"real\\",
\\"transform\\": [
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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\\",
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/src/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/src/valid_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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$': '<rootDir>/preprocessor.js',
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-validate/src/__tests__/fixtures/jest_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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$': '<rootDir>/preprocessor.js',
Expand Down

0 comments on commit b6d5752

Please sign in to comment.