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 supertap with all npm packages installed. Try it out:

var supertap = require("supertap")

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

supertap v1.0.0

Generate TAP output


SUPERTAP


Build Status

Generate TAP output

Install

$ npm install supertap

Usage

const supertap = require('supertap');

console.log(supertap.start());

console.log(supertap.test('passing', {
    index: 1,
    passed: true
}));

console.log(supertap.finish({
    passed: 1
}));

Output:

TAP version 13
# passing
ok 1 - passing

1..1
# tests 1
# pass 1
# fail 0

API

start()

Always returns 'TAP version 13' string.

test(title, options)

title

Type: string

Test title.

options

index

Type: number

Index of the test. Should start with one, not zero.

passed

Type: boolean
Default: false

Status of the test.

error

Type: Error

If test has failed (passed is false), error is an instance of an actual error.

supertest.test('failing', {
    index: 1,
    passed: false,
    error: new Error()
});
todo
skip

Type: boolean
Default: false

Mark test as to-do or as skipped.

comment

Type: string array

Comments for that test.

finish(stats)

stats

passed
failed
skipped
todo
crashed

Type: number
Default: 0

Number of tests that passed, failed, skipped or marked as todo. crashed is a special option, which adds to failed test count in the output, but not total test count. AVA uses it to count unhandled exceptions.

License

MIT © Vadim Demedes

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