Skip to content

Commit

Permalink
Add note about Node version support in README and docs. Fixes #4947 (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
satya164 authored and cpojer committed Feb 20, 2018
1 parent 4576dd4 commit da90886
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* `[jest-runtime]` Provide `require.main` property set to module with test suite
([#5618](https://github.com/facebook/jest/pull/5618))
* `[docs]` Add note about Node version support ([#5622](https://github.com/facebook/jest/pull/5622))

## 22.4.0

Expand Down
22 changes: 10 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ Or via [`yarn`](https://yarnpkg.com/en/package/jest):
yarn add --dev jest
```

The minimum supported Node version is `v6.0.0` by default. If you need to
support Node 4, refer to the
[Compatibility issues](https://facebook.github.io/jest/docs/en/troubleshooting.html#compatibility-issues)
section.

Let's get started by writing a test for a hypothetical function that adds two
numbers. First, create a `sum.js` file:

Expand Down Expand Up @@ -96,23 +101,16 @@ page.

### Using Babel

To use [Babel](http://babeljs.io/), install the `babel-jest` and
`regenerator-runtime` packages:
[Babel](http://babeljs.io/) is automatically handled by Jest using `babel-jest`.
You don't need install anything extra for using Babel.

```bash
npm install --save-dev babel-jest babel-core regenerator-runtime
```

> Note: If you are using a babel version 7 then you need to install `babel-jest`
> with the following command:
> Note: If you are using a babel version 7 then you need to install
> `babel-core@^7.0.0-0` and `@babel/core` with the following command:
>
> ```bash
> npm install --save-dev babel-jest 'babel-core@^7.0.0-0' @babel/core regenerator-runtime
> npm install --save-dev 'babel-core@^7.0.0-0' @babel/core
> ```
_Note: Explicitly installing `regenerator-runtime` is not needed if you use
`npm` 3 or 4 or Yarn_
Don't forget to add a [`.babelrc`](https://babeljs.io/docs/usage/babelrc/) file
in your project's root folder. For example, if you are using ES6 and
[React.js](https://facebook.github.io/react/) with the
Expand Down
7 changes: 6 additions & 1 deletion docs/Troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,12 @@ option to `jasmine1` or pass `--testRunner=jasmine1` as a command line option.
Jest takes advantage of new features added to Node 6. We recommend that you
upgrade to the latest stable release of Node. The minimum supported version is
`v6.0.0`. Versions `0.x.x` and `4.x.x` are not supported.
`v6.0.0`. Versions `0.x.x` and `4.x.x` are not supported because the `jsdom`
version used in Jest doesn't support Node 4. However, if you need to run Jest on
Node 4, you can use the `testEnvironment` config to use a
[custom environment](https://facebook.github.io/jest/docs/en/configuration.html#testenvironment-string)
that supports Node 4, such as
[`jest-environment-node`](https://www.npmjs.com/package/jest-environment-node).

### `coveragePathIgnorePatterns` seems to not have any effect.

Expand Down

0 comments on commit da90886

Please sign in to comment.