tap-lochnest

A TAP helper for output nested test name beside parent test name.

Usage no npm install needed!

<script type="module">
  import tapLochnest from 'https://cdn.skypack.dev/tap-lochnest';
</script>

README

tap-lochnest (TAP Loch Nest)

npm version npm downloads Build Status Windows Tests bitHound Overall Score Donate

A TAP helper for output nested test name beside parent test name.

tap-lochnesttape

Installation

npm

npm install tap-lochnest --save-dev

Usage

var lochNest = require('tap-lochnest');
var tape = require('tape');
var test = lochNest(tape, { delimiter: ' | ' });

var count = 0;

test('a set of some tests', function (t) {
  t.test('A', function (t) {
    t.equal(++count, 1);
    t.end();
  });

  t.test('B', function (t) {
    t.test('b1', function (t) {
      t.test('bb1', function (t) {
        t.equal(++count, 2);
        t.end();
      });
      t.end();
    });

    t.test('b2', function (t) {
      t.equal(++count, 3);
      t.end();
    });

    t.test('b3', function (t) {
      t.equal(++count, 4);
      t.end();
    });

    t.end();
  });

  t.test('C', function (t) {
    t.equal(++count, 5);
    t.end();
  });

  t.end();
});

test('a test', function (t) {
  t.equal(++count, 6);
  t.end();
});

TAP Output

TAP version 13
# a set of some tests
# a set of some tests | A
ok 1 should be equal
# a set of some tests | B
# a set of some tests | B | b1
# a set of some tests | B | b1 | bb1
ok 2 should be equal
# a set of some tests | B | b2
ok 3 should be equal
# a set of some tests | B | b3
ok 4 should be equal
# a set of some tests | C
ok 5 should be equal
# a test
ok 6 should be equal

1..6
# tests 6
# pass  6

# ok

delimiter option

Default nested test name separator is a space, but can be customize.

Ex:

var test = lochNest(tape, { delimiter: ' | ' });

TAP Frameworks

Work with tape on node and browser

Contributing

  • Documentation improvement
  • Feel free to send any PR

License

ISC