eslint-plugin-should-promised
Eslint rule for checking that should-promised assertions return
Install
$ npm i -D eslint-plugin-should-promised
Configure
Rules
Require promise assertions to return or await (return-promise)
This rule is intended to be used with the should assertion library.
When testing an async function by returning a promise to mocha it is important to remember to actually return the promise. Forgetting to return will cause the test case to pass even if the promise is eventually rejected.
This rule will point out when a should assertion is made without returning.
Rule Details
This rule looks for any of the properties Promise
, fulfilled
, fulfilledWith
, rejected
, rejectedWith
, finally
and eventually
.
The following patterns are considered warnings:
;
These patterns would not be considered warnings:
;
Further Reading
- The should assertion library