tape-plus
Nested tape tests with before/after, async, and promise support
tape-plus is a wrapper for tape for a batteries-included experience for writing elegant tape tests. It provides a user-friendly API modelled after Mocha.
Install
tape is a peer dependency of tape-plus. Install them together.
npm install --save-dev tape tape-plus
Usage
Use require('tape-plus')
as a substitute for require('tape')
. The only difference is you don't need to use t.end()
anymore.
var test =
Grouped tests
Use test.group
to define test groups.
var group = group
Nested groups
You can also make groups within groups. Just call test.group
again.
var group = group
Before/after hooks
Use test.beforeEach
and test.afterEach
to add hooks.
var group = group
Asynchronous tests
Pass a second parameter to test()
and it'll be a callback, Mocha-style.
var group = group
Promises
Return a promise from inside a test()
block. Rejected promises will be an error.
var group = group
BDD interface
test.describe
is an alias for test.group
.
var describe = describe
With other tape wrappers
tape-plus is implemented as a decorator, so you can mix it in with other stuff. Here's an example with extend-tape.
var test = test = tape /*...*/ test = tape
Thanks
tape-plus © 2016+, Rico Sta. Cruz. Released under the MIT License.
Authored and maintained by Rico Sta. Cruz with help from contributors (list).
ricostacruz.com · GitHub @rstacruz · Twitter @rstacruz