9
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

jestで"SecurityError: localStorage is not available for opaque origins"と言われてテストがコケる

Last updated at Posted at 2018-08-03

追記

jest 23.5.0で修正されました

概要

jest をupgradeしたら

  ● 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>)

と言われてテストがコケるようになった。

対応

pakcage.jsonに以下の設定を追加するとよい

package.json
+  "jest": {
+    "testURL": "http://localhost/"
+  }

参考

9
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?