From 9c098e278656e85b3ee68cb58a492c0292ca725a Mon Sep 17 00:00:00 2001 From: Daniel Tschinder Date: Sun, 19 Nov 2017 23:46:37 +0100 Subject: [PATCH] Fix support for namespaced babel packages --- CHANGELOG.md | 2 ++ docs/GettingStarted.md | 8 +++++++- packages/babel-jest/README.md | 7 ++++++- packages/babel-jest/package.json | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc329dea845c..86b4f9c13257 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ ## master ### Fixes +* `[babel-jest]` Fix support for namespaced babel version 7 + ([#4918](https://github.com/facebook/jest/pull/4918)) * `[expect]` fix .toThrow for promises ([#4884](https://github.com/facebook/jest/pull/4884)) * `[jest-docblock]` pragmas should preserve urls diff --git a/docs/GettingStarted.md b/docs/GettingStarted.md index 4991001c5db4..c831f1f27a0e 100644 --- a/docs/GettingStarted.md +++ b/docs/GettingStarted.md @@ -81,9 +81,15 @@ To use [Babel](http://babeljs.io/), install the `babel-jest` and `regenerator-runtime` packages: ``` -npm install --save-dev babel-jest regenerator-runtime +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: +> ``` +> npm install --save-dev babel-jest babel-core@^7.0.0-0 @babel/core regenerator-runtime +> ``` + _Note: Explicitly installing `regenerator-runtime` is not needed if you use `npm` 3 or 4 or Yarn_ diff --git a/packages/babel-jest/README.md b/packages/babel-jest/README.md index 4c616655458a..cf75b6faec6e 100644 --- a/packages/babel-jest/README.md +++ b/packages/babel-jest/README.md @@ -9,9 +9,14 @@ If you are already using `jest-cli`, just add `babel-jest` and it will automatically compile JavaScript code using babel. ``` -npm install --save-dev babel-jest +npm install --save-dev babel-jest babel-core ``` +> Note: If you are using babel version 7 you have to install `babel-jest` with +> ``` +> npm install --save-dev babel-jest babel-core@^7.0.0-0 @babel/core +> ``` + If you would like to write your own preprocessor, uninstall and delete babel-jest and set the [config.transform](http://facebook.github.io/jest/docs/configuration.html#transform-object-string-string) diff --git a/packages/babel-jest/package.json b/packages/babel-jest/package.json index 5b7df67c8fc2..2f5bf4016ec5 100644 --- a/packages/babel-jest/package.json +++ b/packages/babel-jest/package.json @@ -16,6 +16,6 @@ "babel-core": "^6.0.0" }, "peerDependencies": { - "babel-core": "^6.0.0 || ^7.0.0-alpha || ^7.0.0-beta || ^7.0.0" + "babel-core": "^6.0.0 || ^7.0.0-0" } }