こんなエラーが出た
> jest FAIL test\fileA.test.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>)
突然出たエラー。これまでと特に設定は変えてない。なぜ?(。´・ω・)
見つけたページ
https://qiita.com/supaiku2452/items/972eb7e03414c695d033
でも` jest.config.js `というファイルはない。どこに書けば良いかちょっと迷った。
最終的な解決方法
https://github.com/facebook/jest/issues/6769
https://doc.ebichu.cc/jest/docs/ja/configuration.html
package.jsonに書けばいいらしい。
既に存在するルートディレクトリのpackage.jsonに "jest" を追加する。
{ "name": "my_application_name", "version": "1.0.0", "description": "my application description", "jest": { "verbose": true, "testURL": "http://localhost/" }, "main": "index.js", ...
適当なところに追記しました。
これでJestを再実行するとテストが通った。
解決!