test(codelldb-common): hermetic source-map-derive tests — no g++, no skips - #415
Merged
Conversation
…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 Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.tsgated 5 of its 7 tests onhasGpp() && 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 withfs.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: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 theisDir/isFileprobes stay honest. Zero mocks, nog++, no skips, no platform gate — the 60 sbeforeAllcompile (which exceeded the unit project's 15 s timeout budget) is gone; the suite runs in ~50 ms./@/<hash>decoration stripping, system-dir filtering, comp_dir evidence weighting/ranking,MAX_ENTRIEScap with 4 ranked prefixes, trailing-separator normalization, implausible/short/dot-relative string filters, degenerate-candidate guards, empty file.Coverage (this file)
Residue: the
readSyncshort-read guard and a bump-conflict arm — unreachable without pathological I/O.Full
npm testgreen,npm run lintclean.🤖 Generated with Claude Code