/taped

Life cycle for tape.

Primary LanguageJavaScript

Build Status NPM version

Taped

Adds easy to use life-cycle functions for tape tests.

Usage

Add before and after options to either test or t.test.

A before test will complete when the test passed to it completes (either through t.end or when the plan completes.

Example:

var test = require('taped');

test('taped', {
    before: function (t) {
        //Call t.end directly.
        t.end();
    },
    after: function () {
        //Cleanup
    }
}, function (t) {

    t.test('test', {
       before: function (t) {
           //Using plan.
           t.plan(1);
           t.pass('before called.');
       },
       after: function () {
           //Cleanup
       }
   }, function (t) {
        t.pass('everything ran.');
        t.end();
    });
});