done-error
v1.1.3
Published
Verify that done is called with an error
Downloads
2
Readme
done-error
Verify that done is called with an error.
Useful for verifying that a callback is called with an error
in something like a mocha
test.
Install
$ npm install done-error --save-dev
Test
$ npm test
Coverage
$ npm test -- --cov
Usage
var doneError = require('done-error')
function test(cb) {
cb(new Error('This is an error'))
}
describe('test', function() {
it('should return an error', function(done) {
test(doneError(done))
})
it('also can equal an error message', function(done) {
// this should pass
test(doneError(done, 'This is an error'))
})
it('also can match an error message', function(done) {
// this should pass
test(doneError(done, /This/))
})
})
Author
Evan Lucas
License
MIT (See LICENSE
for more info)