Commit add1724
authored
test(tar-xz): wrap defensive-unreachable branches with v8 ignore start/stop (#123)
Six call-sites are guarded by checks that TypeScript's strict mode
(noUncheckedIndexedAccess + typed errors) requires but cannot fire
at runtime under current invariants. Suppress them from coverage so
the metrics reflect only paths that real tests can exercise.
- file.ts: ELOOP on POSIX writeFile (O_NOFOLLOW vs ensureSafeTarget),
ENOENT on the unlink-after-failed-open race, EEXIST on the wx-retry
TOCTOU re-open, ENOENT on the unlink-before-link race for hardlinks,
and the Win32 best-effort chmod/utimes catch arms. All five mirror
the PR #114 Win32 TOCTOU hardening contract — the contract is
locked by the adversarial review and SECURITY.md scenarios; race
windows are too flaky for unit tests.
- tar-parser.ts: parseHeader === null after isEmptyBlock — the prior
empty-block check guarantees the header parses successfully.
- xz-helpers.ts: '!unxzStream.destroyed' early-return guard inside
the AsyncIterable's finally block — the fully-iterated path always
destroys before finally runs, so the falsy arm is only hit on early
generator.return() (not exercised by current tests; stream is
destroyed idempotently anyway).
- checksum.ts: compound parseOctal condition split so only the
noUncheckedIndexedAccess-required 'byte === undefined' arm is
suppressed. The reachable 'byte === 0 || byte === 0x20' continues
to count toward coverage.
Coverage delta on tar-xz: statements 82.05 -> 86.96; xz-helpers.ts
reaches 100. Real test cases for the still-uncovered EACCES,
filter, and malformed-archive paths will land in a follow-up PR.
707 tests pass byte-identical.1 parent 5e164e0 commit add1724
4 files changed
Lines changed: 21 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| 241 | + | |
241 | 242 | | |
| 243 | + | |
242 | 244 | | |
243 | 245 | | |
244 | 246 | | |
| |||
265 | 267 | | |
266 | 268 | | |
267 | 269 | | |
| 270 | + | |
268 | 271 | | |
269 | 272 | | |
270 | 273 | | |
| 274 | + | |
271 | 275 | | |
272 | 276 | | |
273 | 277 | | |
| |||
319 | 323 | | |
320 | 324 | | |
321 | 325 | | |
| 326 | + | |
322 | 327 | | |
| 328 | + | |
323 | 329 | | |
324 | 330 | | |
325 | 331 | | |
326 | 332 | | |
| 333 | + | |
327 | 334 | | |
328 | 335 | | |
329 | 336 | | |
| |||
332 | 339 | | |
333 | 340 | | |
334 | 341 | | |
| 342 | + | |
335 | 343 | | |
336 | 344 | | |
337 | 345 | | |
| |||
366 | 374 | | |
367 | 375 | | |
368 | 376 | | |
| 377 | + | |
369 | 378 | | |
370 | 379 | | |
371 | 380 | | |
372 | 381 | | |
373 | 382 | | |
| 383 | + | |
374 | 384 | | |
375 | 385 | | |
| 386 | + | |
376 | 387 | | |
377 | 388 | | |
378 | 389 | | |
379 | 390 | | |
380 | 391 | | |
| 392 | + | |
381 | 393 | | |
382 | 394 | | |
383 | 395 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
| 111 | + | |
110 | 112 | | |
111 | 113 | | |
112 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| 68 | + | |
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
90 | 93 | | |
91 | 94 | | |
92 | 95 | | |
| |||
0 commit comments