From 47026747a23fcd3bcff2eb2e224a022bf0d855e4 Mon Sep 17 00:00:00 2001 From: Bob Killen Date: Mon, 26 Oct 2026 14:27:05 -0500 Subject: [PATCH] chore(coverage): v8-ignore getErrorDetails' bundle-unreachable object folds @octokit/request wraps every rejection the bundle can see in a RequestError carrying a numeric status and a string message, so the status-less and message-less object arms of getErrorDetails (auth.ts:15-17) cannot be reached through dist/index.js; auth.test.ts drives them. Ignore each statement as a whole: an arm-level hint leaves the && short-circuit branch reported. coverage-e2e now names only the documented phantom branch, which moved from auth.ts:220 to :225. Supersedes #553, which reached these arms only by patching globalThis.fetch in the bundle child to throw a plain object from response.status. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Bob Killen --- dist/index.js | 5 +++++ docs/contributing.md | 2 +- src/utils/auth.ts | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index b034fa09..f71cb11d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -42350,7 +42350,12 @@ function baseBranchTip(octokit, context, branch) { function getErrorDetails(error) { if (typeof error === 'object' && error !== null) { + // @octokit/request wraps every rejection the bundle can see in a RequestError, which always carries a + // numeric status and a string message; the status-less and message-less arms are reached only by + // hand-built objects, so each statement is ignored as a whole (an arm-level hint leaves the && branch) + /* v8 ignore next -- status-less object arm unreachable from dist/index.js; auth.test.ts drives it */ const status = 'status' in error ? error.status : 'unknown'; + /* v8 ignore next -- message-less object arm unreachable from dist/index.js; auth.test.ts drives it */ const message = 'message' in error && typeof error.message === 'string' ? error.message : String(error); diff --git a/docs/contributing.md b/docs/contributing.md index 075aa352..5f1ccc83 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -61,7 +61,7 @@ check then proves that the bundle the harness just exercised matches `src/`. ### Phantom "uncovered" branches after an `await` The unit run lists four branches as uncovered that every test run in fact -drives: `close.ts:39`, `reopen.ts:36`, `approve.ts:504` and `auth.ts:220` +drives: `close.ts:39`, `reopen.ts:36`, `approve.ts:504` and `auth.ts:225` (it reports 1652/1656 branches because of them; the e2e run repeats the last two). Each is an `if` with no `else` whose condition was assigned from an expression in which an `await` is only sometimes reached (`a || (await b())`, diff --git a/src/utils/auth.ts b/src/utils/auth.ts index f5d5d1f9..63afe923 100644 --- a/src/utils/auth.ts +++ b/src/utils/auth.ts @@ -12,7 +12,12 @@ import { loadPullRequestOwners } from './pullRequestOwners' function getErrorDetails(error: unknown): { status: unknown, message: string } { if (typeof error === 'object' && error !== null) { + // @octokit/request wraps every rejection the bundle can see in a RequestError, which always carries a + // numeric status and a string message; the status-less and message-less arms are reached only by + // hand-built objects, so each statement is ignored as a whole (an arm-level hint leaves the && branch) + /* v8 ignore next -- status-less object arm unreachable from dist/index.js; auth.test.ts drives it */ const status = 'status' in error ? error.status : 'unknown' + /* v8 ignore next -- message-less object arm unreachable from dist/index.js; auth.test.ts drives it */ const message = 'message' in error && typeof error.message === 'string' ? error.message