Closed
Description
openedon Oct 18, 2022
Version
29.2.0
Steps to reproduce
- Clone https://github.com/chbiel/jest-global-bug
- cd jest-global-bug
npm
cp package-npm.json package.json && npm install && npm test
=> worksrm package.json && rm package-lock.json && rm -rf node_modules && cp package-npm-broken.json package.json && npm install && npm test
=> does not work
yarn
cp package-yarn.json package.json && npm install && npm test
=> works (i was not able to pin jest to29.1
with yarn. always results in a broken dependency tree somehow. So I used the also working version28
)rm package.json && rm yarn.lock && rm -rf node_modules && cp package-yarn-broken.json package.json && npm install && npm test
=> does not work
Expected behavior
jest.spyOn(global.window, 'dispatchEvent');
does not throw an error dispatchEvent property does not exist
.
Same with window.window
and similar.
Actual behavior
jest.spyOn(global.window, 'dispatchEvent');
does throw an error dispatchEvent property does not exist
after upgrading (I think) jest-mock
to version 29.2.0
.
I am not 100% sure but I think it's related to this change: #13398
Additional context
No response
Environment
System:
OS: Linux 5.4 Ubuntu 20.04.5 LTS (Focal Fossa)
CPU: (6) x64 Intel(R) Core(TM) i7-8650U CPU @ 1.90GHz
Binaries:
Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node
Yarn: 1.17.3 - /usr/bin/yarn
npm: 8.3.0 - ~/.nvm/versions/node/v16.13.1/bin/npm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment