Applies one testEnd to the run's counters. Kept separate from any reporter so the
numbers are identical no matter which reporter (or how many) is active — the exit code
and the TAP plan both read counter, so it must be updated exactly once per test.
A console.* call or an uncaught error from the page under test.
-
args: unknown[]
The call's arguments, resolved to JSON values where the page could serialize them.
-
text: string
The rendered single-line text. Always present.
-
type: string
The page console type (
log/warning/error/info/debug), orpageerror.
One diagnostic from qunitx itself: which files a narrowing flag scoped the run to, a filter that matched nothing, a build error, a timeout.
-
level: "info" | "warning" | "error"
infois a decision,warninga surprise,errora diagnostic that also hits stderr. -
message: string
The text, already colored where the CLI colors it, with no
#prefix and no newline. -
raw: boolean
Write
messageverbatim rather than as a#-prefixed comment. For pre-formatted blocks — the coverage table, a stack trace — whose own layout is the point. -
stream: "output" | "error" | "both"
Which of the run's two streams the default rendering goes to;
outputby default.
The reporter contract — the public extension point for observing a run. Reporters render it
to text (the built-in tap/spec/dot/github), write an artifact (junit), or simply
collect, which is how the JS API turns a run into a value.
-
onBrowserLog(): voidcontext: ReporterContext,log: BrowserLog
Called for each
console.*call and uncaught error from the page under test. Only warnings and errors arrive unlessdebugis on — the same selection the CLI prints. -
onNotice(): voidcontext: ReporterContext,notice: Notice
Called for each of qunitx's own diagnostics — the
# …lines about what it decided to run, what it could not find, what timed out. The default rendering has already gone toconfig.state.console; implement this only to capture them as data. -
onRunEnd(): void | Promise<void>context: ReporterContext,info: RunEndInfo
Called once when the run finishes, with the final counts on
config.state.results.counter. -
onRunStart(): voidcontext: ReporterContext,info: RunStartInfo
Called once before any test output. In watch mode, once per rerun.
-
onTestEnd(): voidcontext: ReporterContext,details: TestDetails
Called once per test, after
counterhas already been updated for this test.
What a reporter is given on every hook: where to write, what the run has counted so far, and the few resolved paths a message needs.
-
console: Console
Where this reporter's text goes.
silentConsolewhen the run was asked to print nothing. -
counts: Counter
The run's live outcome totals — the same object the runner updates, not a copy.
-
daemon: boolean
Whether this run is executing inside the persistent daemon.
-
junit: boolean | string
--junit's value:truefor the default path, a string for an explicit one. -
output: string
Absolute path of the build output directory.
-
projectRoot: string
Absolute path of the directory holding
package.json, for rendering paths relative to it. -
sourceMapDecoder: SourceMapDecoder | null
Maps a bundle stack frame back to source, once the run has built one.
Final run info; the counts themselves live on config.state.results.counter.
-
durationMs: number
Wall-clock duration of the run in milliseconds.
Run-scope counts. fileCount === null means "counts unknown at this point" (watch mode,
where the header is emitted per browser connection rather than per file batch).
-
fileCount: number | null
Test files in this run, or
nullwhen not known at announce time. -
groupCount: number | null
Concurrent groups the files were split across, or
nullalongside a nullfileCount.
One QUnit assertion inside a testEnd payload.
-
actual: unknown
The value the assertion actually saw.
-
expected: unknown
The value the assertion required.
-
message: string
The assertion's message, when one was given.
-
passed: boolean
truewhen the assertion held. -
stack: string
Raw stack captured at the assertion, with frames pointing at the bundle.
-
todo: boolean
truefor assertions inside atodotest, which are expected to fail.
The QUnit testEnd payload as it arrives over the WebSocket. Passing tests carry the
trimmed { status, fullName, runtime }; failing tests additionally carry assertions.
-
assertions: TestAssertion[]
Present on failing tests only (QUnit trims the payload otherwise).
-
fullName: string[]
Module path followed by the test name, e.g.
['Math', 'adds']. -
runtime: number
Test duration in milliseconds.
-
status: string
QUnit's outcome:
passed|failed|skipped|todo.
A valid --reporter value.
Every stdout reporter --reporter accepts, in help/error-message order. Exactly one is
active per run — artifact outputs (--junit, --coverage) are separate additive flags.
This module is a leaf (type-only imports), so Args.parse can validate against it
without pulling the reporter implementations into the CLI's startup path.
Usage
import * as mod from "lib/reporters/types.ts";