Extracts the source location from a stack trace string. Supports Chrome/Node style "at func (url:line:col)" and Firefox/WebKit style "@url:line:col". Returns a clean location string without surrounding parens, or null if nothing can be extracted.
Extracts every genuinely-failing assertion (todo assertions are expected to fail and are
excluded) from a testEnd payload, resolving stacks back to original sources.
Splits an at string (path:line:col) into parts; returns null when it isn't a location.
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.
-
actual: unknown
The value the assertion saw, normalized so circular refs are safe to dump.
-
at: string | null
path:line:colof the first user frame (preferred) or the raw stack location. -
expected: unknown
The value the assertion required, normalized the same way as
actual. -
index: number
1-based index of the assertion within the test (matches TAP's
Assertion #N). -
message: string | null
The assertion's message, or
nullwhen it had none. -
source: string | null
The original source line's text, when the map embeds
sourcesContent. -
stack: string | null
Stack with bundle frames rewritten to original sources when a decoder is available.
Usage
import * as mod from "lib/reporters/failure.ts";