test: close the per-file coverage gaps this PR opened

The layered-env reader gained an unreadable-layer path, a default
reporter, and two absent-layer arms with no cases; the credential store
gained two error paths that must not be mistaken for an absent file.

The platform arms and the `linePos` guard cannot be reached from a POSIX
test run — the first is covered by the native Windows job, the second
only satisfies an optional type that `prettyErrors` always fills — so
both carry a v8 ignore naming why.
This commit is contained in:
Yichen Jiang
2026-08-05 13:20:56 +08:00
parent f50b60390c
commit 69d8621e2e
5 changed files with 134 additions and 0 deletions

View File

@@ -250,6 +250,7 @@ export class SettingsLocal extends Settings {
throw new Error(`settings-local: invalid document at ${this.spec.filename}: ${
document.errors.map((error) => {
const at = error.linePos?.[0]
/* v8 ignore next -- `prettyErrors` populates linePos on every error; the guard answers its optional type */
return `${error.code}${at === undefined ? '' : ` at line ${String(at.line)}, column ${String(at.col)}`}`
}).join('; ')}`)
}