Skip to content

Drop coverage entries whose source-mapped path does not exist - #35

Merged
NullVoxPopuli merged 3 commits into
mainfrom
nvp/34
Aug 11, 2026
Merged

NullVoxPopuli merged 3 commits into
mainfrom
nvp/34

Conversation

@NullVoxPopuli

Copy link
Copy Markdown
Owner

Fixes #34

route-recognizer ships a source map whose sources are bare relative paths (route-recognizer/dsl.ts, …). When chained into the app bundle, v8-to-istanbul resolves those against the bundle's own directory, producing absolute paths inside the project root that point at no file — so they slipped past the node_modules/project-root filter.

toIstanbul() emits an entry for every source in a 1:many map regardless of whether V8 data reached it, which is why they showed up with bogus percentages, and why the HTML reporter rendered an ENOENT stack trace in place of the source.

Fix: skip coverage entries whose resolved path doesn't exist on disk, logging each drop to coverage-debug.log. Such a path was never reportable — the HTML/lcov reporters need to read it, and reconcileWithOriginalSource already bails on it.

Adds a unit test that builds a fixture bundle + source map with one real source and one bare-relative route-recognizer/dsl.ts source; it fails without the fix.

🤖 Generated with Claude Code

Packages like route-recognizer ship source maps with bare relative
`sources` ("route-recognizer/dsl.ts"). v8-to-istanbul resolves those
against the bundle's directory, producing paths inside the project root
that point at no file. They passed the node_modules filter and landed in
the report with meaningless numbers, and the HTML reporter rendered an
ENOENT stack trace instead of source.

Fixes #34

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Coverage reports

Scenario Artifact
v2-addon-js coverage-v2-addon-js.zip
vite-app-js coverage-vite-app-js.zip
vite-app-using-v2-addon-js coverage-vite-app-using-v2-addon-js.zip

Each artifact is the scenario's coverage/ folder (HTML report, text/JSON summaries, raw V8 snapshot). Unzip and open index.html.

From this CI run for 3b6b065.

NullVoxPopuli and others added 2 commits August 11, 2026 18:40
Each scenario now checks that nothing from node_modules is reported, and
that every reported file exists on disk. Workspace packages are exempt
from the first check by realpath: pnpm symlinks v2-addon-js into the
consuming app's node_modules, but it resolves back into this repo.

vite-app-js gains route-recognizer as a real, test-exercised dependency —
the package from #34 — so the filter has third-party coverage data to
actually reject.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`oxfmt` is pinned to `latest`, so CI installs a newer version than the
lockfile records. 0.63 collapses an object whose only content is a block
comment onto one line, which made `pnpm format:check` fail on main. Give
the example a real option so it stays multi-line and readable either way.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@NullVoxPopuli NullVoxPopuli added the bug Something isn't working label Aug 11, 2026
@NullVoxPopuli
NullVoxPopuli merged commit 75ea5a2 into main Aug 11, 2026
3 checks passed
@NullVoxPopuli
NullVoxPopuli deleted the nvp/34 branch August 11, 2026 23:19
@github-actions github-actions Bot mentioned this pull request Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Files from route-recognizer are showing up in coverage reports (kind of)

1 participant