forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fail on console.error in tests with failOnConsole (github#25600)
* Install jest-fail-on-console * Setup and use failOnConsole * Add intentional 'unique key' error * Revert "Add intentional 'unique key' error" This reverts commit 5f75f069d80df36ce632421ae7ad26e98ac17ad3. * Comment about why use this package
- Loading branch information
Showing
4 changed files
with
61 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import failOnConsole from 'jest-fail-on-console' | ||
|
||
// Jest tests don't fail in some cases where we would see an error in DevTools | ||
// Console when running locally and we would also see the error in the test | ||
// output. This includes the React `Each child in a list should have a unique | ||
// "key" prop` error example. | ||
// | ||
// To catch this and fail tests in cases like this, we use `jest-fail-on-console` | ||
// to fail on calls to `console.error()`. | ||
failOnConsole({ | ||
shouldFailOnWarn: false, | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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