From d18e8ff806ccea315d1becad1965990c8d8b6462 Mon Sep 17 00:00:00 2001 From: Rico Kahler Date: Fri, 1 Feb 2019 14:26:32 -0500 Subject: [PATCH 1/6] update docs --- CONTRIBUTING.md | 2 +- docusaurus/docs/available-scripts.md | 4 +++- docusaurus/docs/getting-started.md | 6 ++++-- docusaurus/docs/running-tests.md | 10 +++++----- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index afc584c3957..be6e45175f8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,7 +27,7 @@ Another example of this is how `npm test` normally launches the watcher, but if We prefer to add interactivity to the command line interface rather than add configuration flags. For example, `npm start` will attempt to run with port `3000` by default, but it may be busy. Many other tools just fail in this case and ask that you pass a different port, but Create React App will display a prompt asking if you’d like to run the app on the next available port. -Another example of interactivity is `npm test` watcher interface. Instead of asking people to pass command line flags for switching between test runner modes or search patterns, we print a hint with keys that you can press during the test session to instruct watcher what to do. Jest supports both flags and interactive CLI but Create React App prefers long-running sessions to keep user immersed in the flow over short-running sessions with different flags. +Another example of interactivity is `npm test` watcher interface. Instead of asking people to pass command line flags for switching between test runner modes or search patterns, we print a hint with keys that you can press during the test session to instruct watcher what to do. Jest supports both flags and interactive CLI but Create React App prefers long-running sessions to keep user immersed in the flow over short-running sessions with different flags (However, you can disable this by passing the flag `npm test -- --no-watch`). ### Breaking the Rules diff --git a/docusaurus/docs/available-scripts.md b/docusaurus/docs/available-scripts.md index f7adadb0853..f9242e1c1dd 100644 --- a/docusaurus/docs/available-scripts.md +++ b/docusaurus/docs/available-scripts.md @@ -14,7 +14,9 @@ The page will reload if you make edits. You will also see any lint errors in the ## `npm test` -Launches the test runner in the interactive watch mode. See the section about [running tests](running-tests.md) for more information. +Launches the test runner in the interactive watch mode\*. See the section about [running tests](running-tests.md) for more information. + +> \*You can disable this behavior by passing the flag `--no-watch` if needed though, interactive mode is suggested. ## `npm run build` diff --git a/docusaurus/docs/getting-started.md b/docusaurus/docs/getting-started.md index a77beb5c1b0..0f5b6ee3411 100644 --- a/docusaurus/docs/getting-started.md +++ b/docusaurus/docs/getting-started.md @@ -18,7 +18,7 @@ npm start _([npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) comes with npm 5.2+ and higher, see [instructions for older npm versions](https://gist.github.com/gaearon/4064d3c23a77c74a3614c498a8bb1c5f))_ -Then open [http://localhost:3000/](http://localhost:3000/) to see your app. +Then open [http://localhost:3000/](http://localhost:3000/) to see your app. When you’re ready to deploy to production, create a minified bundle with `npm run build`. @@ -108,10 +108,12 @@ The page will automatically reload if you make changes to the code. You will see ### `npm test` or `yarn test` -Runs the test watcher in an interactive mode. By default, runs tests related to files changed since the last commit. +Runs the test watcher in an interactive mode\*. By default, runs tests related to files changed since the last commit. [Read more about testing](https://facebook.github.io/create-react-app/docs/running-tests). +> \*You can disable this behavior by passing the flag `--no-watch` if needed though, interactive mode is suggested. + ### `npm run build` or `yarn build` Builds the app for production to the `build` folder. It correctly bundles React in production mode and optimizes the build for the best performance. diff --git a/docusaurus/docs/running-tests.md b/docusaurus/docs/running-tests.md index 6daaffb73aa..1f804a2b93a 100644 --- a/docusaurus/docs/running-tests.md +++ b/docusaurus/docs/running-tests.md @@ -29,12 +29,14 @@ We recommend to put the test files (or `__tests__` folders) next to the code the ## Command Line Interface -When you run `npm test`, Jest will launch in the watch mode. Every time you save a file, it will re-run the tests, just like `npm start` recompiles the code. +When you run `npm test`, Jest will launch in the watch mode\*. Every time you save a file, it will re-run the tests, just like `npm start` recompiles the code. The watcher includes an interactive command-line interface with the ability to run all tests, or focus on a search pattern. It is designed this way so that you can keep it open and enjoy fast re-runs. You can learn the commands from the “Watch Usage” note that the watcher prints after every run: ![Jest watch mode](https://jestjs.io/img/blog/15-watch.gif) +> \*You can disable this behavior by passing the flag `--no-watch` if needed though, interactive mode is suggested. + ## Version Control Integration By default, when you run `npm test`, Jest will only run the tests related to files changed since the last commit. This is an optimization designed to make your tests run fast regardless of how many tests you have. However it assumes that you don’t often commit the code that doesn’t pass the tests. @@ -306,7 +308,7 @@ Example package.json: ## Continuous Integration -By default `npm test` runs the watcher with interactive CLI. However, you can force it to run tests once and finish the process by setting an environment variable called `CI`. +By default `npm test` runs the watcher with interactive CLI. However, you can force it to run tests once and finish the process by setting an environment variable called `CI` or adding the flag `--no-watch`. When creating a build of your application with `npm run build` linter warnings are not checked by default. Like `npm test`, you can force the build to perform a linter warning check by setting the environment variable `CI`. If any warnings are encountered then the build fails. @@ -372,9 +374,7 @@ CI=true npm test CI=true npm run build ``` -The test command will force Jest to run tests once instead of launching the watcher. - -> If you find yourself doing this often in development, please [file an issue](https://github.com/facebook/create-react-app/issues/new) to tell us about your use case because we want to make watcher the best experience and are open to changing how it works to accommodate more workflows. +The test command will force Jest to run tests once instead of launching the watcher. If you prefer, you can also pass the flag `--no-watch` to disable the watcher too. The build command will check for linter warnings and fail if any are found. From 280b1b7b8092fadd19d5563f1895929744b253f9 Mon Sep 17 00:00:00 2001 From: Brody McKee Date: Sun, 3 Feb 2019 18:53:35 -0500 Subject: [PATCH 2/6] Update docusaurus/docs/running-tests.md Co-Authored-By: ricokahler --- docusaurus/docs/running-tests.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docusaurus/docs/running-tests.md b/docusaurus/docs/running-tests.md index 1f804a2b93a..1c7d7419deb 100644 --- a/docusaurus/docs/running-tests.md +++ b/docusaurus/docs/running-tests.md @@ -374,7 +374,9 @@ CI=true npm test CI=true npm run build ``` -The test command will force Jest to run tests once instead of launching the watcher. If you prefer, you can also pass the flag `--no-watch` to disable the watcher too. +The test command will force Jest to run in CI-mode, and tests will only run once instead of launching the watcher. + +For non-CI environments, you can simply pass the `--no-watch` flag to disable test-watching. The build command will check for linter warnings and fail if any are found. From 200eaf2f4111b54b36b0dd76c07b5024375e845d Mon Sep 17 00:00:00 2001 From: Brody McKee Date: Sun, 3 Feb 2019 18:54:37 -0500 Subject: [PATCH 3/6] Update docusaurus/docs/running-tests.md Co-Authored-By: ricokahler --- docusaurus/docs/running-tests.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docusaurus/docs/running-tests.md b/docusaurus/docs/running-tests.md index 1c7d7419deb..6226d41b512 100644 --- a/docusaurus/docs/running-tests.md +++ b/docusaurus/docs/running-tests.md @@ -35,7 +35,7 @@ The watcher includes an interactive command-line interface with the ability to r ![Jest watch mode](https://jestjs.io/img/blog/15-watch.gif) -> \*You can disable this behavior by passing the flag `--no-watch` if needed though, interactive mode is suggested. +> \*Although we recommend running your tests in watch mode during development, you can disable this behavior by passing in the `--no-watch` flag. In most CI environments, this is handled for you (see [On CI servers](#on-ci-servers)). ## Version Control Integration From 340417dad64bb62aa18c4455bb95e7c753417aa5 Mon Sep 17 00:00:00 2001 From: Brody McKee Date: Sun, 3 Feb 2019 18:54:51 -0500 Subject: [PATCH 4/6] Update docusaurus/docs/running-tests.md Co-Authored-By: ricokahler --- docusaurus/docs/running-tests.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docusaurus/docs/running-tests.md b/docusaurus/docs/running-tests.md index 6226d41b512..f773c4dfcbc 100644 --- a/docusaurus/docs/running-tests.md +++ b/docusaurus/docs/running-tests.md @@ -29,7 +29,7 @@ We recommend to put the test files (or `__tests__` folders) next to the code the ## Command Line Interface -When you run `npm test`, Jest will launch in the watch mode\*. Every time you save a file, it will re-run the tests, just like `npm start` recompiles the code. +When you run `npm test`, Jest will launch in watch mode\*. Every time you save a file, it will re-run the tests, just like `npm start` recompiles the code. The watcher includes an interactive command-line interface with the ability to run all tests, or focus on a search pattern. It is designed this way so that you can keep it open and enjoy fast re-runs. You can learn the commands from the “Watch Usage” note that the watcher prints after every run: From 41ae27b31c98d5f627a3d7d0bbda9507e6f4d046 Mon Sep 17 00:00:00 2001 From: Rico Kahler Date: Sun, 3 Feb 2019 19:01:41 -0500 Subject: [PATCH 5/6] revert few changes: pull/6331#pullrequestreview-199380143 --- CONTRIBUTING.md | 2 +- docusaurus/docs/available-scripts.md | 4 +--- docusaurus/docs/getting-started.md | 4 +--- docusaurus/docs/running-tests.md | 2 +- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index be6e45175f8..afc584c3957 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,7 +27,7 @@ Another example of this is how `npm test` normally launches the watcher, but if We prefer to add interactivity to the command line interface rather than add configuration flags. For example, `npm start` will attempt to run with port `3000` by default, but it may be busy. Many other tools just fail in this case and ask that you pass a different port, but Create React App will display a prompt asking if you’d like to run the app on the next available port. -Another example of interactivity is `npm test` watcher interface. Instead of asking people to pass command line flags for switching between test runner modes or search patterns, we print a hint with keys that you can press during the test session to instruct watcher what to do. Jest supports both flags and interactive CLI but Create React App prefers long-running sessions to keep user immersed in the flow over short-running sessions with different flags (However, you can disable this by passing the flag `npm test -- --no-watch`). +Another example of interactivity is `npm test` watcher interface. Instead of asking people to pass command line flags for switching between test runner modes or search patterns, we print a hint with keys that you can press during the test session to instruct watcher what to do. Jest supports both flags and interactive CLI but Create React App prefers long-running sessions to keep user immersed in the flow over short-running sessions with different flags. ### Breaking the Rules diff --git a/docusaurus/docs/available-scripts.md b/docusaurus/docs/available-scripts.md index f9242e1c1dd..f7adadb0853 100644 --- a/docusaurus/docs/available-scripts.md +++ b/docusaurus/docs/available-scripts.md @@ -14,9 +14,7 @@ The page will reload if you make edits. You will also see any lint errors in the ## `npm test` -Launches the test runner in the interactive watch mode\*. See the section about [running tests](running-tests.md) for more information. - -> \*You can disable this behavior by passing the flag `--no-watch` if needed though, interactive mode is suggested. +Launches the test runner in the interactive watch mode. See the section about [running tests](running-tests.md) for more information. ## `npm run build` diff --git a/docusaurus/docs/getting-started.md b/docusaurus/docs/getting-started.md index 0f5b6ee3411..6945b4e6f08 100644 --- a/docusaurus/docs/getting-started.md +++ b/docusaurus/docs/getting-started.md @@ -108,12 +108,10 @@ The page will automatically reload if you make changes to the code. You will see ### `npm test` or `yarn test` -Runs the test watcher in an interactive mode\*. By default, runs tests related to files changed since the last commit. +Runs the test watcher in an interactive mode. By default, runs tests related to files changed since the last commit. [Read more about testing](https://facebook.github.io/create-react-app/docs/running-tests). -> \*You can disable this behavior by passing the flag `--no-watch` if needed though, interactive mode is suggested. - ### `npm run build` or `yarn build` Builds the app for production to the `build` folder. It correctly bundles React in production mode and optimizes the build for the best performance. diff --git a/docusaurus/docs/running-tests.md b/docusaurus/docs/running-tests.md index f773c4dfcbc..851e0c3a581 100644 --- a/docusaurus/docs/running-tests.md +++ b/docusaurus/docs/running-tests.md @@ -308,7 +308,7 @@ Example package.json: ## Continuous Integration -By default `npm test` runs the watcher with interactive CLI. However, you can force it to run tests once and finish the process by setting an environment variable called `CI` or adding the flag `--no-watch`. +By default `npm test` runs the watcher with interactive CLI. However, you can force it to run tests once and finish the process by setting an environment variable called `CI`. When creating a build of your application with `npm run build` linter warnings are not checked by default. Like `npm test`, you can force the build to perform a linter warning check by setting the environment variable `CI`. If any warnings are encountered then the build fails. From 114864a6769bdbfe3b9bf5b9b030f8d740b03082 Mon Sep 17 00:00:00 2001 From: Rico Kahler Date: Sun, 3 Feb 2019 19:14:08 -0500 Subject: [PATCH 6/6] update docs for debugging tests in vs code --- docusaurus/docs/debugging-tests.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docusaurus/docs/debugging-tests.md b/docusaurus/docs/debugging-tests.md index 93da201a9f6..80ca856cf33 100644 --- a/docusaurus/docs/debugging-tests.md +++ b/docusaurus/docs/debugging-tests.md @@ -54,7 +54,8 @@ Use the following [`launch.json`](https://code.visualstudio.com/docs/editor/debu "args": [ "test", "--runInBand", - "--no-cache" + "--no-cache", + "--no-watch" ], "cwd": "${workspaceRoot}", "protocol": "inspector",