done-error

1.1.3 • Public • Published

done-error

Build Status Coverage Status

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)

Readme

Keywords

none

Package Sidebar

Install

npm i done-error

Weekly Downloads

0

Version

1.1.3

License

MIT

Last publish

Collaborators

  • eh
  • evanlucas