diff --git a/CHANGELOG.md b/CHANGELOG.md index bb04b78ffd50..fa4f871452f9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 2c072102ef99..b980c7f7c338 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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 diff --git a/docs/Troubleshooting.md b/docs/Troubleshooting.md index 5dc911cc0eac..037115dfe31f 100644 --- a/docs/Troubleshooting.md +++ b/docs/Troubleshooting.md @@ -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.