A simple CLI to run Node.js and report code coverage.
^14.17.0 || ^16.0.0 || >= 18.0.0
.coverage-node
no longer skips code coverage and logs a warning for Node.js versions < v13.3 that produce unreliable coverage data as they are no longer supported.coverageSupported.mjs
coverageSupportedMinNodeVersion.mjs
jsconfig.json
:
compilerOptions.maxNodeModuleJsDepth
to 10
.compilerOptions.module
to nodenext
.actions/checkout
to v3.actions/setup-node
to v3.ALLOW_MISSING_COVERAGE
environment variable can now be used with the coverage-node
CLI to prevent missing coverage from causing the process to exit with code 1
, via #2.reportCliError
function now explicitly calls .toString()
for errors that don’t have a stack
property.kleur
chaining API.replace-stack-traces
dev dependency in tests.^12.22.0 || ^14.17.0 || >= 16.0.0
.files
and exports
fields../package
from the package exports
field; the full package.json
filename must be used in a require
path./public/
.types
script.jsdoc-md
dev dependency and the related package scripts, replacing the readme “API” section with a manually written “Exports” section.CliError
class tests.CLiError
constructor arguments.singleQuote
to the default, false
.license.md
MIT License file.^12.20 || >= 14.13
..mjs
files instead of CJS in .js
files, accessible via import
but not require
.package.json
exports
field public subpath folder mapping (deprecated by Node.js) with a subpath pattern.jsdoc-md
v10 automatically generates a Prettier formatted readme.u
mode.hard-rejection
to detect unhandled Promise
rejections in tests, as Node.js v15+ does this natively.replaceStackTraces
.actions/checkout
to v2.actions/setup-node
to v2.CI
environment variable as it’s set by default.kleur
dependency causes subtle differences in which environments get colored console output.coverage-node
CLI errors.npm install-test
command.npm-debug.log
from the .gitignore
file as npm v4.2.0+ doesn’t create it in the current working directory.coverage-node
CLI error message when coverage is enabled.FORCE_COLOR
environment variable in tests to ensure output is colorized.snapshot-assertion
dev dependency to snapshot test CLI output.stripStackTraces
test helper with a smarter replaceStackTraces
helper that allows tests to detect a missing stack trace.spawnSync
from the Node.js child_process
API instead of the execFilePromise
helper in tests.coverage-node
CLI tests.^10.17.0 || ^12.0.0 || >= 13.7.0
.exports
field with conditional exports to support native ESM in Node.js and keep internal code private, whilst avoiding the dual package hazard. Published files have been reorganized, so previously undocumented deep imports will need to be rewritten according to the newly documented paths.keywords
field.process.argv
into the coverageNode
function scope.hard-rejection
dev dependency to ensure unhandled rejections in tests exit the process with an error.assert
imports.execFilePromise
helper from the /lib
directory to /test
, reducing the install size.