Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

human-readable TAP summarizer

License

NotificationsYou must be signed in to change notification settings

tape-testing/faucet

Repository files navigation

human-readable TAP summarizer

example

Pipe TAP text into thefaucet command, get back pretty results:

piping tap

You can use any runner you want to generate the TAP output. Here we'll usetape:

tape runner

You can give thefaucet command a list of files:

list of files

or if you just typefaucet, any js files intest/ ortests/ will be runusing thetape command internally:

implicit test/ directory

install

To get thefaucet command, withnpm do:

npm install -g faucet

generating TAP

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:

mocha pipe

usage

usage:  faucet [FILES]  command | faucet

license

MIT


[8]ページ先頭

©2009-2025 Movatter.jp