1.0.1 • Published 3 years ago

tatt v1.0.1

Weekly downloads
53
License
AGPL-3.0-or-later
Repository
-
Last release
3 years ago

tatt all the things npm version

This is the tatt test module companion package for the Node.js runtime environment. Unlike Deno, Node can only resolve modules with file:// URLs. Crikey!

Usage

Installation

npm install tatt

Writing tests

The only thing that differs from the test module documentation is that you use a bare import for the API functions:

import { result, test } from 'tatt';

The test runner matches by file extension. If your package.json enables ECMAScript modules,

{
  "type": "module"
}

save your test suites with the extension .test.js, otherwise .test.mjs.

Running tests

The tatt executable is available in package.json npm scripts, e.g.

{
  "scripts": {
    "test": "tatt -s"
  }
}

Note: with the -s (for silent) flag, only the test summary and failing tests, if any, are printed to STDOUT.

Run the tests in your shell:

npm test

Note: test is an npm subcommand itself and does not need to be invoked with the run subcommand.

Another common use case is redirecting the full YAML test report from STDOUT to a file:

{
  "scripts": {
    "report": "tatt > report.yml"
  }
}

Generate the report in your shell:

npm run report

Add native test coverage

Install c8:

npm install c8

Use it in your npm script:

{
  "scripts": {
    "test": "c8 tatt -s"
  }
}

Inspect the test summary and coverage result in your shell:

npm test

More info: Rethinking JavaScript Test Coverage

License

GNU Affero General Public License

SPDX-License-Identifier: AGPL-3.0-or-later