@charmander/test

0.4.0-pre.2 • Public • Published

Build status

Organizes and runs tests.

Usage

'use strict';

const assert = require('assert');
const test = require('@charmander/test')(module);

test('synchronous test, no return value', () => {
    assert(1 < 2);
});

test('asynchronous test, promise return value', async () => {
    const n = await Promise.resolve(2);
    assert(1 < n);
});

or

const describe = require('@charmander/test/describe')(module);

describe('thing', it => {
    it('behaves', () => {
        assert(1 < 2);
    });
});

Running node path/to/test-module.js will run tests in that module. Test modules export an array of test objects, which have a name property and a .run() method. .run() returns a promise that rejects with a test error or resolves with undefined.

Readme

Keywords

Package Sidebar

Install

npm i @charmander/test

Weekly Downloads

9

Version

0.4.0-pre.2

License

ISC

Unpacked Size

9.3 kB

Total Files

9

Last publish

Collaborators

  • charmander