1
0
mirror of synced 2025-12-20 02:19:14 -05:00
Files
docs/jest.setup.js
Robert Sese 8a7301d370 Fail on console.error in tests with failOnConsole (#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
2022-02-25 10:49:27 -06:00

13 lines
487 B
JavaScript

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,
})