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

SecurityError: localStorage is not available for opaque origins #6769

Closed
ektomorfik opened this issue Jul 27, 2018 · 10 comments
Closed

SecurityError: localStorage is not available for opaque origins #6769

ektomorfik opened this issue Jul 27, 2018 · 10 comments

Comments

@ektomorfik
Copy link

🐛 Bug Report

Hi guys!
I've made setup without create-react-app and when I try to run tests I got error:
image

Test is very simple :
it('first test', () => {
expect(123).toBe(123)
})

Expected behavior

I'd like to be able to pass my tests

@henrikbjorn
Copy link

I see this also

@creamidea
Copy link

creamidea commented Jul 27, 2018

related to jsdom/jsdom#2304

You can set the testURL of the jest configuration like this:

  "jest": {
    "verbose": true,
    "testURL": "http://localhost/"
  }

@ektomorfik
Copy link
Author

ektomorfik commented Jul 27, 2018

Ok. The fix is to set testURL: "http://localhost/" in jest config.
But I have another problem. All running process is very slow, It last about 5-7 sec even if I run my tests with --watch.
Anyone knows how to increase performance?
Fast fix: I changed my Jest version from "23.4.1" to "22.4.1"

@csvan
Copy link

csvan commented Jul 27, 2018

Duplicate: #6766

@akuji1993
Copy link

For anyone just starting to use Jest and running into this error, this is how you define a Jest configuration: https://jestjs.io/docs/en/configuration.html

@matttk
Copy link

matttk commented Aug 1, 2018

Update: setting testURL works. I had a different problem, with my babelrc.

When I set testURL, I get a new error at all instances of import Enzyme

SyntaxError: Unexpected token import

Not sure if this is related to react-sass-starterkit test setup or not, since this is my first time trying to do react testing with jest...

lastquestion pushed a commit to opentable/design-tokens that referenced this issue Aug 1, 2018
2zH added a commit to pluginjs/pluginjs that referenced this issue Aug 2, 2018
bmaupin added a commit to bmaupin/langtrends-api that referenced this issue Aug 2, 2018
arb added a commit to arb/celebrate that referenced this issue Aug 2, 2018
Fixes issue with local storage on CI.
Related to jestjs/jest#6769
petermikitsh added a commit to petermikitsh/react-router that referenced this issue Aug 2, 2018
petermikitsh added a commit to petermikitsh/react-router that referenced this issue Aug 2, 2018
petermikitsh added a commit to petermikitsh/react-router that referenced this issue Aug 2, 2018
petermikitsh added a commit to petermikitsh/react-router that referenced this issue Aug 2, 2018
mythz added a commit to LegacyTemplates/vue-spa that referenced this issue Aug 3, 2018
brynachj added a commit to brynachj/js_canvas_shmup that referenced this issue Aug 4, 2018
…tead of having security issues (see √=jestjs/jest#6769).

Added first test - simple mock/expectation test to enemyService.test.js
timdorr pushed a commit to remix-run/react-router that referenced this issue Aug 5, 2018
* [Redirect] don't import entire history module

* fix jest config (jestjs/jest#6769)

* fix jest config (jestjs/jest#6769)

* fix jest config (jestjs/jest#6769)

* fix jest config (jestjs/jest#6769)
skogsmaskin added a commit to sanity-io/sanity that referenced this issue Dec 14, 2018
skogsmaskin added a commit to sanity-io/sanity that referenced this issue Dec 14, 2018
skogsmaskin added a commit to sanity-io/sanity that referenced this issue Dec 14, 2018
skogsmaskin added a commit to sanity-io/sanity that referenced this issue Dec 14, 2018
skogsmaskin added a commit to sanity-io/sanity that referenced this issue Dec 14, 2018
skogsmaskin added a commit to sanity-io/sanity that referenced this issue Dec 14, 2018
skogsmaskin added a commit to sanity-io/sanity that referenced this issue Dec 14, 2018
[util] Set testURL for Jest to avoid jestjs/jest#6769

[validation] Set testURL for Jest to avoid jestjs/jest#6769

[schema] Set testURL for Jest to avoid jestjs/jest#6769

[export] Set testURL for Jest to avoid jestjs/jest#6769
skogsmaskin added a commit to sanity-io/sanity that referenced this issue Dec 17, 2018
[util] Set testURL for Jest to avoid jestjs/jest#6769

[validation] Set testURL for Jest to avoid jestjs/jest#6769

[schema] Set testURL for Jest to avoid jestjs/jest#6769

[export] Set testURL for Jest to avoid jestjs/jest#6769
skogsmaskin added a commit to sanity-io/sanity that referenced this issue Dec 17, 2018
[util] Set testURL for Jest to avoid jestjs/jest#6769

[validation] Set testURL for Jest to avoid jestjs/jest#6769

[schema] Set testURL for Jest to avoid jestjs/jest#6769

[export] Set testURL for Jest to avoid jestjs/jest#6769
skogsmaskin added a commit to sanity-io/sanity that referenced this issue Dec 17, 2018
[util] Set testURL for Jest to avoid jestjs/jest#6769

[validation] Set testURL for Jest to avoid jestjs/jest#6769

[schema] Set testURL for Jest to avoid jestjs/jest#6769

[export] Set testURL for Jest to avoid jestjs/jest#6769
skogsmaskin added a commit to sanity-io/sanity that referenced this issue Dec 17, 2018
[util] Set testURL for Jest to avoid jestjs/jest#6769

[validation] Set testURL for Jest to avoid jestjs/jest#6769

[schema] Set testURL for Jest to avoid jestjs/jest#6769

[export] Set testURL for Jest to avoid jestjs/jest#6769
zenware added a commit to zenware/fl-maps that referenced this issue Dec 18, 2018
bjoerge pushed a commit to sanity-io/sanity that referenced this issue Dec 18, 2018
[util] Set testURL for Jest to avoid jestjs/jest#6769

[validation] Set testURL for Jest to avoid jestjs/jest#6769

[schema] Set testURL for Jest to avoid jestjs/jest#6769

[export] Set testURL for Jest to avoid jestjs/jest#6769
skogsmaskin added a commit to sanity-io/sanity that referenced this issue Dec 18, 2018
[util] Set testURL for Jest to avoid jestjs/jest#6769

[validation] Set testURL for Jest to avoid jestjs/jest#6769

[schema] Set testURL for Jest to avoid jestjs/jest#6769

[export] Set testURL for Jest to avoid jestjs/jest#6769
bjoerge pushed a commit to sanity-io/sanity that referenced this issue Dec 18, 2018
[util] Set testURL for Jest to avoid jestjs/jest#6769

[validation] Set testURL for Jest to avoid jestjs/jest#6769

[schema] Set testURL for Jest to avoid jestjs/jest#6769

[export] Set testURL for Jest to avoid jestjs/jest#6769
shaun554 added a commit to shaun554/vuepress that referenced this issue Mar 21, 2019
devs-cloud pushed a commit to devs-cloud/vue-dev that referenced this issue Dec 27, 2019
anandaroop added a commit to artsy/rosalind that referenced this issue Dec 31, 2019
yarn upgrade-interactive --latest (and accept all green updates)

This also necessitated a fix for a Jest/JSDom issue

jestjs/jest#6769
jsdom/jsdom#2304
anandaroop added a commit to artsy/rosalind that referenced this issue Dec 31, 2019
yarn upgrade-interactive --latest (and accept all green updates)

This also necessitated a fix for a Jest/JSDom issue

jestjs/jest#6769
jsdom/jsdom#2304
anandaroop added a commit to artsy/rosalind that referenced this issue Dec 31, 2019
yarn upgrade-interactive --latest (and accept all green updates)

This also necessitated a fix for a Jest/JSDom issue

jestjs/jest#6769
jsdom/jsdom#2304
Fusselwurm pushed a commit to Fusselwurm/arma-class-parser that referenced this issue Jan 26, 2020
@pavelsust
Copy link

related to jsdom/jsdom#2304

You can set the testURL of the jest configuration like this:

  "jest": {
    "verbose": true,
    "testURL": "http://localhost/"
  }

Ya it solve my issue

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants