test(web): close branch-coverage gaps in fetch + errors instrumentation#29
Merged
Merged
Conversation
The fetch and errors instrumentations had real suites but residual branch gaps. Cover them: - fetch.ts (branch 61.9% -> 90.5%, lines 100%): Headers-instance and array-of-tuples header merging, URL- and Request-object inputs, and the malformed-URL fallback in getPathname / the self-instrumentation guard. - errors.ts (branch -> 100%): the no-.error-object fallback to 'Error' (resource-load failures) and explicit file-path stripping in sanitize(). 77 tests in packages/web.
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.
Why
The roadmap listed
fetch.ts/vitals.ts/errors.ts/behavior.tsas "currently untested," but that note predated their suites — all four are actually covered. What remained were branch-coverage gaps in the two with real conditional logic.What
fetch.ts— branch 61.9% → 90.5%, lines 100%. Added:Headers-instance and array-of-tuples header merging (core to correcttraceparentinjection),URL-object andRequest-object inputs (both in fetch'sRequestInfo | URLsignature), and the malformed-URL fallback (getPathname+ the self-instrumentation guard).errors.ts— branch → 100%. Added: the no-.error-object fallback to'Error'(resource-load failures fireerrorwith no.error), and an explicit file-path-stripping assertion (the roadmap's "sanitize stack traces" guarantee).behavior.ts(95%/100%) andvitals.tswere already complete.Verification
77 tests in
packages/web, all green.