Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Aquaticat/Monochromatic. TypeScript and Rust monorepo: Claude Code and Pi coding-agent plugins, a m
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061/** Tests for caught-value stack diagnostics. @module */
import { describe, expect, it,} from '@monochromatic-dev/module-test';
import { caughtValueStack, } from '@monochromatic-dev/module-caught-value';
await describe({ name: caughtValueStack.name, children: [ it({ name: 'returns Error stack text when available', fn: async () => { /** Error carrying deterministic stack text. */ const error = new Error('offline',); error.stack = 'stack details'; expect(caughtValueStack(error,),).toBe('stack details',); }, },), it({ name: 'falls back to Error message when stack is absent', fn: async () => { /** Error with stack explicitly absent. */ const error = new Error('offline',); delete error.stack; expect(caughtValueStack(error,),).toBe('offline',); }, },), it({ name: 'preserves caller-defined non-Error text', fn: async () => { /** Thrown object carrying diagnostic conversion text. */ const thrownValue = { /** Supplies caller-defined diagnostic text. @returns caller-defined text. */ toString(): string { return 'provider details'; }, }; expect(caughtValueStack(thrownValue,),).toBe('provider details',); }, },), ],},);