From 0090e6311b4775eabbe5c4360c14bc18a9a99201 Mon Sep 17 00:00:00 2001 From: jiv_e Date: Mon, 24 Apr 2017 23:03:37 +0300 Subject: [PATCH 1/2] Added details how to use setupTests.js after eject --- packages/react-scripts/template/README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/react-scripts/template/README.md b/packages/react-scripts/template/README.md index 0cda7e071f6..923ad138af7 100644 --- a/packages/react-scripts/template/README.md +++ b/packages/react-scripts/template/README.md @@ -176,6 +176,11 @@ If you aren’t satisfied with the build tool and configuration choices, you can Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. +Ejecting removes some automatic functionality like: + +Automatic registration of src/setupTests.js +... (what else?) + You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. ## Supported Language Features and Polyfills @@ -1063,8 +1068,9 @@ and then use them in your tests like you normally do. ### Initializing Test Environment >Note: this feature is available with `react-scripts@0.4.0` and higher. +>Note: After ejecting you need to manually add [setupTestFrameworkScriptFile](https://facebook.github.io/jest/docs/configuration.html#setuptestframeworkscriptfile-string) in package.json. -If your app uses a browser API that you need to mock in your tests or if you just need a global setup before running your tests, add a `src/setupTests.js` to your project. It will be automatically executed before running your tests. +If your app uses a browser API that you need to mock in your tests or if you just need a global setup before running your tests, add a `src/setupTests.js` to your project. It will be automatically executed before running your tests. For example: From f81a1fddd94a0ce596bcdba573e51a38824e0393 Mon Sep 17 00:00:00 2001 From: jiv_e Date: Tue, 27 Jun 2017 22:18:01 +0300 Subject: [PATCH 2/2] Fixed note rendering Also added link to ejecting. --- packages/react-scripts/template/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/react-scripts/template/README.md b/packages/react-scripts/template/README.md index 923ad138af7..5e792177f72 100644 --- a/packages/react-scripts/template/README.md +++ b/packages/react-scripts/template/README.md @@ -1068,7 +1068,8 @@ and then use them in your tests like you normally do. ### Initializing Test Environment >Note: this feature is available with `react-scripts@0.4.0` and higher. ->Note: After ejecting you need to manually add [setupTestFrameworkScriptFile](https://facebook.github.io/jest/docs/configuration.html#setuptestframeworkscriptfile-string) in package.json. + +>Note: After [ejecting](#npm-run-eject) you need to manually add [setupTestFrameworkScriptFile](https://facebook.github.io/jest/docs/configuration.html#setuptestframeworkscriptfile-string) in package.json. If your app uses a browser API that you need to mock in your tests or if you just need a global setup before running your tests, add a `src/setupTests.js` to your project. It will be automatically executed before running your tests.