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

chore: upgrade jest (and related packages) to v29 #78786

Merged
merged 15 commits into from
Jul 11, 2023
Merged

Conversation

flootr
Copy link
Contributor

@flootr flootr commented Jun 29, 2023

Related to #78711

Proposed Changes

PR upgrades Jest (and related packages where necessary) to v29. We're currently on v27 which means we're jumping two major versions.

Testing Instructions

Verify all tests are green

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-ajp-p2)?

@github-actions
Copy link

github-actions bot commented Jun 29, 2023

@matticbot
Copy link
Contributor

This PR modifies the release build for editing-toolkit

To test your changes on WordPress.com, run install-plugin.sh editing-toolkit chore/update/jest-v29 on your sandbox.

To deploy your changes after merging, see the documentation: PCYsg-mMA-p2

@matticbot
Copy link
Contributor

matticbot commented Jun 29, 2023

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~113 bytes added 📈 [gzipped])

name                   parsed_size           gzip_size
entry-domains-landing       +151 B  (+0.0%)     +124 B  (+0.1%)
entry-subscriptions          +51 B  (+0.0%)     +113 B  (+0.0%)
entry-stepper                +51 B  (+0.0%)     +113 B  (+0.0%)
entry-main                   +51 B  (+0.0%)     +113 B  (+0.0%)
entry-login                  +51 B  (+0.0%)     +113 B  (+0.0%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@flootr flootr force-pushed the chore/update/jest-v29 branch 2 times, most recently from 77c2f42 to f6fcc0f Compare July 4, 2023 08:09
@matticbot
Copy link
Contributor

This PR modifies the release build for notifications

To test your changes on WordPress.com, run install-plugin.sh notifications chore/update/jest-v29 on your sandbox.

To deploy your changes after merging, see the documentation: PCYsg-elI-p2

@matticbot
Copy link
Contributor

This PR modifies the release build for wpcom-block-editor

To test your changes on WordPress.com, run install-plugin.sh wpcom-block-editor chore/update/jest-v29 on your sandbox.

To deploy your changes after merging, see the documentation: PCYsg-l4k-p2

@noahtallen
Copy link
Contributor

Migrated ETK and Odyssey stats to the shared testing config here: #79097

@tyxla
Copy link
Member

tyxla commented Jul 7, 2023

Migrated ETK and Odyssey stats to the shared testing config here: #79097

Looks great and works well in my testing. Looking forward to it unblocking this one 🚀

@noahtallen noahtallen force-pushed the chore/update/jest-v29 branch from 384f193 to 519c25d Compare July 8, 2023 00:18
@noahtallen
Copy link
Contributor

noahtallen commented Jul 8, 2023

Hey @flootr, I rebased this after merging #79097. I ran into some weird conflicts, so I ultimately removed a couple commits and did another dedupe after running yarn up jest babel-jest 'jest-*' again.

While I was rebasing, I also forgot for a moment that I was rebasing and ended up finding a simpler fix for the e2e config type issue 😅

I also don't think we need @types/jest anymore -- npm reports that jest bundles it's own types now (https://www.npmjs.com/package/jest), so I removed it. I also removed jest itself from devDependencies in a handful of Calypso apps which don't use it

@tyxla
Copy link
Member

tyxla commented Jul 10, 2023

Hey @flootr, I rebased this after merging #79097. I ran into some weird conflicts, so I ultimately removed a couple commits and did another dedupe after running yarn up jest babel-jest 'jest-*' again.

While I was rebasing, I also forgot for a moment that I was rebasing and ended up finding a simpler fix for the e2e config type issue 😅

I also don't think we need @types/jest anymore -- npm reports that jest bundles it's own types now (https://www.npmjs.com/package/jest), so I removed it. I also removed jest itself from devDependencies in a handful of Calypso apps which don't use it

Neat! Aside from this needing a rebase, I guess it should also wait for #79176 to land since #79097 got reverted.

For the protocol, #79176 is approved and can be merged already.

@noahtallen noahtallen force-pushed the chore/update/jest-v29 branch from 27d32c5 to a6c43ca Compare July 10, 2023 20:03
@noahtallen noahtallen marked this pull request as ready for review July 10, 2023 20:03
@noahtallen noahtallen requested review from a team and worldomonation as code owners July 10, 2023 20:03
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jul 10, 2023
@noahtallen
Copy link
Contributor

Aside from this needing a rebase

done and marked as ready for final review! 🎉

Copy link
Contributor

@noahtallen noahtallen left a comment

Choose a reason for hiding this comment

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

Looks good to me!

I noticed this line of code last week; we might be able to remove it:

// TODO: structuredClone wasn't available in Jest before verson 28 so this creates
// a version to be used for the tests. Once Jest is upgraded to 28 this should
// be removed.
global.structuredClone = jest.fn( ( value ) => {
return JSON.parse( JSON.stringify( value ) );
} );

@@ -54,10 +54,6 @@ describe( '#announceSuccess()', () => {
},
} ) );
} );
afterAll( () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still need to restore the previous FormData implementation?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think we need it; just removed it.

@tyxla
Copy link
Member

tyxla commented Jul 11, 2023

I noticed this line of code last week; we might be able to remove it:

Good spot, removed.

Copy link
Member

@tyxla tyxla left a comment

Choose a reason for hiding this comment

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

Works well for me and the codechanges make sense! Nice work y'all!

LGTM 🚢

@tyxla
Copy link
Member

tyxla commented Jul 11, 2023

I'll proceed to ship this one.

@tyxla tyxla merged commit 4fa6fa7 into trunk Jul 11, 2023
@tyxla tyxla deleted the chore/update/jest-v29 branch July 11, 2023 09:05
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jul 11, 2023
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.

4 participants