Skip to content
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

vue-cli 3.0.0-rc.7 test fails #1960

Closed
andreydos opened this issue Jul 27, 2018 · 4 comments
Closed

vue-cli 3.0.0-rc.7 test fails #1960

andreydos opened this issue Jul 27, 2018 · 4 comments

Comments

@andreydos
Copy link

Version

3.0.0-rc.7

Node and OS info

npm 5.6.0 / node 8.11.3 / Ubuntu

Steps to reproduce

vue create hello-world (choose only unit test with jest)
cd hello-world/
npm run test:unit

What is expected?

Demo spec passes the test.

What is actually happening?

FAIL tests/unit/HelloWorld.spec.js
● Test suite failed to run

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 (<anonymous>)

Test Suites: 1 failed, 1 total
Tests: 0 total
Snapshots: 0 total
Time: 0.465s
Ran all test suites.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! hello-world123@0.1.0 test:unit: vue-cli-service test:unit
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the hello-world123@0.1.0 test:unit script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.


Found this today, when my CI alarmed to me (there I use vue-cli 3.0.0-rc.3). In production we still use hardcode versions of packages in packege.json (for example "@vue/cli-service": "3.0.0-rc.3"), so, as I think, it may be reproduced in many previous releases

@epiphone
Copy link

Had the same problem after updating to 3.0.0-rc.7. Setting "testURL": "http://localhost/" in Jest config helped. Here's a related question from Stack Overflow: https://stackoverflow.com/questions/51554366/npm-test-fail-with-jest

@Akryum Akryum added scope: unit-jest needs team repro We acknowledged your report and will soon try to reproduce it labels Jul 27, 2018
@andreydos
Copy link
Author

@epiphone thanks! This work!

@yyx990803 yyx990803 added upstream and removed needs team repro We acknowledged your report and will soon try to reproduce it labels Jul 27, 2018
@p8ul
Copy link

p8ul commented Aug 6, 2018

If you are using jsdom, make sure you include url in jsdom configuration

const dom = new JSDOM(``, {
url: "https://example.org/",
});

fritx added a commit to we-fork/vue-webpack that referenced this issue Sep 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants