-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jest tests fail - SecurityError: localStorage is not available for opaque origins #1424
Comments
Same issue here, was able to resolve by adding |
Based on the link in @bigtunacan 's original comment I was able to resolve this by adding: testURL: 'http://localhost' to the I also noticed that this filename doesn't match the default jest config filename (should be |
When I added > vue-webpack@1.0.0 test /home/agirorn/code-play/vue-webpack
> npm run unit && npm run e2e
> vue-webpack@1.0.0 unit /home/agirorn/code-play/vue-webpack
> jest --config test/unit/jest.conf.js --coverage
● Deprecation Warning:
Option "mapCoverage" has been removed, as it's no longer necessary.
Please update your configuration.
Configuration Documentation:
https://facebook.github.io/jest/docs/configuration.html
FAIL test/unit/specs/HelloWorld.spec.js
HelloWorld.vue
✕ should render correct contents (14ms)
● HelloWorld.vue › should render correct contents
TypeError: Cannot read property 'querySelector' of undefined
6 | const Constructor = Vue.extend(HelloWorld);
7 | const vm = new Constructor().$mount();
> 8 | expect(vm.$el.querySelector('.hello h1').textContent)
9 | .toEqual('Welcome to Your Vue.js App');
10 | });
11 | });
at Object.querySelector (test/unit/specs/HelloWorld.spec.js:8:19) But when I add the |
To reproduce just generate a new project using
vue init webpack my-project
and choose Jest as the test suite. Then runnpm run unit
and it will fail with errorThis appears related to this issue with jsdom jsdom/jsdom#2304
For now there is a workaround by locking jsdom to version 11.11.0
The text was updated successfully, but these errors were encountered: