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

assert2

0.1.0 • Public • Published

Extends Node.js's assert with two new tests for events:

var assert = require('assert2'),
    events = require('events'),
    emitter = new events.EventEmitter();
 
assert.emits(emitter, 'event', function () {
    emitter.emit('event');
});
 
assert.doesNotEmit(emitter, 'event', function () {
    // zero-emissions code
});

SemVer compliant

API

All of Node's assert tests, plus:

assert.emits(emitter, event, block, [message])

Expects emitter to emit event while executing block. If untrue, throws an exception with a default message which you may override with message.

assert.doesNotEmit(emitter, event, block, [message])

Expects emitter not to emit event while executing block. If untrue, throws an exception with a default message which you may override with message.

License

MIT

Keywords

none

install

npm i assert2

Downloadsweekly downloads

7

version

0.1.0

license

none

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability