Fabric: Enable react-test-renderer tests in the new cpp-app template #12376
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The upstream RN app template includes a jest test suite (run with
yarn test
) with a default test to render your app JS using thereact-test-renderer
. However, this only tests the iOS version of your app (it forces platform === 'ios') and therefore won't catch if there are issues in yourwindows
platform files.Using
@rnx-kit/jest-preset
, you can run jest tests against any platform via a custom jest config.This PR adds
@rnx-kit/jest-preset
as a dependency to the newcpp-app
template, as well as ajest.config.windows.js
to use it. Furthermore it adds a script so users can run these tests for windows viayarn test:windows
.Finally this PR adds running
yarn test:windows
to the PR checks for testing the new app CLI.Closes #11939
Type of Change
Why
To expand test coverage options for app developers.
Closes #11939
What
See above.
Screenshots
Testing
Ran the tests in the provided RN template.
Changelog
Should this change be included in the release notes: yes
The new Fabric app template supports
yarn test:windows
to run jest app rendering tests with react-test-rendererMicrosoft Reviewers: Open in CodeFlow