assert-called
v0.1.2-1
Published
Assert that your callback got called
Downloads
80
Readme
assert-called
Assert that your callback got called.
Installation
npm install assert-called
Usage
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
all registered callbacks are eventually called.