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

Update to Jest 29 #34724

Closed
wants to merge 1 commit into from
Closed

Update to Jest 29 #34724

wants to merge 1 commit into from

Conversation

robhogan
Copy link
Contributor

Summary:
Following on from the recent upgrade from Jest 26->27, this brings us up to present day Jest 29 for tests of React Native itself, Metro, and Meta-internal code. An update to the template for RN apps will follow.

Changelog:
[Internal][Fixed] Update to Jest 29

Reviewed By: huntie

Differential Revision: D39543504

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner fb-exported labels Sep 19, 2022
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D39543504

@github-actions
Copy link

github-actions bot commented Sep 19, 2022

Warnings
⚠️ 🔒 package.json - Changes were made to package.json. This will require a manual import by a Facebook employee.

Generated by 🚫 dangerJS against feb35ab

@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 7,694,713 +36
android hermes armeabi-v7a 7,098,120 +38
android hermes x86 7,997,323 +51
android hermes x86_64 7,969,796 +54
android jsc arm64-v8a 9,565,094 +36
android jsc armeabi-v7a 8,332,078 +46
android jsc x86 9,505,525 +52
android jsc x86_64 10,097,156 +72

Base commit: ab5f26b
Branch: main

@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: ab5f26b
Branch: main

@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D39543504

robhogan added a commit to robhogan/react-native that referenced this pull request Sep 20, 2022
Summary:
Pull Request resolved: facebook#34724

Following on from the recent upgrade from Jest 26->27, this brings us up to present day Jest 29 for tests of React Native itself, Metro, and Meta-internal code. An update to the template for RN apps will follow.

Changelog:
[Internal][Fixed] Update to Jest 29

Reviewed By: huntie

Differential Revision: D39543504

fbshipit-source-id: 8edfb1de630eb4eb340d4a188b0804bb50b5d21e
@robhogan
Copy link
Contributor Author

robhogan commented Sep 20, 2022

@cortinico / @cipolleschi - any idea why the Jest tests would be failing on the test_codegen job only?

There are snapshot format changes between Jest 27 and 29, which we opt out of via jest.config.js changes (snapshotFormat). From the failures it's as if the test_codegen tests are using Jest 29 but without the updated config. I can't see anything in the job spec suggesting it uses a different Jest config though.

Update: I also can't reproduce by re-running with SSH, yarn jest is green there.

(Ah! test_codegen runs under a different working directory so isn't picking up the root config. Thanks Nico for the tip)

@cortinico
Copy link
Contributor

@cortinico / @cipolleschi - any idea why the Jest tests would be failing on the test_codegen job only?

Answered offline: test_js and test_codegen are using two different Jest configs. I recall discussing with @cipolleschi about it. Ideally we should unify them under test_js and use a single config.

facebook-github-bot pushed a commit that referenced this pull request Sep 20, 2022
Summary:
The CircleCI `test_codegen` job currently runs tests under `packages/react-native-codegen`. Because it runs from that working directory, it doesn't pick up the project root's `jest.config.js`, which is a problem for #34724 (snapshot format configuration in `jest.config.js`)

`react-native-codegen` tests are *already run* by the `test_js` job, as can be seen from the CircleCI logs
https://app.circleci.com/pipelines/github/facebook/react-native/15818/workflows/41034d00-7061-46e8-a03d-abdcc7fd7e2f/jobs/295804/parallel-runs/0/steps/0-107 , so the job isn't necessary, and this PR removes it. CC cipolleschi

## Changelog

[Internal] [Fixed] - Remove redundant `test_codegen` job from CircleCI.

Pull Request resolved: #34733

Test Plan: CircleCI!

Reviewed By: lunaleaps

Differential Revision: D39660829

Pulled By: robhogan

fbshipit-source-id: d7b09cc90a30e7604e2645e2bd0c16f840443153
Summary:
Pull Request resolved: facebook#34724

Following on from the recent upgrade from Jest 26->27, this brings us up to present day Jest 29 for tests of React Native itself, Metro, and Meta-internal code. An update to the template for RN apps will follow.

Changelog:
[Internal][Fixed] Update to Jest 29

Reviewed By: huntie

Differential Revision: D39543504

fbshipit-source-id: e00e7c2173a0e9af632874e4034ab781f289521d
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D39543504

facebook-github-bot pushed a commit to facebook/metro that referenced this pull request Sep 20, 2022
Summary:
X-link: facebook/react-native#34724

Following on from the recent upgrade from Jest 26->27, this brings us up to present day Jest 29 for tests of React Native itself, Metro, and Meta-internal code. An update to the template for RN apps will follow.

Changelog:
[Internal][Fixed] Update to Jest 29

Reviewed By: huntie

Differential Revision: D39543504

fbshipit-source-id: b47fdb678212b475881ec19085f6cd45a4530333
@react-native-bot
Copy link
Collaborator

This pull request was successfully merged by @robhogan in c27501b.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label Sep 20, 2022
facebook-github-bot pushed a commit that referenced this pull request Oct 17, 2022
…34971)

Summary:
This PR is the follow up to the conversation started here by SimenB: react-native-community/discussions-and-proposals#509

Basically, we want to move RN to use its own custom environment so that we can tweak it going forward - this PR in fact only sets up the groundwork for that; robhogan mentioned that with this in place, Meta engineers can
> iterate on it (with jest-environment-node as a starting point) against our internal product tests

This is also connected to Rob's work to bring Jest 29 into the codebase #34724 and my "mirror" PR to bring template in main up to the same version (#34972)

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[General] [Changed] - move Jest config to use a custom react-native Jest env

Pull Request resolved: #34971

Test Plan: Tested that `yarn test` in main works fine after the changes; CI and Meta's internal CI will also serve the purpose of verifying that it works (but there's no reason not to since it's still pretty much just relying on `node`).

Reviewed By: huntie

Differential Revision: D40379760

Pulled By: robhogan

fbshipit-source-id: 2c6d0bc86d337fda9befce0799bda2f56cc4466c
facebook-github-bot pushed a commit that referenced this pull request Oct 18, 2022
Summary:
This PR is the follow up of #34724 for the template; this way, we'll have version alignment and RN71 will use this.

This wants to be merged along #34971

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[General] [Changed] - upgrade Jest in template to 29

Pull Request resolved: #34972

Test Plan: Generated a test project via `yarn test-e2e-local -t RNTestProject` and then run `yarn test` in that project to verify that there's no regression. ✅

Reviewed By: huntie

Differential Revision: D40379963

Pulled By: robhogan

fbshipit-source-id: 618207ed6bf7921d13f0b6a9220dc52c9cf78b14
@SimenB SimenB mentioned this pull request Oct 19, 2022
1 task
facebook-github-bot pushed a commit to facebook/metro that referenced this pull request Oct 19, 2022
Summary:
X-link: facebook/react-native#35014

Pull Request resolved: #881

Following on from facebook/react-native#34724 and facebook/react-native#34972, this updates Jest to the latest version 29.2.1 across projects and in the OSS React Native new app template.

Importantly this version includes the [new `jest.now()` API](jestjs/jest#13245), which will be useful for exposing internally consistent fake timer mocks of `requestAnimationFrame`, etc., in the new React Native Jest environment.

Changelog:
[General] [Changed] - Upgrade Jest in React Native template to ^29.2.1

Reviewed By: jacdebug

Differential Revision: D40386349

fbshipit-source-id: 43f5a69cf546df09e2f02542ebf50130d65f0436
facebook-github-bot pushed a commit that referenced this pull request Oct 19, 2022
Summary:
Pull Request resolved: #35014

X-link: facebook/metro#881

Following on from #34724 and #34972, this updates Jest to the latest version 29.2.1 across projects and in the OSS React Native new app template.

Importantly this version includes the [new `jest.now()` API](jestjs/jest#13245), which will be useful for exposing internally consistent fake timer mocks of `requestAnimationFrame`, etc., in the new React Native Jest environment.

Changelog:
[General] [Changed] - Upgrade Jest in React Native template to ^29.2.1

Reviewed By: jacdebug

Differential Revision: D40386349

fbshipit-source-id: 43f5a69cf546df09e2f02542ebf50130d65f0436
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
Summary:
The CircleCI `test_codegen` job currently runs tests under `packages/react-native-codegen`. Because it runs from that working directory, it doesn't pick up the project root's `jest.config.js`, which is a problem for facebook#34724 (snapshot format configuration in `jest.config.js`)

`react-native-codegen` tests are *already run* by the `test_js` job, as can be seen from the CircleCI logs
https://app.circleci.com/pipelines/github/facebook/react-native/15818/workflows/41034d00-7061-46e8-a03d-abdcc7fd7e2f/jobs/295804/parallel-runs/0/steps/0-107 , so the job isn't necessary, and this PR removes it. CC cipolleschi

## Changelog

[Internal] [Fixed] - Remove redundant `test_codegen` job from CircleCI.

Pull Request resolved: facebook#34733

Test Plan: CircleCI!

Reviewed By: lunaleaps

Differential Revision: D39660829

Pulled By: robhogan

fbshipit-source-id: d7b09cc90a30e7604e2645e2bd0c16f840443153
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
Summary:
Pull Request resolved: facebook#34724

Following on from the recent upgrade from Jest 26->27, this brings us up to present day Jest 29 for tests of React Native itself, Metro, and Meta-internal code. An update to the template for RN apps will follow.

Changelog:
[Internal][Fixed] Update to Jest 29

Reviewed By: huntie

Differential Revision: D39543504

fbshipit-source-id: b47fdb678212b475881ec19085f6cd45a4530333
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
…acebook#34971)

Summary:
This PR is the follow up to the conversation started here by SimenB: react-native-community/discussions-and-proposals#509

Basically, we want to move RN to use its own custom environment so that we can tweak it going forward - this PR in fact only sets up the groundwork for that; robhogan mentioned that with this in place, Meta engineers can
> iterate on it (with jest-environment-node as a starting point) against our internal product tests

This is also connected to Rob's work to bring Jest 29 into the codebase facebook#34724 and my "mirror" PR to bring template in main up to the same version (facebook#34972)

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[General] [Changed] - move Jest config to use a custom react-native Jest env

Pull Request resolved: facebook#34971

Test Plan: Tested that `yarn test` in main works fine after the changes; CI and Meta's internal CI will also serve the purpose of verifying that it works (but there's no reason not to since it's still pretty much just relying on `node`).

Reviewed By: huntie

Differential Revision: D40379760

Pulled By: robhogan

fbshipit-source-id: 2c6d0bc86d337fda9befce0799bda2f56cc4466c
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
Summary:
This PR is the follow up of facebook#34724 for the template; this way, we'll have version alignment and RN71 will use this.

This wants to be merged along facebook#34971

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[General] [Changed] - upgrade Jest in template to 29

Pull Request resolved: facebook#34972

Test Plan: Generated a test project via `yarn test-e2e-local -t RNTestProject` and then run `yarn test` in that project to verify that there's no regression. ✅

Reviewed By: huntie

Differential Revision: D40379963

Pulled By: robhogan

fbshipit-source-id: 618207ed6bf7921d13f0b6a9220dc52c9cf78b14
OlimpiaZurek pushed a commit to OlimpiaZurek/react-native that referenced this pull request May 22, 2023
Summary:
Pull Request resolved: facebook#35014

X-link: facebook/metro#881

Following on from facebook#34724 and facebook#34972, this updates Jest to the latest version 29.2.1 across projects and in the OSS React Native new app template.

Importantly this version includes the [new `jest.now()` API](jestjs/jest#13245), which will be useful for exposing internally consistent fake timer mocks of `requestAnimationFrame`, etc., in the new React Native Jest environment.

Changelog:
[General] [Changed] - Upgrade Jest in React Native template to ^29.2.1

Reviewed By: jacdebug

Differential Revision: D40386349

fbshipit-source-id: 43f5a69cf546df09e2f02542ebf50130d65f0436
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants