-
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 80a2a28
Showing
4 changed files
with
55 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,49 @@ | ||
--- | ||
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 | ||
|
||
```bash | ||
# using npm | ||
npm install -D @react-native-esbuild/jest | ||
|
||
# using yarn | ||
yarn add -D @react-native-esbuild/jest | ||
``` | ||
|
||
Open your `jest.config.js` and set `@react-native-esbuild/jest` as transformer. | ||
|
||
```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 | ||
} |
80a2a28
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 – ./
rne-web-demo.vercel.app
react-native-esbuild-web-leegeunhyeok.vercel.app
react-native-esbuild-web-git-master-leegeunhyeok.vercel.app
80a2a28
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 80a2a28