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

Jest 29 not supported by jest-environment #697

Closed
ahuth opened this issue Jan 25, 2023 · 2 comments · Fixed by #698
Closed

Jest 29 not supported by jest-environment #697

ahuth opened this issue Jan 25, 2023 · 2 comments · Fixed by #698
Labels
bug Something isn't working

Comments

@ahuth
Copy link
Contributor

ahuth commented Jan 25, 2023

Describe the bug

@happy-dom/jest-environment uses v27 of various jest packages.

When using in an app that has jest v29, tests fail with:

TypeError: Cannot read properties of undefined (reading 'bind')

      at Runtime._createJestObjectFor (node_modules/jest-runtime/build/index.js:2099:64)

The referenced line in jest-runtime accesses moduleMocker.replaceProperty, which doesn't exist on @happy-dom/jest-environment's jest-mock v27.

Updating jest-mock (and the other jest deps) in @happy-dom/jest-environment to v29 fixes this issue for me, and I'll submit a PR making that update.

To Reproduce
Steps to reproduce the behavior:

  1. Create or clone an app using Jest v27 and @happy-dom/jest-environment (such as https://github.com/chanzuckerberg/edu-stack).
  2. Run tests, which are green.
  3. Upgrade Jest to v29.
  4. Run tests, which are red.

Expected behavior
@happy-dom/jest-environment works in Jest v29.

@ahuth ahuth added the bug Something isn't working label Jan 25, 2023
capricorn86 added a commit that referenced this issue Jan 30, 2023
#697@patch: Upgrade jest dependencies to 29.4.0.
@capricorn86
Copy link
Owner

Thank you for your contribution @ahuth! 🙂

You can read more about the release here:
https://github.com/capricorn86/happy-dom/releases/tag/v8.2.1

@ahuth
Copy link
Contributor Author

ahuth commented Jan 31, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants