TypeError: Cannot set property navigator of #<Object> which has only a getter
What causes it and how to fix it:
- global.navigator = dom.window.navigator is ignored on Node 21+ (or throws) — your jsdom test runs with Node's navigatorNode 21 added a global navigator that has a getter and no setter, so the classic hand-made jsdom setup line is silently ignored (strict mode throws a TypeError) and the test sees Node's userAgent (e.g. "Node.js/24") and no onLine; define the property with Object.defineProperty and assert it took effectCause and fix →