Node TAP (original) (raw)
@tapjs
Workspace for node-tap development.
Dev Commands
Do this at least once to get everything set up and ready to go:
npm run bootstrap
(Note: npm install
will not work until you do this, because the generated TypeScript eats its own tail.)
Build the test class (required after any plugin or core changes):
npm run build
Any other builds:
npm run prepare -w src/{whatever}
After adding or removing workspaces:
npm i
Run all tests in all workspaces:
npm test
Run all tests, saving snapshots:
npm run snap
Build and serve docs:
npm start
Contents
- tap The main entry point module, which sets up the root test runner and exposes an alias to the cli runner.
- tap-parserThe module that parses TAP
- @tapjs/coreMost of the basic moving parts of tap
- tap-yamlThin wrapper around YAML andyaml-types for consistent handling of JavaScript values in YAML diagnostics.
- @tapjs/testThe plugin-ified
Test
class. - @tapjs/configHandling config files, command line interface parsing, environment variables, and validation
- @tapjs/runThe command line runner
- tcompareThe library that does comparison and object formatting (use heavily by
@tapjs/asserts
methods). - @tapjs/stackLibrary for capturing stack frames, the descendant of
stack-utils
. - @tapjs/processinfoThe library that tracks process information and code coverage (hosted outside the monorepo, because it can't be tested by a version of tap that uses itself without bootstrap paradoxes)
- default plugins:
- @tapjs/typescriptAdds typescript support, and the
--typecheck
config option - @tapjs/beforeAdds
t.before()
- @tapjs/before-eachAdds
t.beforeEach()
- @tapjs/afterAdds
t.after()
andt.teardown()
(which are the same thing now) - @tapjs/after-eachAdds
t.afterEach()
- @tapjs/spawnAdds
t.spawn()
- @tapjs/stdinAdds
t.stdin()
- @tapjs/assertsAdds all the various assertion methods, like
t.equal()
,t.match()
, etc. - @tapjs/snapshotAdds
t.matchSnapshot()
- @tapjs/fixtureAdds
t.testdir()
features - @tapjs/mockAdds
t.mockRequire()
andt.mockImport()
- @tapjs/interceptAdds
t.intercept()
andt.capture()
functionality (sort of like a very scaled-down minimal form of Sinon. If you want more, consider using the@tapjs/sinon
plugin.) - @tapjs/filterAdds
t.only()
and support for the--grep
and--only
cli options.
- @tapjs/typescriptAdds typescript support, and the
- optional plugins:
- @tapjs/nockOptional plugin providing
t.nock()
method (descendent of@npmjs/tap-nock
, and a significant inspiration for tap's plugin architecture) - @tapjs/clockOptional plugin providing aclock-mock object on
t.clock
- @tapjs/sinonOptional plugin providing a Sinonsandbox at
t.sinon
that automatically restores at the end of the test. - @tapjs/esbuild-kitOptional plugin that loads TypeScript using@esbuild-kit/cjs-loaderand@esbuild-kit/esm-loaderinstead ofts-node.
- @tapjs/nockOptional plugin providing
- other stuff:
- npm-init-templateA library for more easily creating
npm init
packages. This will move out as soon as this version of tap is published. - @tapjs/create-pluginAn
npm init
library facilitatingnpm init @tapjs/plugin
to create new plugins.
- npm-init-templateA library for more easily creating
Bootstrap and skipLibCheck
Run npm run bootstrap
to build the @tapjs/test
module with the default set of plugins, so that the other libraries can build properly. (This only has to be done once, unless the build script or set of default plugins are changed, of course.)
Because there's a bootstrapping cycle between @tapjs/core
,@tapjs/test
, and all of the plugins, they MUST useskipLibCheck: true
in their tsconfigs. It should not be used in other packages.