fail-tests-on-text
v2.0.2
Published
A utility that fails your tests when some text is logged during execution
Downloads
3
Maintainers
Readme
fail-tests-on-text
Need to fail your tests when some text is output?
We use this because we were tired of React warnings slipping into our code base unnoticed.
1. Install
npm install --save-dev fail-tests-on-text
2. Use
import failTestsOnText from 'fail-tests-on-text';
failTestsOnText('Warning:'); // In your test setup somewhere. This works great for catching React warnings (but will catch other stuff too!)
3. Profit
Now any test that causes a React warning to be logged to the console will fail.
Tested with Mocha and Tape using React 16.
Licence
MIT