Commit 2aa162e3 authored by Bastien Roucariès's avatar Bastien Roucariès

Import node-tap_12.0.1+ds.orig.tar.gz

parents
/node_modules/
/coverage/
/.nyc_output/
/nyc_output/
language: node_js
sudo: false
node_js:
- 8
- 6
notifications:
email: false
Please see [the tap website](http://www.node-tap.org/changelog/) for
the curated changelog.
Please consider signing [the neveragain.tech pledge](http://neveragain.tech/)
- Check the [issues](https://github.com/tapjs/node-tap/issues) to see
stuff that is likely to be accepted.
- Every patch should have a new test that fails without the patch and
passes with the patch.
- All tests should pass on Node 0.8 and above. If some tests have to
be skipped for very old Node versions that's fine, but the
functionality should still work as intended.
- Run `npm run regen-fixtures` to re-generate the output tests
whenever output is changed. However, when you do this, make sure to
check the change to ensure that it's what you intended, and that it
didn't cause any other inadvertent changes.
- Prefer adding cases to an existing test rather than writing a new
one from scratch. For example, add a new test in `test/test/*.js`
rather than create a new test that validates test output.
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# node-tap
A <abbr title="Test Anything Protocol">TAP</abbr> test framework for
Node.js.
[![Build Status](https://travis-ci.org/tapjs/node-tap.svg?branch=master)](https://travis-ci.org/tapjs/node-tap)
_Just wanna see some code? [Get started!](http://www.node-tap.org/basics/)_
It includes a command line test runner for consuming TAP-generating
test scripts, and a JavaScript framework for writing such scripts.
* [Getting started guide](http://www.node-tap.org/basics/)
* Built-in [test coverage](http://www.node-tap.org/coverage/)
* Many [reporter formats](http://www.node-tap.org/reporting/)
* Extensive [API](http://www.node-tap.org/api/) featuring:
* Great [promise support](http://www.node-tap.org/promises/)
* Comprehensive [assert library](http://www.node-tap.org/asserts/)
* Other [advanced stuff](http://www.node-tap.org/advanced/)
* Mocha-like [BDD DSL](http://www.node-tap.org/mochalike/)
* [Parallel Testing](http://www.node-tap.org/parallel/)
* [Command-line interface](http://www.node-tap.org/cli/) for running
tests (whether they use node-tap or not)
See [the changelog](http://www.node-tap.org/changelog/) for recent updates, or just get
started with [the basics](http://www.node-tap.org/basics/).
All this is too much to manage in a single README file, so head over
to [the website](http://www.node-tap.org/) 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.
### <i lang="it">tutti i gusti sono gusti</i>
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](http://izs.me) 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 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](http://www.node-tap.org/tap-format/) should
be machine-parseable and human-intelligible, and a separate process
should consume test output and turn it into a [pretty summarized
report](http://www.node-tap.org/reporting/). 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 the you returns 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](https://istanbul.js.org/) for this.
It's not enabled by default only because it _does_ necessarily
change the nature of the environment a little bit. But I strongly
encourage [enabling coverage](http://www.node-tap.org/coverage/).
9. **Tests should be output in a predictable order.**
Even if they are run in parallel, the test _output_ should be
consistent.
As of version 10, tap supports [parallel
tests](http://www.node-tap.org/parallel/), which
can make your tests run significantly faster if they are I/O bound
or if you have multiple cores on your machine. However, even when
run in parallel, the output is still serialized.
10. **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](http://www.node-tap.org/promises/), but works on
any version of Node.js back to v0.10.
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](http://www.node-tap.org/basics/).
environment:
matrix:
- nodejs_version: '8'
- nodejs_version: '6'
- nodejs_version: '4'
install:
- ps: Install-Product node $env:nodejs_version
- set CI=true
- npm -g install npm@latest
- set PATH=%APPDATA%\npm;%PATH%
- npm install
matrix:
fast_finish: true
build: off
version: '{build}'
shallow_clone: true
clone_depth: 1
test_script:
- npm test -- -Rclassic --no-coverage --timeout=3600
#!/usr/bin/env node
'use strict'
const tap = require('../lib/tap.js')
const args = process.argv.slice(2)
if (args.length === 1) {
const path = require('path')
const file = path.resolve(args[0])
tap.mochaGlobals()
require(file)
} else {
for (let i = 0; i < args.length; i++) {
tap.spawn(process.execPath, [__filename, args[i]])
}
}
This diff is collapsed.
This diff is collapsed.
---
layout: layout
title: The TAP 100
---
# The TAP 100
These modules use the `--100` flag to run tests with 100%
[coverage](/coverage/) of all lines, branches, statements, and
functions.
To add yours to the list, send a [pull
request](https://github.com/tapjs/node-tap/blob/master/docs/100/index.md)
to add it to the docs.
* [abbrev](https://www.npmjs.com/package/abbrev)
* [casern](https://www.npmjs.com/package/casern)
* [color-support](https://www.npmjs.com/package/color-support)
* [contentfs](https://www.npmjs.com/package/contentfs)
* [dotenv](https://www.npmjs.com/package/dotenv)
* [events-to-array](https://www.npmjs.com/package/events-to-array)
* [express-jwt-permissions](https://www.npmjs.com/package/express-jwt-permissions)
* [fs-exists-cached](https://www.npmjs.com/package/fs-exists-cached)
* [fs-minipass](https://www.npmjs.com/package/fs-minipass)
* [fs-readstream-seek](https://www.npmjs.com/package/fs-readstream-seek)
* [function-loop](https://www.npmjs.com/package/function-loop)
* [hexagonal-lambda](https://github.com/focusaurus/hexagonal-lambda)
* [hoodie](https://www.npmjs.com/package/hoodie)
* [icepick](https://www.npmjs.com/package/icepick)
* [ignore-walk](https://www.npmjs.com/package/ignore-walk)
* [inflight](https://www.npmjs.com/package/inflight)
* [ini](https://www.npmjs.com/package/ini)
* [isexe](https://www.npmjs.com/package/isexe)
* [lru-cache](https://www.npmjs.com/package/lru-cache)
* [lucass](https://www.npmjs.com/package/lucass)
* [minipass](https://www.npmjs.com/package/minipass)
* [minizlib](https://www.npmjs.com/package/minizlib)
* [mutate-fs](https://www.npmjs.com/package/mutate-fs)
* [natives](https://www.npmjs.com/package/natives)
* [npm-bundled](https://www.npmjs.com/package/npm-bundled)
* [npm-packlist](https://www.npmjs.com/package/npm-packlist)
* [stack-utils](https://www.npmjs.com/package/stack-utils)
* [t-up](https://www.npmjs.com/package/t-up)
* [tap-parser](https://www.npmjs.com/package/tap-parser)
* [tap](/)
* [tapromise](https://www.npmjs.com/package/tapromise)
* [tapsert](https://www.npmjs.com/package/tapsert)
* [tapshot](https://www.npmjs.com/package/tapshot)
* [tar](https://www.npmjs.com/package/tar)
* [tmatch](https://www.npmjs.com/package/tmatch)
* [touch](https://www.npmjs.com/package/touch)
* [trivial-deferred](https://www.npmjs.com/package/trivial-deferred)
* [tsame](https://www.npmjs.com/package/tsame)
* [twing](https://www.npmjs.com/package/twing)
* [yallist](https://www.npmjs.com/package/yallist)
* [yapool](https://www.npmjs.com/package/yapool)
www.node-tap.org
source 'https://rubygems.org'
gem 'github-pages'
run:
bundle exec jekyll serve
title: "Node Tap"
description: A Test-Anything-Protocol library for Node.js
links:
- name: "Index"
url: "/"
- name: "Getting Started"
url: "/basics/"
- name: "API"
url: "/api/"
links:
- name: "Asserts"
url: "/asserts/"
- name: "Promises"
url: "/promises/"
- name: "Subtests"
url: "/subtests/"
- name: "Parallel Tests"
url: "/parallel/"
- name: "Snapshot Testing"
url: "/snapshots/"
- name: "Filtering Tests: grep"
url: "/grep/"
- name: "Filtering Tests: only"
url: "/only/"
- name: "Mocha-like DSL"
url: "/mochalike/"
- name: "Advanced"
url: "/advanced/"
- name: "CLI"
url: "/cli/"
- name: "The Protocol"
url: "/tap-format/"
- name: "Reporting"
url: "/reporting/"
- name: "Coverage"
url: "/coverage/"
- name: "Change Log"
url: "/changelog/"
- name: "GitHub Repo"
url: "https://github.com/tapjs/node-tap"
# Build settings
markdown: kramdown
markdown_ext: md
kramdown:
input: GFM
hard_wrap: false
syntax_highlighter: rouge
<!doctype html>
<title>
{% if page.title %}
{{ page.title }} | {{ site.title }}
{% else %}
{{ site.title }}
{% endif %}
</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
html {
display: block;
font-family: sans-serif;
padding: 0 1em;
margin: 0 auto;
border-top: 10px solid #f7df1e;
line-height:1.5;
color:#333;
position:relative;
}
html::before {
width:100%;
display:block;
position:fixed;
top:0;
left:0;
height:10px;
background:#f7df1e;
content: " ";
}
body {
padding:0;
margin: 0;
}
a:hover, a:active, a:focus {
color: red;
}
code, pre, kbd {
font-size: 100%;
font-family: Triplicate T4, Fira Mono OT, Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospacek;
}
section.side {
display: block;
padding:0;
min-height:100px;
margin: 0;
width:100%;
}
.side h2, .side p {
margin-top: 0;
}
section.side li {
display: inline;
}
section.side ul {
display: block;
overflow:auto;
}
section.side li ul {
display: inline;
}
.side ul {
padding:0;
margin:0 ;
}
.side img {
display: block;
margin-right: 1em;
margin-top: 1em;
}
section.main {
display: block;
padding-top:20px;
}
@media only screen and (min-width: 240px) {
.side img {
float:left;
margin: 0 1em 0 0;
}
}
@media only screen and (min-width: 800px) {
html {
width:600px;
padding:0 0 0 200px;
}
section.side {
width: 200px;
position: fixed;
margin: 0 0 0 -200px;
}
.side img {
display: block;
float:none;
}
section.side ul {
overflow: none;
display: block;
}
section.side li {
display: block;
}
section.side a {
display: block;
}
section.side li ul {
margin: 0;
display: block;
}
section.side li li {
margin-left: 1em;
}
.side h2, .side p {
margin-top: 1em;
}