Extension for mocha that expects any assertion to have run in each test otherwise throwing error.
- Chai:
- Expect
- Assert
- Should *(extended only)
- Require at start of tests or in your testing config.
const expectAssert = require('./index');
- Instantiate with your assertion of choice.
const expect = expectAssert(chai.expect);
- Use where you need.
// hooks.js
const expectAssert = require('expect-assert');
chai.expect = expectAssert(chai.expect); // override expect() everywhere
Register the hooks in mocha:
mocha --require expect-assert/hooks hooks.js