tape-bdd

BDD-style wrapper for tape

Usage no npm install needed!

<script type="module">
  import tapeBdd from 'https://cdn.skypack.dev/tape-bdd';
</script>

README

tape-bdd Build Status NPM Version License Coverage Status

Tape-BDD essentially wraps tape and provides a more Mocha-style interface for BDD and automatically handling things like TAP planning and assertion names. It assumes one assertion per test.

Usage

var describe = require('tape-bdd');

describe('plus', function(it) {
  // assert has the same API as tape's test object

  // 'it' is a function that will handle thrown
  // errors gracefully and set the number of tests
  // for the suite for assert.plan().

  it('should add one and two', function(assert) {
    assert.equal(1 + 3, 3);
  });

  it('should add strings', function(assert) {
    assert.equal('foo' + 'bar', 'foobar');
  });
});

Is equivalent to:

var test = require('tape');

test('plus', function(t) {
  t.plan(2);

  t.equal(1 + 2, 3, 'should add one and two');

  t.equal('foo' + 'bar', 'foobar', 'should add strings');
});