You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To reproduce just generate a new project using vue init webpack my-project and choose Jest as the test suite. Then run npm run unit and it will fail with error
SecurityError: localStorage is not available for opaque origins
at Window.get localStorage [as localStorage]
(node_modules/jsdom/lib/jsdom/browser/Window.js:257:15)
at Array.forEach ()
Based on the link in @bigtunacan 's original comment I was able to resolve this by adding:
testURL: 'http://localhost'
to the jest.conf.js file.
I also noticed that this filename doesn't match the default jest config filename (should be test.config.js) so jest won't pick it up without an explicit --config argument.
Activity
shayneo commentedon Aug 3, 2018
Same issue here, was able to resolve by adding
testEnvironment: 'node'
to jest.config.jsscriada commentedon Aug 12, 2018
Based on the link in @bigtunacan 's original comment I was able to resolve this by adding:
testURL: 'http://localhost'
to the
jest.conf.js
file.I also noticed that this filename doesn't match the default jest config filename (should be
test.config.js
) so jest won't pick it up without an explicit--config
argument.agirorn commentedon Feb 8, 2019
When I added
testEnvironment: 'node'
as @shayneo suggested to a new project. I got the tests running but the following error.But when I add the
testURL: 'http://localhost'
as @scriada suggest everything runs fine.