Assert that your callback got called
npm install assert-callednpm install assert-called
js
var cb = require('assert-called');function notCalling(cb) {
}
function notCalled() {
}
process.nextTick(cb(function () {
console.log('called');
}));
notCalling(cb(notCalled));
`Will output:
`
called/Users/maciej/dev/js/assert-called/lib/assert-called.js:20
throw new assert.AssertionError({
^
AssertionError: 1 callback not called:
notCalled
`How it works
assert-called attaches a process.on('exit')` listener to make sure that