Skip to content

test(codelldb-common): hermetic source-map-derive tests — no g++, no skips - #415

Merged
debugmcpdev merged 1 commit into
mainfrom
test/source-map-derive-hermetic
Aug 22, 2026
Merged

test(codelldb-common): hermetic source-map-derive tests — no g++, no skips#415
debugmcpdev merged 1 commit into
mainfrom
test/source-map-derive-hermetic

Conversation

@debugmcpdev

Copy link
Copy Markdown
Collaborator

Part of the coverage-expansion sprint (leaderboard leader: source-map-derive at 8%).

The 8% was a Windows-local artifact — and the fix removes the artifact everywhere

source-map-derive.test.ts gated 5 of its 7 tests on hasGpp() && process.platform !== 'win32', so on any Windows box (and any machine without g++) only the two error-prologue tests ran — 10 of 134 statements. But the module never needs a compiler: it byte-scans the binary for NUL-terminated printable path strings and probes the workspace with fs.statSync. A synthetic buffer of embedded strings is indistinguishable from a DWARF-bearing binary to this scanner.

Change (tests only; zero production changes)

Full rewrite of packages/codelldb-common/tests/source-map-derive.test.ts:

  • Fixture: makeFixtureBinary(strings) writes NUL-separated embedded strings wrapped in non-printable noise to a real temp file; makeWorkspace(files) builds a real temp dir tree so the isDir/isFile probes stay honest. Zero mocks, no g++, no skips, no platform gate — the 60 s beforeAll compile (which exceeded the unit project's 15 s timeout budget) is gone; the suite runs in ~50 ms.
  • All 7 original test intents ported (mirror-layout mapping, no-op under workspace, nothing-matches, nonexistent/directory binary, root-rename, cargo-style project-subdir), plus 12 new cases: longest-suffix-wins discrimination, Windows drive-letter host paths (now testable on every platform — the Windows-ness lives in the embedded string), rustc stdlib skip, rustc /@/<hash> decoration stripping, system-dir filtering, comp_dir evidence weighting/ranking, MAX_ENTRIES cap with 4 ranked prefixes, trailing-separator normalization, implausible/short/dot-relative string filters, degenerate-candidate guards, empty file.

Coverage (this file)

before after
statements 10/134 (7.5%) 132/134 (98.5%)
branches 1/85 78/85
functions 1/14 14/14

Residue: the readSync short-read guard and a bump-conflict arm — unreachable without pathological I/O.

Full npm test green, npm run lint clean.

🤖 Generated with Claude Code

…skips

The old fixture compiled a real binary with g++, permanently skipping 5 of
7 tests on Windows (and anywhere without g++) — the module sat at 7.5%
statement coverage locally while spending up to 60s compiling in a
15s-timeout project. The scanner only looks for NUL-terminated printable
path strings, so a synthetic buffer plus a real temp workspace is an
equally valid fixture: 19 tests, ~50ms, every platform, zero mocks.
source-map-derive.ts: 7.5% -> 98.5% statements, 14/14 functions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@debugmcpdev
debugmcpdev merged commit 9ef6b61 into main Aug 22, 2026
10 checks passed
@debugmcpdev
debugmcpdev deleted the test/source-map-derive-hermetic branch August 22, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants