diff --git a/doc/api/v8.md b/doc/api/v8.md index 5dec224d359168..2968c267dc6f87 100644 --- a/doc/api/v8.md +++ b/doc/api/v8.md @@ -223,6 +223,21 @@ v8.setFlagsFromString('--trace_gc'); setTimeout(() => { v8.setFlagsFromString('--notrace_gc'); }, 60e3); ``` +## `v8.takeCoverage()` + + + +The `v8.takeCoverage()` method allows the user to write the coverage started by +[`NODE_V8_COVERAGE`][] to disk on demand. This method can be invoked multiple +times during the lifetime of the process, each time the execution counter will +be reset and a new coverage report will be written to the directory specified +by [`NODE_V8_COVERAGE`][]. + +When the process is about to exit, one last coverage will still be written to +disk. + ## `v8.writeHeapSnapshot([filename])`