tap
A Test-Anything-Protocol library for JavaScript
Last updated 17 days ago by isaacs .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install tap 
SYNC missed versions from official npm registry.

node-tap

A TAP test framework for Node.js.

Build Status

Just wanna see some code? Get started!

It includes a command line test runner for consuming TAP-generating test scripts, and a JavaScript framework for writing such scripts.

See the changelog for recent updates, or just get started with the basics.

All this is too much to manage in a single README file, so head over to the website to learn more.

Why TAP?

Why should you use this thing!? LET ME TELL YOU!

Just kidding.

Most frameworks spend a lot of their documentation telling you why they're the greatest. I'm not going to do that.

tutti i gusti sono gusti

Software testing is a software and user experience design challenge that balances on the intersection of many conflicting demands.

Node-tap is based on my opinions about how a test framework should work, and what it should let you do. I do not have any opinion about whether or not you share those opinions. If you do share them, you will probably enjoy this test library.

  1. Test files should be "normal" programs that can be run directly.

    That means that it can't require a special runner that puts magic functions into a global space. node test.js is a perfectly ok way to run a test, and it ought to function exactly the same as when it's run by the fancy runner with reporting and such. JavaScript tests should be JavaScript programs; not english-language poems with weird punctuation.

  2. Test output should be connected to the structure of the test file in a way that is easy to determine.

    That means not unnecessarily deferring test functions until nextTick, because that would shift the order of console.log output. Synchronous tests should be synchronous.

  3. Test files should be run in separate processes.

    That means that it can't use require() to load test files. Doing node ./test.js must be the exact same sort of environment for the test as doing test-runner ./test.js. Doing node test/1.js; node test/2.js should be equivalent (from the test's point of view) to doing test-runner test/*.js. This prevents tests from becoming implicitly dependent on one anothers' globals.

  4. Assertions should not normally throw (but throws MUST be handled nicely).

    I frequently write programs that have many hundreds of assertions based on some list of test cases. If the first failure throws, then I don't know if I've failed 100 tests or 1, without wrapping everything in a try-catch. Furthermore, I usually want to see some kind of output or reporting to verify that each one actually ran.

    Basically, it should be your decision whether you want to throw or not. The test framework shouldn't force that on you, and should make either case easy.

  5. Test reporting should be separate from the test process, included in the framework, and enabled by default for humans.

    The raw test output should be machine-parseable and human-intelligible, and a separate process should consume test output and turn it into a pretty summarized report. This means that test data can be stored and parsed later, dug into for additional details, and so on. Also: nyan cat.

  6. Writing tests should be easy, maybe even fun.

    The lower the barrier to entry for writing new tests, the more tests get written. That means that there should be a relatively small vocabulary of actions that I need to remember as a test author. There is no benefit to having a distinction between a "suite" and a "subtest". Fancy DSLs are pretty, but more to remember.

    That being said, if you return a Promise, or use a DSL that throws a decorated error, then the test framework should Just Work in a way that helps a human being understand the situation.

  7. Tests should output enough data to diagnose a failure, and no more or less.

    Stack traces pointing at JS internals or the guts of the test framework itself are not helpful. A test framework is a serious UX challenge, and should be treated with care.

  8. Test coverage should be included.

    Running tests with coverage changes the way that you think about your programs, and provides much deeper insight. Node-tap bundles NYC for this.

    It does necessarily change the nature of the environment a little bit. But in this case, it's worth it, and NYC has come a long way towards maintaining this promise.

    Coverage enforcement is not on by default, but I strongly encourage it. You can put "tap":{"check-coverage":true} in your package.json, or pass --100 on the command line. In a future version, it will likely be enabled by default.

  9. Tests should not require more building than your code.

    Babel and Webpack are lovely and fine. But if your code doesn't require compilation, then I think your tests shouldn't either. Tap is extremely promise-aware. JSX, TypeScript, Flow, and ES-Modules are built-in when tests are run by the tap CLI.

  10. Tests should run as fast as possible, given all the prior considerations.

As of version 10, tap supports parallel tests. As of version 13, the test runner defaults to running the same number of parallel tests as there are CPUs on the system.

This makes tests significantly faster in almost every case, on any machine with multiple cores.

Software testing should help you build software. It should be a security blanket and a quality ratchet, giving you the support to undertake massive refactoring and fix bugs without worrying. It shouldn't be a purification rite or a hazing ritual.

There are many opinions left off of this list! Reasonable people can disagree. But if you find yourself nodding along, maybe tap is for you.

Current Tags

  • 14.10.2                                ...           latest (17 days ago)
  • 12.7.0                                ...           legacy (7 months ago)
  • 13.0.0-rc.30                                ...           next (8 months ago)
  • 14.10.2-totally-bundled.1                                ...           totally-bundled (16 days ago)
  • 14.10.2-unbundled                                ...           unbundled (17 days ago)

288 Versions

  • 14.10.2-totally-bundled.1                                ...           16 days ago
  • 14.10.2-totally-bundled                                ...           16 days ago
  • 14.10.2-unbundled                                ...           17 days ago
  • 14.10.2                                ...           17 days ago
  • 14.10.1                                ...           22 days ago
  • 14.10.0                                ...           22 days ago
  • 14.9.2                                ...           a month ago
  • 14.9.1                                ...           a month ago
  • 14.9.0                                ...           a month ago
  • 14.8.3                                ...           a month ago
  • 14.8.2                                ...           2 months ago
  • 14.8.1                                ...           2 months ago
  • 14.8.0                                ...           2 months ago
  • 14.7.3                                ...           2 months ago
  • 14.7.2                                ...           2 months ago
  • 14.7.1                                ...           2 months ago
  • 14.7.0                                ...           2 months ago
  • 14.6.9                                ...           2 months ago
  • 14.6.8                                ...           2 months ago
  • 14.6.7                                ...           2 months ago
  • 14.6.6                                ...           2 months ago
  • 14.6.5                                ...           3 months ago
  • 14.6.4                                ...           3 months ago
  • 14.6.3                                ...           3 months ago
  • 14.6.2                                ...           3 months ago
  • 14.6.1                                ...           4 months ago
  • 14.6.0                                ...           4 months ago
  • 14.5.0                                ...           4 months ago
  • 14.4.3                                ...           5 months ago
  • 14.4.2                                ...           5 months ago
  • 14.4.1                                ...           5 months ago
  • 14.4.0                                ...           5 months ago
  • 14.3.1                                ...           6 months ago
  • 14.3.0                                ...           6 months ago
  • 14.2.5                                ...           6 months ago
  • 14.2.4                                ...           6 months ago
  • 14.2.3                                ...           6 months ago
  • 14.2.2                                ...           6 months ago
  • 14.2.1                                ...           6 months ago
  • 14.2.0                                ...           6 months ago
  • 14.1.11                                ...           7 months ago
  • 14.1.10                                ...           7 months ago
  • 14.1.9                                ...           7 months ago
  • 14.1.8                                ...           7 months ago
  • 14.1.7                                ...           7 months ago
  • 14.1.6                                ...           7 months ago
  • 14.1.5                                ...           7 months ago
  • 14.1.4                                ...           7 months ago
  • 14.1.3                                ...           7 months ago
  • 14.1.2                                ...           7 months ago
  • 14.1.1                                ...           7 months ago
  • 14.1.0                                ...           7 months ago
  • 14.0.0                                ...           7 months ago
  • 13.1.11                                ...           7 months ago
  • 13.1.10                                ...           7 months ago
  • 13.1.9                                ...           7 months ago
  • 13.1.8                                ...           7 months ago
  • 13.1.7                                ...           7 months ago
  • 13.1.6                                ...           7 months ago
  • 13.1.5                                ...           7 months ago
  • 13.1.4                                ...           7 months ago
  • 13.1.3                                ...           7 months ago
  • 13.1.2                                ...           7 months ago
  • 13.1.1                                ...           7 months ago
  • 12.7.0                                ...           7 months ago
  • 13.1.0                                ...           7 months ago
  • 13.0.4                                ...           8 months ago
  • 13.0.3                                ...           8 months ago
  • 12.6.6                                ...           8 months ago
  • 13.0.1                                ...           8 months ago
  • 13.0.0                                ...           8 months ago
  • 12.6.5                                ...           8 months ago
  • 13.0.0-rc.30                                ...           8 months ago
  • 13.0.0-rc.29                                ...           8 months ago
  • 12.6.4                                ...           8 months ago
  • 13.0.0-rc.28                                ...           8 months ago
  • 13.0.0-rc.27                                ...           8 months ago
  • 13.0.0-rc.26                                ...           8 months ago
  • 12.6.3                                ...           8 months ago
  • 13.0.0-rc.25                                ...           8 months ago
  • 12.6.2                                ...           8 months ago
  • 13.0.0-rc.24                                ...           8 months ago
  • 13.0.0-rc.23                                ...           8 months ago
  • 13.0.0-rc.22                                ...           8 months ago
  • 13.0.0-rc.21                                ...           8 months ago
  • 13.0.0-rc.20                                ...           8 months ago
  • 13.0.0-rc.19                                ...           8 months ago
  • 13.0.0-rc.18                                ...           9 months ago
  • 13.0.0-rc.17                                ...           9 months ago
  • 13.0.0-rc.16                                ...           9 months ago
  • 13.0.0-rc.15                                ...           9 months ago
  • 13.0.0-rc.14                                ...           9 months ago
  • 12.6.1                                ...           9 months ago
  • 13.0.0-rc.13                                ...           9 months ago
  • 13.0.0-rc.12                                ...           9 months ago
  • 13.0.0-rc.11                                ...           9 months ago
  • 13.0.0-rc.10                                ...           9 months ago
  • 13.0.0-rc.9                                ...           9 months ago
  • 13.0.0-rc.8                                ...           9 months ago
  • 13.0.0-rc.7                                ...           9 months ago
  • 13.0.0-rc.6                                ...           9 months ago
  • 13.0.0-rc.5                                ...           9 months ago
  • 13.0.0-rc.4                                ...           9 months ago
  • 13.0.0-rc.3                                ...           9 months ago
  • 13.0.0-rc.2                                ...           9 months ago
  • 13.0.0-rc.1                                ...           9 months ago
  • 13.0.0-rc.0                                ...           9 months ago
  • 12.6.0                                ...           9 months ago
  • 12.5.3                                ...           10 months ago
  • 12.5.2                                ...           10 months ago
  • 12.5.1                                ...           10 months ago
  • 12.5.0                                ...           10 months ago
  • 12.4.1                                ...           10 months ago
  • 12.4.0                                ...           a year ago
  • 12.3.0                                ...           a year ago
  • 12.2.1                                ...           a year ago
  • 12.2.0                                ...           a year ago
  • 12.1.4                                ...           a year ago
  • 12.1.3                                ...           a year ago
  • 12.1.2                                ...           a year ago
  • 12.1.1                                ...           a year ago
  • 12.1.0                                ...           a year ago
  • 12.0.2                                ...           a year ago
  • 12.0.1                                ...           2 years ago
  • 12.0.0                                ...           2 years ago
  • 11.1.5                                ...           2 years ago
  • 11.1.4                                ...           2 years ago
  • 11.1.3                                ...           2 years ago
  • 11.1.2                                ...           2 years ago
  • 11.1.1                                ...           2 years ago
  • 11.1.0                                ...           2 years ago
  • 11.0.1                                ...           2 years ago
  • 11.0.0                                ...           2 years ago
  • 11.0.0-rc.3                                ...           2 years ago
  • 11.0.0-rc.2                                ...           2 years ago
  • 11.0.0-rc.1                                ...           2 years ago
  • 11.0.0-rc.0                                ...           2 years ago
  • 10.7.3                                ...           2 years ago
  • 10.7.2                                ...           2 years ago
  • 10.7.1                                ...           2 years ago
  • 10.7.0                                ...           2 years ago
  • 10.6.0                                ...           2 years ago
  • 10.5.2                                ...           2 years ago
  • 10.5.1                                ...           2 years ago
  • 10.5.0                                ...           2 years ago
  • 10.4.0                                ...           2 years ago
  • 10.3.4                                ...           2 years ago
  • 10.3.3                                ...           3 years ago
  • 10.3.2                                ...           3 years ago
  • 10.3.1                                ...           3 years ago
  • 10.3.0                                ...           3 years ago
  • 10.2.2                                ...           3 years ago
  • 10.2.1                                ...           3 years ago
  • 10.2.0                                ...           3 years ago
  • 10.1.2                                ...           3 years ago
  • 10.1.1                                ...           3 years ago
  • 10.1.0                                ...           3 years ago
  • 10.0.2                                ...           3 years ago
  • 10.0.1                                ...           3 years ago
  • 10.0.0                                ...           3 years ago
  • 9.0.3                                ...           3 years ago
  • 9.0.2                                ...           3 years ago
  • 9.0.1                                ...           3 years ago
  • 9.0.0                                ...           3 years ago
  • 8.0.1                                ...           3 years ago
  • 8.0.0                                ...           3 years ago
  • 7.1.2                                ...           3 years ago
  • 7.1.1                                ...           3 years ago
  • 7.1.0                                ...           3 years ago
  • 7.0.1                                ...           3 years ago
  • 7.0.0                                ...           3 years ago
  • 6.3.2                                ...           3 years ago
  • 6.3.0                                ...           3 years ago
  • 6.2.0                                ...           3 years ago
  • 6.1.1                                ...           3 years ago
  • 6.1.0                                ...           3 years ago
  • 6.0.0                                ...           3 years ago
  • 5.8.0                                ...           3 years ago
  • 5.7.3                                ...           3 years ago
  • 5.7.2                                ...           4 years ago
  • 5.7.1                                ...           4 years ago
  • 5.7.0                                ...           4 years ago
  • 5.6.0                                ...           4 years ago
  • 5.5.0                                ...           4 years ago
  • 5.4.5                                ...           4 years ago
  • 5.4.4                                ...           4 years ago
  • 5.4.3                                ...           4 years ago
  • 5.4.2                                ...           4 years ago
  • 5.4.1                                ...           4 years ago
  • 5.4.0                                ...           4 years ago
  • 5.3.0                                ...           4 years ago
  • 5.2.0                                ...           4 years ago
  • 5.1.2                                ...           4 years ago
  • 5.1.1                                ...           4 years ago
  • 5.1.0                                ...           4 years ago
  • 5.0.1                                ...           4 years ago
  • 5.0.0                                ...           4 years ago
  • 4.0.0                                ...           4 years ago
  • 3.1.2                                ...           4 years ago
  • 3.1.1                                ...           4 years ago
  • 3.1.0                                ...           4 years ago
  • 3.0.0                                ...           4 years ago
  • 2.3.4                                ...           4 years ago
  • 2.3.3                                ...           4 years ago
  • 2.3.2                                ...           4 years ago
  • 2.3.1                                ...           4 years ago
  • 2.3.0                                ...           4 years ago
  • 2.2.1                                ...           4 years ago
  • 2.2.0                                ...           4 years ago
  • 2.1.1                                ...           4 years ago
  • 2.1.0                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.4.1                                ...           4 years ago
  • 1.4.0                                ...           4 years ago
  • 1.3.4                                ...           4 years ago
  • 1.3.3                                ...           4 years ago
  • 1.3.2                                ...           4 years ago
  • 1.3.1                                ...           4 years ago
  • 1.3.0                                ...           4 years ago
  • 1.2.1                                ...           4 years ago
  • 1.2.0                                ...           5 years ago
  • 1.1.4                                ...           5 years ago
  • 1.1.3                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.10                                ...           5 years ago
  • 1.0.8                                ...           5 years ago
  • 1.0.7                                ...           5 years ago
  • 1.0.6                                ...           5 years ago
  • 1.0.5                                ...           5 years ago
  • 1.0.4                                ...           5 years ago
  • 1.0.3                                ...           5 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
  • 1.0.0-beta.5                                ...           5 years ago
  • 1.0.0-beta.4                                ...           5 years ago
  • 1.0.0-beta.3                                ...           5 years ago
  • 1.0.0-beta.2                                ...           5 years ago
  • 1.0.0-beta.1                                ...           5 years ago
  • 1.0.0-beta.0                                ...           5 years ago
  • 0.7.1                                ...           5 years ago
  • 0.7.0                                ...           5 years ago
  • 0.6.0                                ...           5 years ago
  • 0.5.0                                ...           5 years ago
  • 0.4.13                                ...           5 years ago
  • 0.4.12                                ...           5 years ago
  • 0.4.11                                ...           6 years ago
  • 0.4.9                                ...           6 years ago
  • 0.4.8                                ...           6 years ago
  • 0.4.7                                ...           6 years ago
  • 0.4.6                                ...           6 years ago
  • 0.4.5                                ...           6 years ago
  • 0.4.4                                ...           6 years ago
  • 0.4.3                                ...           7 years ago
  • 0.4.2                                ...           7 years ago
  • 0.4.1                                ...           7 years ago
  • 0.4.0                                ...           7 years ago
  • 0.3.3                                ...           7 years ago
  • 0.3.2                                ...           7 years ago
  • 0.3.1                                ...           7 years ago
  • 0.3.0                                ...           7 years ago
  • 0.2.6                                ...           7 years ago
  • 0.2.5                                ...           8 years ago
  • 0.2.4                                ...           8 years ago
  • 0.2.3                                ...           8 years ago
  • 0.2.2                                ...           8 years ago
  • 0.2.1                                ...           8 years ago
  • 0.2.0                                ...           8 years ago
  • 0.1.4                                ...           8 years ago
  • 0.1.3                                ...           8 years ago
  • 0.1.2                                ...           8 years ago
  • 0.0.2                                ...           8 years ago
  • 0.1.1                                ...           8 years ago
  • 0.0.7                                ...           8 years ago
  • 0.0.6                                ...           8 years ago
  • 0.0.5                                ...           8 years ago
  • 0.0.4                                ...           8 years ago
  • 0.0.3                                ...           8 years ago
  • 0.0.1                                ...           8 years ago
  • 0.0.9                                ...           8 years ago
  • 0.0.8                                ...           8 years ago
  • 0.1.0                                ...           8 years ago
  • 0.0.14                                ...           8 years ago
  • 0.0.13                                ...           8 years ago
  • 0.0.12                                ...           8 years ago
  • 0.0.11                                ...           8 years ago
  • 0.0.10                                ...           8 years ago
Maintainers (1)
Downloads
Today 987
This Week 3,898
This Month 10,329
Last Day 1,042
Last Week 6,283
Last Month 33,727
Dependencies (42)
Dev Dependencies (0)
None
Dependents (577)

Copyright 2014 - 2016 © taobao.org |