- Notifications
You must be signed in to change notification settings - Fork25
human-readable TAP summarizer
License
tape-testing/faucet
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
human-readable TAP summarizer
Pipe TAP text into thefaucet
command, get back pretty results:
You can use any runner you want to generate the TAP output. Here we'll usetape:
You can give thefaucet
command a list of files:
or if you just typefaucet
, any js files intest/
ortests/
will be runusing thetape
command internally:
To get thefaucet
command, withnpm do:
npm install -g faucet
The great thing about TAP is that it's inherently serializable on stdout, so youcan use whichever libraries you wish to generate it.
Many test libraries have ways to get TAP output.
tape andtapwill give you TAP output by default.
With atape test, you would just writeatest.js
like:
vartest=require('tape');test('beep boop',function(t){t.plan(2);t.equal(1+1,2);setTimeout(function(){t.deepEqual('ABC'.toLowerCase().split(''),['a','b','c']);});});
and then just run the file withnode test.js
to get the TAP output:
TAP version 13# beep boopok 1 should be equalok 2 should be equivalent1..2# tests 2# pass 2# ok
or if you have a directory of files, you can use thetape
command that you getwhen younpm install -g tape
:
$ tape test/*.jsTAP version 13# stream in a streamok 1 should be equivalent# expand a streams1 streamok 2 should be equivalent# expand a streams2 streamok 3 should be equivalent# expand a streams2 stream with delayok 4 should be equivalent1..4# tests 4# pass 4# ok
To get TAP out ofmocha, domocha -R tap
:
$ mocha -R tap1..17ok 1 shim foundok 2 core shim not foundok 3 false fileok 4 false moduleok 5 localok 6 index.js of module dirok 7 alternate mainok 8 string browser field as mainok 9 string browser field as main - require subfileok 10 object browser field as mainok 11 object browser field replace fileok 12 object browser field replace file - no pathsok 13 replace module in browser field objectok 14 replace module in object browser field with subdirectoryok 15 replace module in object browser field with subdirectory containingpackage.jsonok 16 replace module in object browser field with subdirectory containingpackage.json with string browser field as mainok 17 replace module in object browser field with subdirectory containingpackage.json with object browser field as main# tests 17# pass 17# fail 0
Once you've got a way to get TAP out of your tests, just pipe intofaucet
:
usage: faucet [FILES] command | faucet
MIT
About
human-readable TAP summarizer