Welcome to One Double Zero Documentation
This is the documentation for One Double Zero, the JavaScript code coverage tool aiming at accuracy, simplicity, flexibility and speed.
Prerequisites
- The command-line utility
odz
requires Node.js 18 or more.
Getting started
The recommended way to install One Double Zero is to install it globally from its npm package.
$ npm i one-double-zero -g
If all went well, you should be able to open a command prompt, and execute odz version
.
$ odz version
1.2.3
Once installed, the most basic way to use One Double Zero is to execute its included CLI odz
, passing it the command that needs to be executed.
odz npm run test
Doing such makes odz
execute the command npm run test
, and then compute the coverage for the source files that match the default glob pattern **/*.{js,mjs,jsx,ts,mts,tsx}
.
The glob patterns used by odz
to identify the source files are controlled by the sources
flag.
odz --sources=src/**/*.mts npm run test
In order to not have to pass the sources
flag on every execution of odz
, it is recommended to create a configuration file to hold the reusable configuration of odz
. This configuration file can be provided as a JSON file named .odzrc.json
, or a TOML file named .odzrc.toml
.
.odzrc.json
{
"sources": [
"src/**/*.mts"
]
}
.odzrc.toml
sources = [
"src/**/*.mts"
]
Going further
One Double Zero is powerful and flexible, and even comes with a JavaScript API. Please read the rest of this documentation to get to know it, starting from the Command line usage section.