Skip to content

Commit

Permalink
Suggest Jest as default (reduxjs#1943)
Browse files Browse the repository at this point in the history
* Suggest Jest as default

* Remove references to expect package.

Since we're recommending Jest, it provides those as globals automatically.
  • Loading branch information
cpojer authored and timdorr committed Sep 12, 2016
1 parent 72e4677 commit e0168d6
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions docs/recipes/WritingTests.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ Because most of the Redux code you write are functions, and many of them are pur

### Setting Up

We recommend [Mocha](http://mochajs.org/) as the testing engine.
We recommend [Jest](http://facebook.github.io/jest/) as the testing engine.
Note that it runs in a Node environment, so you won't have access to the DOM.

```
npm install --save-dev mocha
npm install --save-dev jest
```

To use it together with [Babel](http://babeljs.io), you will need to install `babel-register`:
To use it together with [Babel](http://babeljs.io), you will need to install `babel-jest`:

```js
npm install --save-dev babel-register
npm install --save-dev babel-jest
```

and configure it to use ES2015 features in `.babelrc`:
Expand All @@ -32,7 +32,7 @@ Then, add this to `scripts` in your `package.json`:
...
"scripts": {
...
"test": "mocha --compilers js:babel-register --recursive",
"test": "jest",
"test:watch": "npm test -- --watch"
},
...
Expand All @@ -58,7 +58,6 @@ export function addTodo(text) {
can be tested like:

```js
import expect from 'expect'
import * as actions from '../../actions/TodoActions'
import * as types from '../../constants/ActionTypes'

Expand Down Expand Up @@ -188,7 +187,6 @@ export default function todos(state = initialState, action) {
can be tested like:

```js
import expect from 'expect'
import reducer from '../../reducers/todos'
import * as types from '../../constants/ActionTypes'

Expand Down Expand Up @@ -300,7 +298,6 @@ export default Header
can be tested like:

```js
import expect from 'expect'
import React from 'react'
import { shallow } from 'enzyme'
import Header from '../../components/Header'
Expand Down Expand Up @@ -411,7 +408,6 @@ Middleware functions wrap behavior of `dispatch` calls in Redux, so to test this
#### Example

```js
import expect from 'expect'
import * as types from '../../constants/ActionTypes'
import singleDispatch from '../../middleware/singleDispatch'

Expand Down

0 comments on commit e0168d6

Please sign in to comment.