Skip to content

Comments

Update indirect jest deps to v30 too#43887

Merged
anomiex merged 8 commits intotrunkfrom
try/update-indirect-jest-to-v30-too
Jun 17, 2025
Merged

Update indirect jest deps to v30 too#43887
anomiex merged 8 commits intotrunkfrom
try/update-indirect-jest-to-v30-too

Conversation

@anomiex
Copy link
Contributor

@anomiex anomiex commented Jun 10, 2025

Proposed changes:

@storybook/test-runner still uses Jest v29, but seems to work (at least for our purposes) when pnpmfile-hacked to v30. Doing that cleans up some deprecated dependencies of Jest v29, and makes for less that devs will have to download on a pnpm install.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

None

Does this pull request change what data or activity we track or use?

No

Testing instructions:

  • CI happy?
  • Super-cache E2Es still work?

anomiex added 2 commits June 10, 2025 14:44
Additional changes included here:
* `babel-plugin-tester` v12.0.0-canary.2 is needed for compatability
  with jest v30.
* `packages/forms` was using `--testPathPattern`, which got renamed to
  `--testPathPatterns`.
* The default resolver no longer accepts a `Set` for `conditions`, it
  needs to be an array now.
* `jsdom` 26 is brought in by `jest-environment-jsdom`, which needs a
  bunch of fixes:
  * It makes it basically impossible to spy/mock `window.location`
    methods directly. Use shims that can be mocked instead.
  * It breaks a few tests that were trying to mock `window`. For these,
    we can just assign the properties we need or do more targeted
    mocking.
  * It changes `getComputedStyle()` to return like `rgb(255, 255, 255)`
    rather than `white`.
  * It seems to need an "End" key press in a `user.type()` in one
    place. 🤷
* May as well update our one direct `jsdom` dep to match.
* pnpmfile hack for `babel-plugin-istanbul`→`test-exclude` to avoid some
  deprecated indirect dependencies.

Unfortunately we still have jest 29 in two places:
`@storybook/test-runner` (in js-packages/storybook) and `ts-jest` (in
plugins/super-cache) haven't been updated yet.
`ts-jest` and `@storybook/test-runner` still use Jest v29, but seem to
work (at least for our purposes) when pnpmfile-hacked to v30. Doing that
cleans up some deprecated dependencies of Jest v29, and makes for less
that devs will have to download on a `pnpm install`.
@github-actions
Copy link
Contributor

github-actions bot commented Jun 10, 2025

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack or WordPress.com Site Helper), and enable the try/update-indirect-jest-to-v30-too branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack try/update-indirect-jest-to-v30-too
bin/jetpack-downloader test jetpack-mu-wpcom-plugin try/update-indirect-jest-to-v30-too

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions
Copy link
Contributor

github-actions bot commented Jun 10, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: July 1, 2025
    • Code freeze: June 30, 2025

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Boost plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Starter Plugin plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Super Cache plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Wpcomsh plugin:

  • Next scheduled release: Atomic deploys happen twice daily on weekdays (p9o2xV-2EN-p2)

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Automattic For agencies client plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.


Classic Theme helper plugin plugin:

No scheduled milestone found for this plugin.

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@jp-launch-control
Copy link

jp-launch-control bot commented Jun 10, 2025

Code Coverage Summary

This PR did not change code coverage!

That could be good or bad, depending on the situation. Everything covered before, and still is? Great! Nothing was covered before? Not so great. 🤷

Full summary · PHP report · JS report

@anomiex anomiex marked this pull request as ready for review June 10, 2025 19:29
@anomiex anomiex added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Jun 10, 2025
Copy link
Contributor

@tbradsha tbradsha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is happy. Noting that I got this when running pnpm; perhaps we need to bump $NODE_VERSION in .github/versions.sh to at 22.12?

Your Node version is incompatible with "babel-plugin-tester@12.0.0-canary.2(@babel/core@7.27.4)(jest@30.0.0)".

Expected version: ^20.18.0 || ^22.12.0 || >=23.3.0
Got: v22.11.0

Once I upgraded Node, I'm back to this when running super-cache tests, presumably because the super-cache e2e fix is not in this branch:

 ✔ Network super-cache-e2e_default        Created                          0.1s 
 ✘ Container super-cache-e2e-db-1         Error                          102.3s 
 ✔ Container super-cache-e2e-wordpress-1  Created                          0.1s 
dependency failed to start: container super-cache-e2e-db-1 is unhealthy
 ELIFECYCLE  Command failed with exit code 1.

makes for less that devs will have to download

🥳

@anomiex
Copy link
Contributor Author

anomiex commented Jun 10, 2025

Noting that I got this when running pnpm; perhaps we need to bump $NODE_VERSION in .github/versions.sh to at 22.12?

Ugh. Yeah, we'll need to do that before doing these.

Once I upgraded Node, I'm back to this when running super-cache tests, presumably because the super-cache e2e fix is not in this branch

Oops, yeah.

@anomiex anomiex mentioned this pull request Jun 11, 2025
3 tasks
@tbradsha
Copy link
Contributor

I'm still getting failures on pnpm test:run for Super Cache:

Details
 FAIL  specs/settings/not-logged-in.test.ts
  ● Test suite failed to run
lib/plugin-settings.ts:68:40 - error TS2550: Property 'entries' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2017' or later.

68  for ( const [ name, value ] of Object.entries( settings ) ) {
                                          ~~~~~~~

FAIL specs/settings/no-cache-for-get.test.ts
● Test suite failed to run

lib/plugin-settings.ts:68:40 - error TS2550: Property 'entries' does not exist on type 'ObjectConstructor'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2017' or later.

68  for ( const [ name, value ] of Object.entries( settings ) ) {
                                          ~~~~~~~

FAIL specs/default-settings.test.ts
● Test suite failed to run

lib/docker-tools.ts:90:71 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.

90 export async function readContainerFile( filename: string ): Promise< Buffer > {
                                                                         ~~~~~~
lib/docker-tools.ts:93:9 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.

93  return Buffer.from( encoded, 'base64' );
           ~~~~~~
lib/docker-tools.ts:104:12 - error TS2304: Cannot find name 'BufferEncoding'.

104  encoding: BufferEncoding = 'utf8'
               ~~~~~~~~~~~~~~
lib/docker-tools.ts:115:67 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.

115 export async function writeContainerFile( filename: string, data: Buffer | string ) {
                                                                      ~~~~~~
lib/docker-tools.ts:116:33 - error TS2552: Cannot find name 'Buffer'. Did you mean 'buffer'?

116  const buffer = data instanceof Buffer ? data : Buffer.from( data );
                                    ~~~~~~

  lib/docker-tools.ts:116:8
    116  const buffer = data instanceof Buffer ? data : Buffer.from( data );
               ~~~~~~
    'buffer' is declared here.
lib/docker-tools.ts:116:49 - error TS2552: Cannot find name 'Buffer'. Did you mean 'buffer'?

116  const buffer = data instanceof Buffer ? data : Buffer.from( data );
                                                    ~~~~~~

  lib/docker-tools.ts:116:8
    116  const buffer = data instanceof Buffer ? data : Buffer.from( data );
               ~~~~~~
    'buffer' is declared here.

FAIL specs/settings/mod-rewrite.test.ts
● Test suite failed to run

lib/docker-tools.ts:90:71 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.

90 export async function readContainerFile( filename: string ): Promise< Buffer > {
                                                                         ~~~~~~
lib/docker-tools.ts:93:9 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.

93  return Buffer.from( encoded, 'base64' );
           ~~~~~~
lib/docker-tools.ts:104:12 - error TS2304: Cannot find name 'BufferEncoding'.

104  encoding: BufferEncoding = 'utf8'
               ~~~~~~~~~~~~~~
lib/docker-tools.ts:115:67 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.

115 export async function writeContainerFile( filename: string, data: Buffer | string ) {
                                                                      ~~~~~~
lib/docker-tools.ts:116:33 - error TS2552: Cannot find name 'Buffer'. Did you mean 'buffer'?

116  const buffer = data instanceof Buffer ? data : Buffer.from( data );
                                    ~~~~~~

  lib/docker-tools.ts:116:8
    116  const buffer = data instanceof Buffer ? data : Buffer.from( data );
               ~~~~~~
    'buffer' is declared here.
lib/docker-tools.ts:116:49 - error TS2552: Cannot find name 'Buffer'. Did you mean 'buffer'?

116  const buffer = data instanceof Buffer ? data : Buffer.from( data );
                                                    ~~~~~~

  lib/docker-tools.ts:116:8
    116  const buffer = data instanceof Buffer ? data : Buffer.from( data );
               ~~~~~~
    'buffer' is declared here.

FAIL specs/settings/cache-compression.test.ts
● Test suite failed to run

specs/settings/cache-compression.test.ts:1:18 - error TS2307: Cannot find module 'util' or its corresponding type declarations.

1 import util from 'util';
                   ~~~~~~
specs/settings/cache-compression.test.ts:2:18 - error TS2307: Cannot find module 'zlib' or its corresponding type declarations.

2 import zlib from 'zlib';
                   ~~~~~~

FAIL specs/activation.test.ts
● Test suite failed to run

lib/docker-tools.ts:90:71 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.

90 export async function readContainerFile( filename: string ): Promise< Buffer > {
                                                                         ~~~~~~
lib/docker-tools.ts:93:9 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.

93  return Buffer.from( encoded, 'base64' );
           ~~~~~~
lib/docker-tools.ts:104:12 - error TS2304: Cannot find name 'BufferEncoding'.

104  encoding: BufferEncoding = 'utf8'
               ~~~~~~~~~~~~~~
lib/docker-tools.ts:115:67 - error TS2580: Cannot find name 'Buffer'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node`.

115 export async function writeContainerFile( filename: string, data: Buffer | string ) {
                                                                      ~~~~~~
lib/docker-tools.ts:116:33 - error TS2552: Cannot find name 'Buffer'. Did you mean 'buffer'?

116  const buffer = data instanceof Buffer ? data : Buffer.from( data );
                                    ~~~~~~

  lib/docker-tools.ts:116:8
    116  const buffer = data instanceof Buffer ? data : Buffer.from( data );
               ~~~~~~
    'buffer' is declared here.
lib/docker-tools.ts:116:49 - error TS2552: Cannot find name 'Buffer'. Did you mean 'buffer'?

116  const buffer = data instanceof Buffer ? data : Buffer.from( data );
                                                    ~~~~~~

  lib/docker-tools.ts:116:8
    116  const buffer = data instanceof Buffer ? data : Buffer.from( data );
               ~~~~~~
    'buffer' is declared here.

Test Suites: 6 failed, 6 total
Tests: 0 total
Snapshots: 0 total
Time: 0.759 s, estimated 13 s
Ran all test suites.
 ELIFECYCLE  Command failed with exit code 1.

@anomiex
Copy link
Contributor Author

anomiex commented Jun 16, 2025

ts-jest got an update now, so I moved that part of this PR into #43808.

tbradsha
tbradsha previously approved these changes Jun 16, 2025
Base automatically changed from try/update-jest-30 to trunk June 16, 2025 20:50
@anomiex anomiex dismissed tbradsha’s stale review June 16, 2025 20:50

The base branch was changed.

@anomiex anomiex merged commit f56443c into trunk Jun 17, 2025
94 of 95 checks passed
@anomiex anomiex deleted the try/update-indirect-jest-to-v30-too branch June 17, 2025 13:24
@github-actions github-actions bot removed the [Status] Needs Review This PR is ready for review. label Jun 17, 2025
mikestottuk pushed a commit that referenced this pull request Jun 26, 2025
`@storybook/test-runner` still uses Jest v29, but seems to work (at
least for our purposes) when pnpmfile-hacked to v30. Doing that cleans
up some deprecated dependencies of Jest v29, and makes for less that
devs will have to download on a `pnpm install`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants