Expand description
V8 ScriptCoverage JSON parser and Istanbul-compatible normalizer.
This is the open-source layer of fallow’s runtime-coverage pipeline.
It performs the mechanical conversion from V8’s byte-offset-based coverage
format (as emitted by node --experimental-test-coverage, c8, the
Inspector protocol, or any V8 isolate) into the line/column-based
IstanbulFileCoverage shape that fallow’s CRAP scoring already
consumes.
The closed-source three-state cross-reference, combined scoring, hot-path
heuristics and verdict generation live in fallow-cov (private) and
consume this crate’s normalized output via the fallow-cov-protocol
envelope.
Structs§
- Coverage
Range - A single coverage range.
count == 0means the byte range was never hit. - Function
Coverage - V8 per-function coverage. Each function carries one or more
CoverageRanges — block-level for instrumented coverage, function-level for--coverage=best-effort. - Istanbul
File Coverage - Subset of the Istanbul
FileCoverageshape that fallow needs for CRAP scoring. We do not emit statement / branch maps because fallow only needs per-function call counts. - Istanbul
Function - Istanbul function descriptor.
- Istanbul
Position - 1-indexed line + 0-indexed column.
- Istanbul
Range - 1-indexed line/column range matching Istanbul’s
Range. - Line
Offset Table - Pre-computed line-start byte-offset table for converting V8 byte offsets into Istanbul line/column positions in O(log n) per lookup.
- Script
Coverage - V8’s per-script coverage record. Field names mirror the V8 inspector protocol verbatim.
- Script
Input - Input bundle to
normalize_script. - V8Coverage
Dump - Top-level shape emitted by Node’s
NODE_V8_COVERAGEdirectory: one file per worker / process containing aresultarray ofScriptCoverage.
Functions§
- normalize_
script - Convert one V8
ScriptCoverageentry into anIstanbulFileCoverage.