jestを実行するとこんな感じのエラーが出る。
● 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)
jest.config.jsにtestURL(任意のurl)を追記すれば解決。
module.exports = {
testURL: 'http://localhost',
}
現状jestのデフォルトがabout:blank
だが、待ってればlocalhost
に変わりそうな雰囲気はある。
jest : SecurityError: localStorage is not available for opaque origins · Issue #2304 · jsdom/jsdom