0.0.5 • Published 8 years ago

esaver v0.0.5

Weekly downloads
2
License
Apache-2.0
Repository
github
Last release
8 years ago

esaver

esaver is an assertion library used in mocha testing. It can be used as a drop in replacement for node's own assert module.

Motivation

The main reason for esaver coming into existence is the fact that older versions of node assert are not capable of handling custom error classes that have been transpiled using the Babel transpiler. I.e. assert.throws() will fail with a TypeError instead of checking the custom type's prototype chain.

While this issue has now been resolved, older versions of node will not benefit from that fix.

In the long run, we will add more assertions using a plugin system and, subsequently, make this work in the browser, too.

Travis-CI

Build Status

Project Site

The project site, see (2) under resources below, provides more insight into the project, including test coverage reports and API documentation.

Contributing

You are very welcome to propose changes and report bugs, or even provide pull requests on github.

Contributors

Runtime Dependencies

Development Dependencies

See esmake for more information on development dependencies.

Building

See esmake and the targets listed under esmake for more information on how to build this.

Installation

Simply run npm install --save-dev esaver to install.

Usage

Overall usage is equal to node's assert module, with the difference that you can now expect() a given number of assertions to be made by your test cases.

import assert from 'esaver';


describe('testing',
function ()
{
    it('should assert twice',
    function ()
    {
        assert.expect(2);
        assert.equal(1, 2);
    });
}
);

The above test should fail twice, first for the erroneous assertion and second for the missing second assertion.

Best used before done when testing asynchronous APIs or when testing non asynchronous APIs or frameworks that employ a callback mechanism.

Also great for when having multiple asserts in a single test case.

Resources

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

9 years ago