| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
In my tests, jsdom was throwing a "SecurityError" at HistoryImpl._sharedPushAndReplaceState (node_modules/react-scripts/node_modules/jsdom/lib/jsdom/living/window/History-impl.js:87:15) This happens because document.URL defaults to "about:blank". Unfortunately, if you interact with the History object it tries and fails to parse the URL, causing a "SecurityError" to be thrown. Setting the default URL to "http://localhost" fixes this issue.
|
Could you do so in src/setupTests.js instead? I’m not sure if it’s a good default although it looks reasonable. |
Sorry, something went wrong.
|
Trying that but having a lot of trouble. Seems there might be a bug in jsdom, but I'm not sure yet. When I put this in my src/setupTests.js file... import jsdom from 'react-scripts/node_modules/jsdom';
jsdom.changeURL(window, 'http://localhost'); // Fixes SecurityError exception thrown by jsdom... I get this error from jsdom: TypeError: Cannot set property '_URL' of undefined
at Object.<anonymous>.exports.changeURL (node_modules/react-scripts/node_modules/jsdom/lib/jsdom.js:64:12)
at Object.<anonymous> (src/setupTests.js:4:43)
The changeURL function is trying to get a document implementation from the window by grabbing window._document[Symbol('impl')] but it is getting undefined, causing the error. I'll keep trying... |
Sorry, something went wrong.
|
It looks reasonable, let's get it in. |
Sorry, something went wrong.
* master: (30 commits) Relax peerDependencies for ESLint preset (react#1191) Update Webpack to fix source map issues (react#1188) Update webpack prod config (react#1181) Chrome 'open tab' reuse an empty tab when possible (react#1165) Use file-loader for svgs (react#1180) Fix Babel issues in tests by applying the right transforms (react#1179) [babel-preset-react-app] Temporary fix missing babel plugins (react#1177) Add Subresource Integrity support (react#1176) Remove path module from webpack config on eject. (react#1175) Don't strip stack traces of evaluated webpack bundles (react#1050) Add deploy to Firebase CDN on template's README (Closes react#374) (react#1143) Update e2e.sh (react#1167) Document what npm build does and pushState (react#933) Fix minor typo/grammar (react#1099) Add "npm run build silently fails" to Troubleshooting (react#1168) Add testURL to jest config (react#1120) Make jsx-no-undef rule an error (react#1159) Update CHANGELOG.md Publish Update changelog for 0.8.1 ...
|
Fixed in 0.8.2. https://github.com/facebookincubator/create-react-app/releases/tag/v0.8.2 |
Sorry, something went wrong.
In my tests, jsdom was throwing a "SecurityError" at HistoryImpl._sharedPushAndReplaceState (node_modules/react-scripts/node_modules/jsdom/lib/jsdom/living/window/History-impl.js:87:15) This happens because document.URL defaults to "about:blank". Unfortunately, if you interact with the History object it tries and fails to parse the URL, causing a "SecurityError" to be thrown. Setting the default URL to "http://localhost" fixes this issue.
In my tests, jsdom was throwing a "SecurityError" at HistoryImpl._sharedPushAndReplaceState (node_modules/react-scripts/node_modules/jsdom/lib/jsdom/living/window/History-impl.js:87:15) This happens because document.URL defaults to "about:blank". Unfortunately, if you interact with the History object it tries and fails to parse the URL, causing a "SecurityError" to be thrown. Setting the default URL to "http://localhost" fixes this issue.
| Back | FazBrowse Home | New Git URL |
In my tests, jsdom was throwing a "SecurityError" at HistoryImpl._sharedPushAndReplaceState (node_modules/react-scripts/node_modules/jsdom/lib/jsdom/living/window/History-impl.js:87:15)
This happens because document.URL defaults to "about:blank". Unfortunately, if you interact with the History object it tries and fails to parse the URL, causing a "SecurityError" to be thrown. Setting the default URL to "http://localhost" fixes this issue.