summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorBenjamin Coe <bencoe@google.com>2019-09-20 11:43:02 -0700
committerAnna Henningsen <anna@addaleax.net>2019-09-22 00:39:41 +0200
commit8f06773a8cd73aef37ddc8f68d2c8202f1a8c45a (patch)
tree9fc55258099209d89e0eebdd2b6a45128da0f928 /doc
parente74f30894c46c94aa1329e8462f811b8d5e54a91 (diff)
downloadandroid-node-v8-8f06773a8cd73aef37ddc8f68d2c8202f1a8c45a.tar.gz
android-node-v8-8f06773a8cd73aef37ddc8f68d2c8202f1a8c45a.tar.bz2
android-node-v8-8f06773a8cd73aef37ddc8f68d2c8202f1a8c45a.zip
process: initial SourceMap support via NODE_V8_COVERAGE
PR-URL: https://github.com/nodejs/node/pull/28960 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: David Carlier <devnexen@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r--doc/api/cli.md62
1 files changed, 53 insertions, 9 deletions
diff --git a/doc/api/cli.md b/doc/api/cli.md
index 31e5540242..8a1ca4893a 100644
--- a/doc/api/cli.md
+++ b/doc/api/cli.md
@@ -1110,9 +1110,19 @@ variable is strongly discouraged.
### `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:
+When set, Node.js will begin outputting [V8 JavaScript code coverage][] and
+[Source Map][] data to the directory provided as an argument (coverage
+information is written as JSON to files with a `coverage` prefix).
+
+`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.
+
+#### Coverage Output
+
+Coverage is output as an array of [ScriptCoverage][] objects on the top-level
+key `result`:
```json
{
@@ -1126,13 +1136,46 @@ directory provided as an argument. Coverage is output as an array of
}
```
-`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.
+#### Source Map Cache
+
+> Stability: 1 - Experimental
+
+If found, Source Map data is appended to the top-level key `source-map-cache`
+on the JSON coverage object.
+
+`source-map-cache` is an object with keys representing the files source maps
+were extracted from, and the values include the raw source-map URL
+(in the key `url`) and the parsed Source Map V3 information (in the key `data`).
-At this time coverage is only collected in the main thread and will not be
-output for code executed by worker threads.
+```json
+{
+ "result": [
+ {
+ "scriptId": "68",
+ "url": "file:///absolute/path/to/source.js",
+ "functions": []
+ }
+ ],
+ "source-map-cache": {
+ "file:///absolute/path/to/source.js": {
+ "url": "./path-to-map.json",
+ "data": {
+ "version": 3,
+ "sources": [
+ "file:///absolute/path/to/original.js"
+ ],
+ "names": [
+ "Foo",
+ "console",
+ "info"
+ ],
+ "mappings": "MAAMA,IACJC,YAAaC",
+ "sourceRoot": "./"
+ }
+ }
+ }
+}
+```
### `OPENSSL_CONF=file`
<!-- YAML
@@ -1203,6 +1246,7 @@ greater than `4` (its current default value). For more information, see the
[Chrome DevTools Protocol]: https://chromedevtools.github.io/devtools-protocol/
[REPL]: repl.html
[ScriptCoverage]: https://chromedevtools.github.io/devtools-protocol/tot/Profiler#type-ScriptCoverage
+[Source Map]: https://sourcemaps.info/spec.html
[Subresource Integrity]: https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity
[V8 JavaScript code coverage]: https://v8project.blogspot.com/2017/12/javascript-code-coverage.html
[customizing esm specifier resolution]: esm.html#esm_customizing_esm_specifier_resolution_algorithm