Commit 7c87610
authored
test(nxz): restore 100% coverage on memlimit.ts after parser refactor (#121)
The PR #120 extract-method refactor introduced three defensive paths
in parseSuffixed that vitest's v8 instrumentation flagged as
unreachable: the '?? ""' fallbacks on regex capture groups
(unreachable when exec returns non-null) and the 'mult === undefined'
guard (unreachable because the regex constrains the suffix to keys
present in the multiplier map).
- Replace 'match[1] ?? ""' and 'match[2] ?? ""' with 'as string'
type assertions: compile-time only, no runtime branch for v8 to
instrument, and not flagged by biome's noNonNullAssertion rule
(unlike non-null '!' which would re-introduce the lint warning we
resolved in PR #117 fix-round 1).
- Wrap the noUncheckedIndexedAccess-required mult-undefined guard
with /* v8 ignore start ... stop */: TypeScript strict mode demands
the check but the regex+map alignment makes it structurally
unreachable. Project convention is start/stop pairs (never 'next').
Coverage: lines 95.2 -> 100, branches 83.3 -> 100 on memlimit.ts.
707 tests still pass byte-identical.1 parent de60b8f commit 7c87610
1 file changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
| 43 | + | |
| 44 | + | |
45 | 45 | | |
| 46 | + | |
46 | 47 | | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
0 commit comments