Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rouanw/fail-tests-on-text
A utility that fails your tests if the provided text is logged during execution
https://github.com/rouanw/fail-tests-on-text
Last synced: 4 days ago
JSON representation
A utility that fails your tests if the provided text is logged during execution
- Host: GitHub
- URL: https://github.com/rouanw/fail-tests-on-text
- Owner: rouanw
- Created: 2018-05-07T05:43:42.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-09T13:20:57.000Z (almost 5 years ago)
- Last Synced: 2024-10-28T13:36:45.310Z (16 days ago)
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# fail-tests-on-text
[![npm version](https://badge.fury.io/js/fail-tests-on-text.svg)](https://badge.fury.io/js/fail-tests-on-text)
![Dependency Status](https://david-dm.org/rouanw/fail-tests-on-text.svg)
![Open Source Love](https://badges.frapsoft.com/os/mit/mit.svg?v=102)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__
```sh
npm install --save-dev fail-tests-on-text
```__2. Use__
```js
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](https://mochajs.org/) and [Tape](https://github.com/substack/tape) using React 16.
## Licence
MIT