Skip to content

Test coverage gap: bin/utils/error.ts (PakeError / isPakeError) is untested #1292

Description

Test coverage gap

bin/utils/error.ts exports PakeError and isPakeError with no dedicated tests. isPakeError drives the clean user-facing error path in bin/cli.ts (print message, exit 1, no stack trace), and it has non-obvious branches worth locking in:

  • the instanceof PakeError path;
  • the cross-module duck-typed fallback (typeof error === 'object' && error.isUserError === true), which exists precisely because instances from a different module copy can fail instanceof;
  • the error !== null guard (since typeof null === 'object').

Proposal

Add tests/unit/error.test.ts covering PakeError's flag/name and all isPakeError branches (PakeError instance, duck-typed object, plain Error, isUserError: false/{}, and null/undefined). Tests only. PR attached.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions