Narcoleptic Programmers' Medicine

npm

Need private packages and team management tools?Check out npm Orgs. »

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();

Keywords

none

install

npm i testsimple

Downloadsweekly downloads

12

version

1.0.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability