Skip to main content

Crate fallow_v8_coverage

Crate fallow_v8_coverage 

Source
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§

CoverageRange
A single coverage range. count == 0 means the byte range was never hit.
FunctionCoverage
V8 per-function coverage. Each function carries one or more CoverageRanges — block-level for instrumented coverage, function-level for --coverage=best-effort.
IstanbulFileCoverage
Subset of the Istanbul FileCoverage shape that fallow needs for CRAP scoring. We do not emit statement / branch maps because fallow only needs per-function call counts.
IstanbulFunction
Istanbul function descriptor.
IstanbulPosition
1-indexed line + 0-indexed column.
IstanbulRange
1-indexed line/column range matching Istanbul’s Range.
LineOffsetTable
Pre-computed line-start table for converting V8 source offsets into Istanbul line/column positions in O(log n) per lookup.
ScriptCoverage
V8’s per-script coverage record. Field names mirror the V8 inspector protocol verbatim.
ScriptInput
Input bundle to normalize_script.
V8CoverageDump
Top-level shape emitted by Node’s NODE_V8_COVERAGE directory: one file per worker / process containing a result array of ScriptCoverage.

Functions§

normalize_script
Convert one V8 ScriptCoverage entry into an IstanbulFileCoverage.