-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash the build during CI whenever linter warnings are encountered #944
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
bfc11ef
Added functionality to crash the build during CI whenever linter warn…
excitement-engineer 90d1c39
Updated the docs with a description on how to use the build in CI
excitement-engineer 2b57b8e
Fixed small typo
excitement-engineer 93f687a
Fixed description of build error.
excitement-engineer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -788,7 +788,11 @@ Note that tests run much slower with coverage so it is recommended to run it sep | |
|
||
### 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`. Popular CI servers already set it by default but you can do this yourself too: | ||
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. | ||
|
||
Popular CI servers already set the environment variable `CI` by default but you can do this yourself too: | ||
|
||
### On CI servers | ||
#### Travis CI | ||
|
@@ -805,6 +809,7 @@ cache: | |
- node_modules | ||
script: | ||
- npm test | ||
- npm run build | ||
``` | ||
1. Trigger your first build with a git push. | ||
1. [Customize your Travis CI Build](https://docs.travis-ci.com/user/customizing-the-build/) if needed. | ||
|
@@ -816,6 +821,10 @@ script: | |
set CI=true&&npm test | ||
``` | ||
|
||
```cmd | ||
set CI=true&&npm run build | ||
``` | ||
|
||
(Note: the lack of whitespace is intentional.) | ||
|
||
##### Linux, OS X (Bash) | ||
|
@@ -824,9 +833,15 @@ set CI=true&&npm test | |
CI=true npm test | ||
``` | ||
|
||
This way Jest will run tests once instead of launching the watcher. | ||
```bash | ||
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/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. | ||
|
||
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. | ||
The build command will check for linter warning and fail if any are found. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be "linter warnings". |
||
|
||
### Disabling jsdom | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this wording makes it sound like having the
CI
env variable set to true is the problem, not the warnings themself. I hope people won't "fix" this by trying to set the env variable to false...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good comment! We wouldn't want this message to cause any confusion. I will rephrase it:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to remove the description! People can refer to the updated README for more information about running builds in CI:) Do you agree?