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

/assert2/

    Package Sidebar

    Install

    npm i assert2

    Weekly Downloads

    1

    Version

    0.1.0

    License

    MIT

    Last publish

    Collaborators

    • nodeguy