1+ # Coverage reports
2+
3+ ## Caveat
4+
5+ Unfortunately, until we are capable of using Node.js's builtin ESM support as
6+ well as implementing source maps in all of our source-to-source transforms (such
7+ as ` @agoric/bundle-source ` , ` @agoric/transform-metering ` , and
8+ ` @agoric/static-module-record ` ), the coverage line numbers will be out-of-sync
9+ with reality.
10+
11+ ## Reports
12+
113Coverage reports for the current main branch are published by CI to:
214https://agoric-sdk-coverage.netlify.app
315
@@ -7,8 +19,24 @@ You can create a report in any package (including the top-level directory):
719# Get options available for coverage:
820yarn c8 --help
921# Run ava under Node.js coverage and display a summary:
10- yarn c8 ava
22+ yarn c8 -a ava
1123# Generate a nice, detailed HTML report:
12- yarn c8 report --reporter=html-spa --reports-dir=coverage/html
24+ yarn c8 report --reporter=html-spa
1325open coverage/html/index.html
1426```
27+
28+ ## Planned Implementation
29+
30+ Our runtime source transforms can be conditional on the ` $NODE_V8_COVERAGE `
31+ environment variable, which is set by ` c8 ` .
32+
33+ When that is nonempty, source transforms can implement special behaviour to
34+ preserve source maps for transformed code. This involves using a `//#
35+ sourceURL=...` tag to associate a unique URL to an actual existing file during
36+ ` eval ` . The file's contents include a ` //# sourceMappingURL=... ` , whether a
37+ relative URL (taken from ` sourceURL ` ) to a ` .js.map ` file or inline as a ` data: `
38+ URI.
39+
40+
41+ The ` sourceMappingURL ` source map must contain a ` "sources" ` property as a
42+ relative or absolute URL to the input source file.
0 commit comments