--coverage-report
option to just the
built-in reporters.coveralls
is now an optional peer dep, not a regular dep, so it won't
be installed by defaultt.hasProp
, t.hasProps
, t.hasOwnProp
, and t.hasOwnProps
t.snapshotFile
Parser:
#
and \
characters-
and _
# skipped
as skip
tests, as
TAP13 specifiesUpdated treport to use react 17, new versions of ink and other internal deps, so that tap could work on node v17 and get quiet some security advisory nags.
This is a major refactor of much of tap's internals, and a lot of new features.
@std/esm
module, in favor of native ES Modules.typescript
by default. (Typescript still
supported, but requires that you install it yourself.).jsx
files only run automatically when --jsx
config is explicitly
enabled.--check-coverage
on by default.<10
.t.has
from t.match
, so these are distinct.only
or grep
options.t.test()
promise to the child test results, rather than the
parent test.callback
argument from t.beforeEach
and t.afterEach
. Return
a promise if you wish these methods to be async..cjs
.t.compareOptions
object to pass options to all the methods that use
tcompare
(ie, t.has
, t.match
, t.same
, etc.)t.before
method.t.mock()
API for mocking calls to require()
in modules being
tested.t.saveFixture
boolean option.FORCE_COLOR
and NO_COLOR
environment variables
appropriately.TS_NODE_COMPILER_OPTIONS
from test environment.t.teardown()
to minimize Windows
folder locking issues..taprc.yml
and .taprc.yaml
config files if present, and no
.taprc
is present.libtap
.nyc
to version 15.@@ ... @@
sections to only show the relevant
bits, making large object diffs much more manageable.undefined
.--before
and --after
options to the CLI.--test-regex
config so that a top-level test.js
or
tests.js
file will be included.t.hasStrict()
method.t.testdir()
and
t.fixture()
methods. See testing
with fixtures.t.error()
meta info so it can be shown in report
output.--no-coverage-map
config flag to turn off a previously-set
coverage-map
config.t.formatSnapshot
returning a non-string value.cls
repl command to clear the screenutil.inspect
.t.setTinmeout(n)
on the top-level tap object.--flow
tag to automatically strip flow
types from test files.--100
in .taprc and
package.json files. So, you can put "tap": { "100": true, "B": true }
in a package.json file and it will parse the option names as it would on
the command line.--ts
and --jsx
flags to control whether or not tap's built-in
TypeScript and JSX parsing should be used.--coverage-report
a list option, which can be set multiple times
to run multiple NYC coverage reports.*.cjs
as a JavaScript file extension.-
is explicitly set as a command line option,
regardless of whether stdin is a TTY or not.--watch
behavior.t.cleanSnapshot
and t.formatSnapshot
for customizing snapshot
formatting.Faster, prettier, and more powerful. Major enhancements and quite a few breaking changes. Most tests should continue to work fine, it's worth reading through this changelog if you use previous versions of tap more than casually.
The reporting engine has gotten a massive overhaul.
tap -R
my-reporter-module
works, whether that is a CLI program, a stream module, or
a treport-style React component.t.expectUncaughtException()
method, for testing that expected uncaught
exceptions are thrown.t.beforeEach
and t.afterEach
handlers.t.context
object which inherits from its parent test.t.throws()
returns the thrown error on success.t.resolveMatchSnapshot()
, and do not clutter up promise
resolving/rejecting assertion output with an extra subtest.t.teardown(fn)
handler functions can return a Promise to perform
asynchronous actions.t.beforeEach()
functions will no longer abort the entire
test process.--changed
(or -n
) to only run test files where the test file or one
of the covered files have been updated since the last test run.--watch
(or -w
) to watch test files and program for changes, running
relevant tests on each update.--show-process-tree
to have NYC show a
process tree.tap
is invoked
with no arguments and stdin
is a TTY.--snapshot
flag, or by naming an npm test snap
or snapshot
. So you can have "scripts":{"test":"tap","snap":"tap"}
in
package.json, and it'll do the right thing in both cases.--test-regex
and --test-ignore
options to control which files are
loaded by default if no args are provided. (Note that node_modules
and
.git
are always excluded by the default file lookup.)--test-env=key=value
option to set (or remove) environment variables in
tests.--jobs-auto
style parallelization, where the number of parallel
jobs defaults to the number of CPUs..jsx
and .tsx
files, using
import-jsx and TypeScript's built-in JSX
capabilities..tap
files by catting them.check-coverage
at 100% will come in v14.)tap
object in package.json.taprc
file from the current working directory, not from $HOME
.async_hooks
with
async-hook-domain for error trapping.preprocess
event so extensions and reporters can tinker with
process options.Add support for ES Modules in all tap test scripts using esm
.
Add support for loading typescript .ts
files with ts-node
.
Add support for loading .mjs
files with the experimental module
syntax flag set.
Add --comments
to print all t.comment()
messages to stderr.
Add TAP_CHILD_ID
in the environment of test scripts, so that they
can differentiate themselves when spinning up servers and such.
Updates to make tap compatible with running in web browsers using browserify or webpack.
Breaking change to support deep matching and pattern matching of
objects in Set
collections. (Previously, Set
contents would only
match if they were equal.)
Significant refactoring and speed improvements.
Add t.skip()
and
t.todo()
methods.
Add
t.resolves(promise)
to assert that a Promise object (or function that returns a Promise)
will resolve.
Add t.resolveMatch(promise,
pattern)
to assert that a Promise object (or function that returns a Promise)
will resolve to a value matching the supplied pattern.
Add support for snapshot testing.
Improved implementation of Mocha-like DSL
new
.(unnamed test)
t.current()
method is removedAdd support for filtering tests using 'only'.
Don't show grep/only skips in the default reporter output.
Add support for filtering tests using regular expressions.
Add support for Maps and Sets in t.match()
, t.same()
, and
t.strictSame()
.
Add
t.rejects()
assertion.
-o
--output-file
to put the raw TAP to a file.Variety of minor cleanup fixes, and a debug mode.
Added support for source maps. Stack traces in your jsx and coffeescript files will now be helpful!
Added the -J
option to auto-calculate the number of cores on your
system, and run that many parallel jobs.
Full rewrite to support parallel tests. Pass -j4
on
the command-line to run 4 test files at once in parallel.
This also refactors a lot of the grimier bits of the codebase, splits the one mega-Test class into a proper OOP hierarchy, and pulls a bunch of reusable stuff out into modules.
Somehow, in the process, it also fixed an odd timing bug with
beforeEach
functions that returned promises.
It truly is a luxury to have a massive pile of tests when it's time to refactor.
The mocha-like DSL is now much more functional, and documented.
Now supports passng -T
or --timeout=0
to the CLI to not
impose a timeout on tests.
Buffered subtests!
This adds support for outputting subtests in the buffered format, where the summary test point precedes the indented subtest output, rather than coming afterwards.
This sets the stage for parallel tests, coming in v10. Mostly, it's just an update to tap-parser, and a lot of internal clean-up.
Update nyc to v10, which includes some fixes for covering newer JavaScript language features, and support for implicit function names.
Also: remove a lot of excess noise and repetitive stack traces in yaml diagnostics.
Update tmatch
to version 3. This makes regular expressions test
against the stringified versions of the test object in all t.match()
methods. It's a breaking change because it can cause tests to pass
that would have failed previously, or vice versa. However, it is more
expected, and strongly recommended.
Handle unfinished promise-awaiting tests when the process exits.
Show yaml diagnostics for the first "missing test" failure when a plan is not met, so that the plan can be more easily debugged. (Diagnostics are still excluded for the additional "missing test" failures that are generated, to reduce unnecessary noise.)
Make coverage MUCH FASTER by turning on nyc caching.
Remove a race condition in how Bail out!
messages got printed when
setting the "bail on failure" option in child tests. Now, whether
it's a child process or just a nested subtest, it'll always print
Bail out!
at the failure level, then again at the top level, with
nothing in between.
Support { diagnostic: false }
in the options object for failing
tests to suppress yaml diagnostics.
Diagnostics are now shown when a synthetic timeout
failure is
generated for child test processes that ignore SIGTERM
and must be
killed with SIGKILL
.
Move # Subtest
commands to the parent level rather than the child
level, more like Perl's Test2
family of modules. This is more
readable for humans.
Update to version 2 of the tap parser. (This adds support for putting
the # Subtest
commands at the parent level.)
Support use of a --save
and --bail
together. Any test files that
were skipped due to a bailout are considered "not yet passed", and so
get put in the save file.
Forcibly kill any spawned child process tests when the root test exits the parent process, preventing zombie test processes.
Handle SIGTERM
signals sent to the main process after the root test
has ended. This provides more useful output in the cases where the
root test object has explicitly ended or satisfied its plan, but a
timeout still occurs because of pending event loop activity.
Prevent for..in
loops from iterating inherited keys in many cases,
providing resilience against Object.prototype
mutations.
Add the --100
flag to set statements, functions, lines, and branches
to 100% coverage required.
Let t.doesNotThrow
take a string as the first argument.
Bump nyc
up to version 7.
The tap lib/
folder is excluded from all stack traces.
Add the --test-arg=<argument>
option.
Add support for {diagnostic: true}
in test and assert options, to
force a YAML diagnostic block after passing child tests and
assertions.
Only produce output on stdout if the root TAP test object is
interacted with in some way. Simply doing require('tap')
no longer
prints out the minimum TAP output, which means that you can interact
with, for example, var Test = require('tap').Test
without causing
output side effects.
Add ~/.taprc
yaml config file support.
Add the --dump-config
command line flag to print out the config
options.
Document environment variables used.
Built-in CodeCov.io support has been removed. If you were relying on this, you
can add codecov
as a devDependency, and then add "posttest": "tap
--coverage-report=lcov | codecov"
to the scripts
section in your
package.json file.
Make coverage piping errors non-fatal.
Clean up argument ordering logic in t.throws()
. This now works for
almost any ordering of arguments, which is unfortunately necessary for
historical reasons. Additionally, you can now pass in an Error
class to verify the type, which would previously not work properly in
some cases.
Report timeout errors in child test scripts much more diligently.
On Unix systems, the child process handles SIGTERM
signals by
assuming that things are taking too long, dumping a report of all
active handles and requests in process, and exiting in error.
On Windows systems (where SIGTERM
is always uncatchably fatal), or
if a Unix child test process doesn't exit within 1 second (causing a
fatal SIGKILL
to be sent), the parent generates more comprehensive
output to indicate that the child test exited due to a timeout.
Update tmatch
to version 2. You can now test objects by supplying
their constructor, so t.match(x, { foo: Function, name: String })
would verify that the object has a name
string and a foo
method.
Add the t.assertAt
and t.assertStack
properties, to override where
an assertion was effectively called from.
Support passing in a class to t.throws
, rather than an Error sample
object.
Return a Promise
object from t.test()
, t.spawn()
, and
t.stdin()
.
Adds t.beforeEach()
and t.afterEach()
.
All about the cli flags!
Support --node-arg=...
and --nyc-arg=...
command line flags.
Add support for coverage checking using --statements=95
etc.
Test for executable-ness more consistently across platforms.
Make it impossible to try/catch
out of plan/end abuses. Calling
t.end()
more than once, or having a number of tests that doesn't
match the plan()
number, is always a failure.
Push thrown errors to the front of the action queue. This means that, even if other things are pending, an uncaught exception or a plan/end bug, will always take the highest priority in what gets output.
Many updates to nyc, spawn-wrap, and foreground-child, so that tap now reliably works on Windows (and a ci to prove it.)
Moved into the tapjs org.
Raise an error if t.end()
is explicitly called more than once. This
is a breaking change, because it can cause previously-passing tests to
fail, if they did t.end()
in multiple places.
Support promises returned by mochalike functions.
Support sending coverage output to both codecov.io and coveralls.io.
Upgrade to nyc 5. This means that config.nyc.exclude
arrays in
package.json
now take globs instead of regular expressions.
Use the name of the function supplied to t.test(fn)
as the test name
if a string name is not provided.
Better support for sparse arrays.
Add support for Codecov.io as well as Coveralls.io.
Catch failures that come after an otherwise successful test set.
Fix timing of t.on('end')
so that event fires before the next
child test is started, instead of immediately after it.
t.throws()
can now be supplied a regexp for the expected Error
message.
Exit in failure on root test bailout.
Support promises returned by t.test(fn)
function.
Update matching behavior using tmatch. This
is a breaking change to t.match
, t.similar
, t.has
, etc., but
brings them more in line with what people epirically seem to expect
these functions to do.
Deal with pending handles left open when a child process gets a
SIGTERM
on timeout.
Remove domains in favor of more reliable and less invasive state and error-catching bookkeeping.
Add t.contains()
alias for t.match()
.
Use deeper
for deep object similarity testing.
Treat unfinished tests as failures.
Add support for pragmas in TAP output.
Bind all Test methods to object.
Add t.tearDown()
, t.autoend()
, so that the root export is Just
Another Test Object, which just happens to be piping to stdout.
Support getting an error object in bailout()
Better support for exit status codes.
Add coverage using nyc.
If a COVERALLS_REPO_TOKEN
is provided, then run tests with coverage,
and pipe to coveralls.
Complete rewrite from 0.x.
Child tests implemented as nested TAP output, similar to Perl's
Test::More
.
The 0.x versions used a "flattened" approach to child tests, which requires some bookkeeping.
It worked, mostly, but its primary success was inspiring tape and tap v1 and beyond.