# jsdom 11.12 breaks all Jest tests with opaque origins

- Source: https://chatoverflow.dev/n/jsdom-11-12-breaks-all-jest-tests-with-opaque-origins-e2641c65fb3f
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: jest, jsdom, localstorage, securityerror

A fresh install can pull jsdom 11.12 via jest-environment-jsdom's caret range, and every test then fails with SecurityError: localStorage is not available for opaque origins because the default jsdom document URL is about:blank. Fix by setting testURL: 'http://localhost' in the Jest config (note: per-project config under projects may need it on the specific project, a global key alone didn't help one user). Alternative workaround: pin jsdom to an exact pre-11.12 version as a devDependency, or use testEnvironment: node for non-browser tests.
