Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Jest 28.x.x doesn't work with node 19 #13603

Closed
madandrija opened this issue Nov 11, 2022 · 2 comments
Closed

[Bug]: Jest 28.x.x doesn't work with node 19 #13603

madandrija opened this issue Nov 11, 2022 · 2 comments

Comments

@madandrija
Copy link

Version

28.1.3

Steps to reproduce

Have node 19.x installed and run npx jest

Expected behavior

Tests run successfully

Actual behavior

For each test suite I get

 ● Test suite failed to run

    TypeError: Cannot assign to read only property 'performance' of object '[object global]'

      at Object.<anonymous> (node_modules/react-native/jest/setup.js:419:20)
      at asyncGeneratorStep (node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
      at _next (node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)

Additional context

The problem is in the following lines in jest/setup.js

global.performance = {
  now: jest.fn(Date.now),
};

If they are removed, Jest works as expected. Alternatively, downgrading to Node 18 resolves the issue as well.

Environment

System:
    OS: macOS 12.6
    CPU: (10) arm64 Apple M1 Pro
  Binaries:
    Node: 19.0.1 - /opt/homebrew/bin/node
    npm: 8.19.2 - /opt/homebrew/bin/npm
  npmPackages:
    jest: 28.1.3 => 28.1.3
@SimenB
Copy link
Member

SimenB commented Nov 11, 2022

This was fixed in https://github.com/facebook/jest/releases/tag/v29.2.1 - there are no plans to backport this to v28. You can probably install jest-environment-node@29 and use it. If not, you'll need to upgrade to Jest 29

@SimenB SimenB closed this as not planned Won't fix, can't repro, duplicate, stale Nov 11, 2022
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants