interface FailureInfo

One failing assertion, normalized for rendering. Every reporter needs the same three things — what failed, where in the original source, and the values involved — so the source-map resolution and value normalization happen once here rather than per reporter.

const failure: FailureInfo = {
  index: 1, message: 'bad sum', actual: 3, expected: 4, stack: null, at: 'lib/math.ts:4:3', source: null,
};
failure.at; // 'lib/math.ts:4:3' — already in original-source coordinates

Properties

index: number

1-based index of the assertion within the test (matches TAP's Assertion #N).

message: string | null

The assertion's message, or null when it had none.

actual: unknown

The value the assertion saw, normalized so circular refs are safe to dump.

expected: unknown

The value the assertion required, normalized the same way as actual.

stack: string | null

Stack with bundle frames rewritten to original sources when a decoder is available.

at: string | null

path:line:col of the first user frame (preferred) or the raw stack location.

source: string | null

The original source line's text, when the map embeds sourcesContent.

Usage

import { type FailureInfo } from "lib/reporters/failure.ts";