tape-dispenser
Tape test runner with promise and generator function support
Last updated 2 years ago by howlingeverett .
MIT · Repository · Bugs · Original npm · Tarball
$ cnpm install tape-dispenser 
SYNC missed versions from official npm registry.

tape-dispenser

Tape with promise and generator function support. Forked from blue-tape, and all credit should go to spion and substack.

usage with promises

Same as tape, except if you return a promise from a test, it will be checked for errors. If there are no errors, the test will end. Otherwise the test will fail. This means there is no need to use t.plan() or t.end()

example

assuming delay() returns a promise

test("simple delay", function(t) {
    return delay(1);
});

test("should fail", function(t) {
    return delay(1).then(function() {
        throw new Error("Failed!");
    });
});

Generators

If you're using a version of NodeJS that supports generator functions, you can test generators by passing a generator function as the tape callback function.

test("simple generator", function*(t) { // <-- Note the function* callback
  var asyncResult = yield yieldableFunction();
  t.ok(asyncResult.status, "Yield resolved to a status object");
})

license

MIT

Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
  • co ^4.6.0
  • tape >=2.0.0 <5.0.0
Dev Dependencies (1)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |