You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Crash the build during CI whenever linter warnings are encountered (#944)
* Added functionality to crash the build during CI whenever linter warnings are encountered.
* Updated the docs with a description on how to use the build in CI
* Fixed small typo
* Fixed description of build error.
Copy file name to clipboardExpand all lines: packages/react-scripts/template/README.md
+18-3
Original file line number
Diff line number
Diff line change
@@ -810,7 +810,11 @@ Note that tests run much slower with coverage so it is recommended to run it sep
810
810
811
811
### Continuous Integration
812
812
813
-
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`. Popular CI servers already set it by default but you can do this yourself too:
813
+
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`.
814
+
815
+
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.
816
+
817
+
Popular CI servers already set the environment variable `CI` by default but you can do this yourself too:
814
818
815
819
### On CI servers
816
820
#### Travis CI
@@ -827,6 +831,7 @@ cache:
827
831
- node_modules
828
832
script:
829
833
- npm test
834
+
- npm run build
830
835
```
831
836
1. Trigger your first build with a git push.
832
837
1. [Customize your Travis CI Build](https://docs.travis-ci.com/user/customizing-the-build/) if needed.
@@ -838,6 +843,10 @@ script:
838
843
set CI=true&&npm test
839
844
```
840
845
846
+
```cmd
847
+
set CI=true&&npm run build
848
+
```
849
+
841
850
(Note: the lack of whitespace is intentional.)
842
851
843
852
##### Linux, OS X (Bash)
@@ -846,9 +855,15 @@ set CI=true&&npm test
846
855
CI=true npm test
847
856
```
848
857
849
-
This way Jest will run tests once instead of launching the watcher.
858
+
```bash
859
+
CI=true npm run build
860
+
```
861
+
862
+
The test command will force Jest to run tests once instead of launching the watcher.
863
+
864
+
> If you find yourself doing this often in development, please [file an issue](https://github.com/facebookincubator/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.
850
865
851
-
If you find yourself doing this often in development, please [file an issue](https://github.com/facebookincubator/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.
866
+
The build command will check for linter warnings and fail if any are found.
0 commit comments