Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

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)

Keywords

none

install

npm i done-error

Downloadsweekly downloads

1

version

1.1.3

license

MIT

repository

githubgithub

last publish

collaborators

  • avatar
  • avatar