Besides the points brought up in “TAP & Tape, the awesome way to test
going from a more verbose syntax to a more terse one means that I can write less
code while focusing on the tests. Things like
test() and the actual assertions. Being able to run your tests
and independently decide which formatter to use by simply piping the output to
it is also something that I find extremely useful.
A basic example
Here’s a basic test:
To run it all you have to do is:
Or if you want a different output formatter:
You can also run tape directly on a whole directory of files:
One of the best parts of tape is the test are asynchronous by default, which
means that as long as the
t.plan() gets passed the right number of assertions
it’ll wait for them all to finish.