Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/apentle/react-native-babel-jest
Simple testing configuration for React Native with Jest
https://github.com/apentle/react-native-babel-jest
Last synced: 30 days ago
JSON representation
Simple testing configuration for React Native with Jest
- Host: GitHub
- URL: https://github.com/apentle/react-native-babel-jest
- Owner: apentle
- License: mit
- Created: 2016-05-09T10:05:31.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-17T10:24:38.000Z (over 7 years ago)
- Last Synced: 2024-04-29T10:22:05.489Z (8 months ago)
- Language: JavaScript
- Homepage: http://blog.apentle.com/
- Size: 39.1 KB
- Stars: 19
- Watchers: 3
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-react-native - react-native-babel-jest ★15 - Simple testing configuration for React Native with Jest (Components / Utils & Infra)
- awesome-react-native - react-native-babel-jest ★15 - Simple testing configuration for React Native with Jest (Components / Utils & Infra)
- awesome-react-native - react-native-babel-jest ★15 - Simple testing configuration for React Native with Jest (Components / Utils & Infra)
- awesome-react-native - react-native-babel-jest ★15 - Simple testing configuration for React Native with Jest (Components / Utils & Infra)
- awesome-react-native-ui - react-native-babel-jest ★10 - Simple testing configuration for React Native with Jest (Components / Utils & Infra)
README
# react-native-babel-jest
[![Build Status](https://travis-ci.org/apentle/react-native-babel-jest.svg?branch=master)](https://travis-ci.org/apentle/react-native-babel-jest) [![Coverage Status](https://coveralls.io/repos/github/apentle/react-native-babel-jest/badge.svg?branch=master)](https://coveralls.io/github/apentle/react-native-babel-jest?branch=master)Simple testing configuration for React Native with Jest
## Installation
```bash
npm i --save-dev react-native-babel-jest jest-cli
```## Usage
Add configuration to `package.json` file
```javascript
{
"scripts": {
"test": "jest"
},
...
"jest": {
"scriptPreprocessor": "/node_modules/react-native-babel-jest",
"setupFiles": [
"/node_modules/react-native-babel-jest/env.js"
],
"automock": true,
"unmockedModulePathPatterns": [
"react",
"enzyme",
"promise",
"source-map"
]
}
}
```
Write your test in `__tests__` folder, run test command
```bash
npm test
```## Recommendation
We recommend you using `enzyme` to render components, and `enzyme-to-json` to make snapshot testing. See more in the example below.## Example
[See this example](https://github.com/apentle/react-native-babel-jest/blob/master/Example/README.md)