Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Bug]: @jest/environment-jsdom-abstract ignores custom JSDOM instance #19

@ahnpnl

Description

@ahnpnl

Version

30.2.0

Steps to reproduce

git clone https://github.com/htho/jest-repro-extended-jsdom.git
cd jest-repro-extended-jsdom
npm ci
npm run test <- fails
node ./without-jest.js <- ok

Expected behavior

The test should not fail.
I expect the test to use the Proxies I implemented in JSDOMWithDummyLocation.

Actual behavior

The test fails.
JSDOM logs: Error: Not implemented: navigation to another Document
This means my Proxies are not used.

Additional context

If I run node ./without-jest.js an instance of JSDOMWithDummyLocation is created and document.location.search is set - no error is logged and I can access the value later.

I also asked about this on StackOverflow

Environment

System:
    OS: Windows 11 10.0.22631
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
  Binaries:
    Node: 22.19.0 - C:\Program Files\nodejs\node.EXE
    npm: 11.2.0 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.15.3 - C:\Users\XXX\AppData\Roaming\npm\pnpm.CMD
  npmPackages:
    jest: ^30.2.0 => 30.2.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions