test: expand coverage for sources, helpers, and package entry#200
test: expand coverage for sources, helpers, and package entry#200alexander-akait merged 2 commits intomainfrom
Conversation
Add targeted tests that exercise previously untested branches and edge cases: the abstract `Source` base class, `SizeOnlySource`'s `updateHash`, `CompatSource`'s optional delegates, `RawSource`'s type validation and Buffer-backed source path, `OriginalSource`'s `getName` and Buffer-backed map path, `ConcatSource`'s `buffer()` fallbacks and re-optimization paths, `PrefixSource`'s accessors and empty-prefix handling, `ReplaceSource`'s accessors, guards, hash stability, and edge cases, `CachedSource`'s lazy source accessor, hash flushing, map-only streamChunks, and Buffer round-tripping, and `SourceMapSource`'s string/buffer source-map variants and hash inclusion of `removeOriginalSource`. Add a dedicated helpers unit test file covering `getGeneratedSourceInfo`, `getSource`, `splitIntoLines`, `splitIntoPotentialTokens`, `readMappings`, `getFromStreamChunks`, `streamAndGetSourceAndMap`, and `stringBufferUtils`, including string-interning toggles and gap filling for non-sequential source/name indices.
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #200 +/- ##
==========================================
+ Coverage 93.24% 98.07% +4.82%
==========================================
Files 25 25
Lines 1866 1866
Branches 595 596 +1
==========================================
+ Hits 1740 1830 +90
+ Misses 117 34 -83
+ Partials 9 2 -7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Store the freshly constructed CachedSource instances into a pre-sized sink array so V8 cannot dead-code-eliminate them and memory pressure stays consistent between samples. Overwriting existing slots (rather than push + length reset) keeps the sink's hidden class stable and avoids resize allocations during measurement. This reduces run-to-run variance that was surfacing as false codspeed regressions on this task.
Add targeted tests that exercise previously untested branches and
edge cases: the abstract
Sourcebase class,SizeOnlySource'supdateHash,CompatSource's optional delegates,RawSource'stype validation and Buffer-backed source path,
OriginalSource'sgetNameand Buffer-backed map path,ConcatSource'sbuffer()fallbacks and re-optimization paths,
PrefixSource's accessors andempty-prefix handling,
ReplaceSource's accessors, guards, hashstability, and edge cases,
CachedSource's lazy source accessor,hash flushing, map-only streamChunks, and Buffer round-tripping,
and
SourceMapSource's string/buffer source-map variants and hashinclusion of
removeOriginalSource. Add a dedicated helpers unittest file covering
getGeneratedSourceInfo,getSource,splitIntoLines,splitIntoPotentialTokens,readMappings,getFromStreamChunks,streamAndGetSourceAndMap, andstringBufferUtils, including string-interning toggles and gapfilling for non-sequential source/name indices.