testsimple

1.0.2 • Public • Published

testsimple is a Javascript unit testing framework that uses the Test Anything Protocol (TAP). It is inspired by Test::Simple.

Example

const { test, doneTesting } = require('testsimple');

test('Addition', ts => {
    // Test with simple assertions
    ts.ok(10 > 3);
    ts.ok(2 + 3 == 5);

    // Output extra information
    ts.ok(10 > 3,     '3 is less than 10');
    ts.ok(2 + 3 == 5, 'It works this way too');
});

test('Strings', ts => {
    ts.eq("  Test  ".trim(), "Test");
});

doneTesting();

If you don't like sectioning the tests like that, you just write the tests like this.

const { ts } = require('testsimple');

ts.ok(5 > 1, "This should pass");
ts.ok(true);

ts.eq(5, 4 + 1);
ts.ok(5 + 4 == 9);

ts.doneTesting();

Readme

Keywords

none

Package Sidebar

Install

npm i testsimple

Weekly Downloads

2

Version

1.0.2

License

MIT

Unpacked Size

6.44 kB

Total Files

7

Last publish

Collaborators

  • 0xleo