diff --git a/doc/api/cli.md b/doc/api/cli.md index 637c1cd9050557..6b7d451d682d1c 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -625,6 +625,32 @@ Path to the file used to store the persistent REPL history. The default path is `~/.node_repl_history`, which is overridden by this variable. Setting the value to an empty string (`''` or `' '`) disables persistent REPL history. +### `NODE_V8_COVERAGE=dir` + +When set, Node.js will begin outputting [V8 JavaScript code coverage][] to the +directory provided as an argument. Coverage is output as an array of +[ScriptCoverage][] objects: + +```json +{ + "result": [ + { + "scriptId": "67", + "url": "internal/tty.js", + "functions": [] + } + ] +} +``` + +`NODE_V8_COVERAGE` will automatically propagate to subprocesses, making it +easier to instrument applications that call the `child_process.spawn()` family +of functions. `NODE_V8_COVERAGE` can be set to an empty string, to prevent +propagation. + +At this time coverage is only collected in the main thread and will not be +output for code executed by worker threads. + ### `OPENSSL_CONF=file`