jest-plugin-console-matchers
Adds jest
matchers for watching console
methods.
Getting Started
Install jest-plugin-console-matchers
using yarn
:
yarn add --dev jest-plugin-console-matchers
Matchers
Adds the following matchers which check for console
methods to be called:
Matcher | Method |
---|---|
toConsoleError |
console.error |
toConsoleInfo |
console.info |
toConsoleLog |
console.log |
toConsoleWarn |
console.warn |
toThrowWarning |
warning |
Usage
If you want, you can import the matchers to install them in a set of tests.
;
If you want to install the matchers globally, you can modify the jest section of your package.json to include:
"jest":
Example
Example spec that uses these matchers.
; ;
Contributing
If you have any ideas on how this plugin could be better, create an Issue or submit a PR.