-
Notifications
You must be signed in to change notification settings - Fork 58
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
Update to Jest 29 #5544
Update to Jest 29 #5544
Conversation
Wanna run full suite of Android and iOS UI tests? Click here and 'Approve' CI job! |
@@ -34,7 +34,9 @@ module.exports = { | |||
'<rootDir>/jetpack/', | |||
'/__device-tests__/', | |||
], | |||
testURL: 'http://localhost/', | |||
testEnvironmentOptions: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testURL
is deprecated so we needed to update it to the new format.
jest_setup.js
Outdated
__esModule: true, | ||
} ) ); | ||
|
||
jest.mock( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the Jest 29 update, there is an issue where it can't find the native export of this file so I added a mock.
FYI there are a few CI failures for this PR due to other reasons like |
"jest-image-snapshot": "^6.1.0", | ||
"jest-jasmine2": "29.5.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jest-jasmine2
is no longer included with Jest and it has to be installed separately.
jest.config.js
Outdated
@@ -25,7 +25,7 @@ module.exports = { | |||
// Automatically clear mock calls and instances between every test | |||
clearMocks: true, | |||
preset: './gutenberg/node_modules/react-native/jest-preset.js', | |||
setupFiles: [ '<rootDir>/' + configPath + '/setup.js' ], | |||
setupFiles: [ '<rootDir>/' + configPath + '/setup.js', './jest_setup.js' ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: I'm wondering if we could use a similar name format for jest_setup.js
as this file, i.e. jest.setup.js
, WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure! I'll update it 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎊 ! Thanks @geriux for fixing this 🙇 !
I tested locally by running npm ci && npm run test
and all tests passed ✅ .
This PR updates the Jest version to
29
to match Gutenberg's current version introduced in this PR.To test CI checks should pass.
PR submission checklist: