fix(coverage): keep merged v8 coverage scoreable (wrapper length + async branch counts)

Merged
TH
2mo ago
+706-11

Summary

check:coverage-crap reported six source files as Unscored: merged v8 coverage carried hit
counts no execution can produce, and fallow refuses a map containing one. Both causes are upstream,
so they ship as pnpm patch entries pending a release.

  • @vitest/coverage-v8 resolved a module's script wrapper length from whichever coverage file it
    read last. A worker whose dynamic import is still in flight reports 0 — also the real length of
    an unwrapped script — so read order decided whether a module was shifted by the wrapper or split
    into two bodies 209 bytes apart. It now reports an explicit unknown; the provider resolves one
    length per URL per group, and marks a module nobody measured invalid, not zero.
  • ast-v8-to-istanbul counted an unlocatable branch path as "region the node covers minus located
    paths". After an await, V8 counts a continuation on the awaited path, so a located path can
    out-count its own region and the subtraction goes negative. The branch now publishes its located
    paths only, as v8-to-istanbul does.

check:coverage-crap:test now pins both fixes against a dependency bump, and the Unscored: line
names its causes as examples instead of blaming vitest#11541.

Validation

test:coverage + check:coverage-crap --all: zero impossible counters, all six files scored, no
Unscored line. check:coverage-crap:test and check:affected --run pass on head. Reverting the
converter patch alone fails 4 new tests; sync and plain-await cases still pass. Path-free repros
for both upstream repos are ready locally, not posted.

Part of #3425, itself part of #3414