Skip to content

Misc: Update to Jest 30#72778

Open
hbhalodia wants to merge 2 commits intoWordPress:trunkfrom
hbhalodia:misc/issue-72593
Open

Misc: Update to Jest 30#72778
hbhalodia wants to merge 2 commits intoWordPress:trunkfrom
hbhalodia:misc/issue-72593

Conversation

@hbhalodia
Copy link
Contributor

@hbhalodia hbhalodia commented Oct 29, 2025

What?

Closes #72593

Why?

  • Updated Jest and related packages to latest version - Update to Jest 30 #72593
  • Note: Not updated eslint-plugin-jest to latest version as not support to node vesion being currently used v20.10

How?

  • Updated the package.json file to reference the latest versions.

Testing Instructions

  • Check if the Jest related tests does not conflict with newer versions.

Testing Instructions for Keyboard

  • NIL

Note: Not updated `eslint-plugin-jest` to latest version as not support to node vesion being currently used v20.10
@github-actions
Copy link

github-actions bot commented Oct 29, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: hbhalodia <hbhalodia@git.wordpress.org>
Co-authored-by: aduth <aduth@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@hbhalodia hbhalodia requested a review from mirka October 29, 2025 12:06
@hbhalodia hbhalodia added the [Type] Build Tooling Issues or PRs related to build tooling label Oct 29, 2025
@hbhalodia hbhalodia mentioned this pull request Oct 29, 2025
@aduth
Copy link
Member

aduth commented Oct 31, 2025

Thanks for working on this @hbhalodia 🙌

Based on the failing builds, I think the upgrade may be more involved than bumping the dependencies. Could you take a look at the failing build error messages to see what additional changes we might need for this?

@hbhalodia
Copy link
Contributor Author

Thanks for working on this @hbhalodia 🙌

Based on the failing builds, I think the upgrade may be more involved than bumping the dependencies. Could you take a look at the failing build error messages to see what additional changes we might need for this?

Sure @aduth, I would review and update the PR with the fix.

Thank You,

@hbhalodia
Copy link
Contributor Author

Hi @aduth, I did spend some time checking the issue and did found that it's related to @testing-library/jsdom, Ref - testing-library/jest-dom#559, I did try fixing, but not able to get to the mark.

What I updated is,

  1. On this base confing - Added the type as ./node_modules/@testing-library and then updated all tsconfig to use jest-dom instead of @testing-library/jest-dom as in here.
  2. Updated all tsconfing which requires jest-dom with the same.
  3. Since, package does not contains, @types/jest, added the dev-dependency for the same.
  4. It fix the current error, but throws some extra error which are not related, so unable to fix the same..

Let me know if I am going correct, or something needs to be added which I am missing.

Thank You,

@aduth
Copy link
Member

aduth commented Nov 11, 2025

Hey @hbhalodia, apologies for the slow follow-up here. I'm not too familiar with what we'll need for this upgrade, but a few ideas at a glance based on what you shared:

  • Reviewing the usage instructions for @testing-library/jest-dom, I'm wondering if we could rely on the import that happens through test configuration and not have to specify types (see script and import). I see that they also reference types in their usage instructions as possibly being necessary, which is confusing if it produces these errors, but curious if we could try removing it and see what happens.
  • I don't think we should have to use @types/jest since Jest provides their own first-party types as part of the package

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Build Tooling Issues or PRs related to build tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update to Jest 30

2 participants