-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b14d080
commit 543ba1c
Showing
4 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"label": "Testing with Jest", | ||
"position": 6 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
title: Jest | ||
sidebar_position: 3 | ||
slug: /jest | ||
--- | ||
|
||
# Testing with Jest | ||
|
||
`react-native-esbuild/jest` is a [Jest](https://jestjs.io) transformer. | ||
|
||
It can replace [babel-jest](https://github.com/facebook/react-native/blob/v0.72.6/packages/react-native/jest-preset.js#L18) and supports the React Native testing environment. | ||
|
||
## Setup | ||
|
||
Open your `jest.config.js` and set `@react-native-esbuild/jest` as transformer. | ||
|
||
|
||
Some internal of React Native or Libraries are not transformed. | ||
|
||
```js | ||
// Many react-native npm modules unfortunately don't pre-compile their source code before publishing. | ||
// If you have npm dependencies that have to be transformed you can add the package name to list. | ||
const TRANSFORM_PACKAGES = [ | ||
'react-native', | ||
'jest-react-native', | ||
'@react-native', | ||
'@react-native-community', | ||
'@react-navigation', | ||
// ... | ||
]; | ||
|
||
/** | ||
* @type {import('jest').Config} | ||
*/ | ||
module.exports = { | ||
preset: 'react-native', | ||
transform: { | ||
'^.+\\.(t|j)sx?$': '@react-native-esbuild/jest', | ||
}, | ||
transformIgnorePatterns: [ | ||
`node_modules/(?!${TRANSFORM_PACKAGES.join('|')})/`, | ||
], | ||
}; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"label": "Limitations", | ||
"position": 7 | ||
"position": 8 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{ | ||
"label": "Troubleshooting", | ||
"position": 6 | ||
"position": 7 | ||
} |
543ba1c
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.
Successfully deployed to the following URLs:
react-native-esbuild-web – ./
react-native-esbuild-web-leegeunhyeok.vercel.app
react-native-esbuild-web-git-master-leegeunhyeok.vercel.app
rne-web-demo.vercel.app
543ba1c
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.
Coverage report
Test suite run success
83 tests passing in 10 suites.
Report generated by 🧪jest coverage report action from 543ba1c