Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including tst with all npm packages installed. Try it out:

var tst = require("tst")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

tst v1.3.2

Minimalistic test runner for node/browser

TST

Minimalistic test runner for browser and node with mocha/tap-compatible API.

npm install tst

// ./test.js

var test = require('tst');
var assert = require('assert');


test('Test trivial things', function() {
    var success = true;
    assert.equal(success, true);
});

test.skip('Do not test unwanted things', function () {
    var $ = require('jquery');
});

test('Group tests', function () {
    test('A', function () {

    });
    test('B', function () {

    });
});

test.only('Test of interest', function () {
    //this test is run exclusively
});

test('Async stuff', function (done) {
    this.timeout(3000);
    setTimeout(done, 2100);
})
.after(function () {
    //will be invoked after test
})
.before(function () {
    //will be invoked before the test
});

Run in node: $ node ./test.js

Terminal

or in browser: $ beefy ./test.js.

Browser

If you’ve changed your mind, just return to mocha: var test = it;.

Related

ava — futuristic test runner by @sindresorhus.
mocha — vintage test runner by @tj.
tape — Test Anything Protocol by @substack.
tap — Test Anything Protocol by @isaacs
tst — initial version of tst by @grahamlyons

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free