tape-testing / faucet Goto Github PK
View Code? Open in Web Editor NEWhuman-readable TAP summarizer
License: MIT License
human-readable TAP summarizer
License: MIT License
The output of any test in msysgit looks like this:
The original TAP input:
> node test
TAP version 13
# map-to/array
ok 1 should be equivalent
ok 2 should be equivalent
ok 3 should be equivalent
# map-to/object
ok 4 should be equivalent
ok 5 should be equivalent
ok 6 should be equivalent
ok 7 should be equivalent
1..7
# tests 7
# pass 7
# ok
I notice that the tape library outputs the stack when a test fails, but once I pass it through faucet, I can't see the stack. Is there any way to enable that for debugging purposes?
tape -- tests/*.js core/tests/*.js plugins/*/tests/*.js | faucet
gives me not ok <number> assert out of order
while this gives
tape -- tests/*.js core/tests/*.js plugins/*/tests/*.js
...
1..115
# tests 115
# pass 115
# ok
Getting this error when just using faucet
events.js:141
throw er; // Unhandled 'error' event
^
Error: spawn C:\Users\UserName\AppData\Roaming\npm\node_modules\faucet\node_modules\tape\bin\tape ENOENT
at exports._errnoException (util.js:870:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at nextTickCallbackWith2Args (node.js:442:9)
at process._tickCallback (node.js:356:17)
at Function.Module.runMain (module.js:443:11)
at startup (node.js:139:18)
at node.js:968:3
Example:
$ node test/foobar.test.js | faucet | head -n 2
✓ foobar
# tests 1
stream.js:94
throw er; // Unhandled stream error in pipe.
^
Error: write EPIPE
at errnoException (net.js:901:11)
at Object.afterWrite (net.js:718:19)
Without head
:
$ node test/foobar.test.js | faucet
✓ foobar
# tests 1
# pass 1
✓ ok
That's likely because head
closes the pipe as soon as it got 2 lines, breaking the pipe on the faucet
side.
I've written an alternative to the tape
and would like to be able to use it with faucet
. The command is called tapeo
. It is presently a fork of tape
, but it's written so that it proposes hooks in tape
that would allow tapeo
to simply be an executable script that uses the tape
module.
To use faucet
with tapeo
or other alternative TAP producers, this is all that's needed:
-n
) to the underlying TAP command.I propose the environment variable FAUCET_TAP_CMD
. I'll provide a PR shortly.
I would love if there was an option to turn
⨯ doing this and that
not ok 9 bla should be equivalent
---
operator: deepEqual
expected: |-
[ ]
actual: |-
[ ... ]
at: add (bla.js:49:5)
...
to just
⨯ doing this and that
not ok 9 bla should be equivalent
https://www.npmjs.com/package/sprintf is deprecated.
Move to https://www.npmjs.com/package/sprintf-js instead.
When faucet is installed as a project dependency, it hangs indefinitely when called directly or through some test command.
Example:
node_modules/.bin/faucet
produces just an empty and a blinking cursor in git bash. (haven't tried it in other Windows bash adaptations)
Additional info:
I am piping output from tape 4.2.0 into faucet, I'm not sure if this issue is caused by tape output or by faucet.
According to what appears to be the tap spec, lines like this should count as skipped:
ok 23 # skip Insufficient flogiston pressure.
If the whole test file succeeds, the count of skipped tests is included in the generated output. The harness should report the text after # SKIP\S*\s+ as a reason for skipping.
Tape does not appear to output anything for skipped tests, and skipped assertions have # SKIP
appended to the message rather than prepended.
faucet does not display tests that have skipped assertions any differently, even if I edit the output to make the skipped test lines look like the one in the spec (move # skip
to just after the assertion number) and has nothing in the final lines about skipped tests.
With this test ...
var test = require('tape');
test('long description', function(t) {
t.equal(0, 0, "this is a very long description this is a very long description this is a very long description")
t.end()
});
... my output looks like this:
# long description
✓ long descriptionery long description this is a very long description this is a very long descripti# tests 1
# pass 1
✓ ok
I notice that if I delete the last two characters, making it a 93 character long description, the weird printing doesn't happen. Same goes for a description that is just a lot of a
: up to 93 works; over 93 causes this weirdness.
"tape": "^4.6.0",
"faucet": "0.0.1
npm --version 3.10.6
node --version v6.3.0
This line of TAP input with a colon:
ok 200 CallableReturningEventEmitter: unregistered event does not fire listener
produced by the tape assertion: t.equals(testobj.hit, 'dog', "CallableReturningEventEmitter: unregistered event does not fire listener")
results in messed-up faucet output:
what it should look like:
Faucet is currently configured to use tap-parser
version 0.4.0. The latest version is 1.2.2, but faucet has several compatibility issues with it.
I can get it to run without crashing if I change res.number
to res.id
in the assert
event handler, but the output is all messed up.
I discovered this in the process of investigating why faucet
wasn't properly handing my TAP "Bail out!" notice. The reason is that it uses a tap-parser
that does not emit bailout
.
We have a fantastic divider to structure test output in a tree.
It's files.
We could group the list of green ticks by which file the test('...')
occur in.
The only problem is I'm not sure how to place file meta information in tap output or when calling faucet
from the cli directly.
I have a test that produces the following TAP output:
TAP version 13
# foo
# bar
ok 1 yay!
1..1
# tests 1
# pass 1
# ok
faucet gives this output:
✓ foo
✓ bar
# tests 1
# pass 1
✓ ok
I would have expected the foo line to not be marked as passing. I expected it to just remain # foo
.
I've found two different cases where the output of faucet is mysteriously missing:
package.json:
"scripts": {
"test": "faucet",
"test-auto": "nodemon --exec 'npm test'",
"test-auto2": "fsmonitor -s npm test"
}
cli:
$ npm test
> [email protected] test /Users/user/projects/test-config
> faucet
✓ getGlobalConfig returns default when process.env is not set
# tests 2
# pass 2
✓ ok
$ npm run test-auto
> [email protected] test-auto /Users/user/projects/test-config
> nodemon --exec 'npm test'
[nodemon] 1.9.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `npm test`
> [email protected] test /Users/user/projects/test-config
> faucet
^C
$ npm run test-auto2
> [email protected] test-auto2 /Users/user/projects/test-config
> fsmonitor -s npm test
Monitoring: ~/projects/test-config
filter: **/
action: npm test
npm test
> [email protected] test /Users/user/projects/test-config
> faucet
✓ getGlobalConfig returns default when process.env is not set
# tests 2
# pass 2
✓ ok
......
I initially created an issue with nodemon, but it was suggested that the issue could be with how faucet is detecting the stdout stream.
12:40:42 dan@elise:~/stuff/vernamtools master ✘ ✹ ✭
$ npm test
> [email protected] test /Users/dan/stuff/vernamtools
> ava -t test/index.js | faucet
✓ vernam is its own inverse: vernam(vernam(input, key), key) === input
# vernam is the identity function for null keys: vernam(input, nullS...
✓ vernam is the identity function for null keys: vernam(input, nullS...lStr) =✓ vernam(nullStr, key) === repeatUntilSize(key, nullStr.length)
# vernam(input, key, len) === vernam(input, key.slice(0, len)) if ke...
✓ vernam(input, key, len) === vernam(input, key.slice(0, len)) if ke...key.len# vernam(input, key, len) === vernam(input, padEnd(key, len, nullCha...
✓ vernam(input, key, len) === vernam(input, padEnd(key, len, nullCha...har)) i✓ vernam(input, key).length === input.length
✓ group("Hello, world!", 4) === ["Hoo!","e,r","l l","lwd"]
# tests 7
✓ pass 7
12:40:50 dan@elise:~/stuff/vernamtools master ✘ ✹ ✭
$ npm test
> [email protected] test /Users/dan/stuff/vernamtools
> ava -t test/index.js
TAP version 13
# vernam is its own inverse: vernam(vernam(input, key), key) === input
ok 1 - vernam is its own inverse: vernam(vernam(input, key), key) === input
# vernam is the identity function for null keys: vernam(input, nullStr) === input
ok 2 - vernam is the identity function for null keys: vernam(input, nullStr) === input
# vernam(nullStr, key) === repeatUntilSize(key, nullStr.length)
ok 3 - vernam(nullStr, key) === repeatUntilSize(key, nullStr.length)
# vernam(input, key, len) === vernam(input, key.slice(0, len)) if key.length < len
ok 4 - vernam(input, key, len) === vernam(input, key.slice(0, len)) if key.length < len
# vernam(input, key, len) === vernam(input, padEnd(key, len, nullChar)) if key.length > len
ok 5 - vernam(input, key, len) === vernam(input, padEnd(key, len, nullChar)) if key.length > len
# vernam(input, key).length === input.length
ok 6 - vernam(input, key).length === input.length
# group("Hello, world!", 4) === ["Hoo!","e,r","l l","lwd"]
ok 7 - group("Hello, world!", 4) === ["Hoo!","e,r","l l","lwd"]
1..7
# tests 7
# pass 7
# fail 0
Like a tape -r babel-register
equivalent.
Assertions like t.ok(value, message)
can be passed messages longer than usual terminal width. For example:
TAP version 13
# Exported dependency names can be resolved.
ok 1 The dependency "csui" should be resolvable.
ok 2 The dependency "esoc" should be resolvable.
# Resolving an unknown dependency fails.
ok 3 The message "Unrecognised dependency: "dummy"." should start with "Unrecognised dependency:".
1..3
# tests 3
# pass 3
# ok
The output appears to print the assertion message on two lines and when the test name is going to be printed, it ends up at the beginning of the first line too. For example:
✓ Exported dependency names can be resolved.
# Resolving an unknown dependency fails.
✓ Resolving an unknown dependency fails.ncy: "dummy"." should start with "Unre# tests 3
# pass 3
✓ ok
The expected output should contain only the test names:
✓ Exported dependency names can be resolved.
✓ Resolving an unknown dependency fails.
# pass 3
✓ ok
With the latest version of https://github.com/isaacs/node-tap the subtests are not shown when running.
Hi
I'm using faucet to format AVA + TAP output. Both default AVA error reporter and vanilla TAP show emoji in test results fine. However, Faucet doesn't understand emoji and often truncates the end of lines that have emoji, or shows broken symbols if error report consists of only emoji:
By the way, the AVA test in question was:
test.only('🦄🦄🦄', t => {
t.pass();
});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.