Test Results Reporter

This part reports the outcome of the test run. It prints the final summary, including passed and failed tests, to the console.

Columns are parts of the code, grouped by process. Read top to bottom. Solid arrow: hands work over. Dashed: the reply. Purple: crosses between processes. Hook: work inside one part. Dashed boxes repeat. Hover a column name or a step for its full text.

MAIN PROCESSAll reporter operations in parallelBenchmark reporter initializationTest reporters initializationLive summary setupTTY mode selectionConsole log outputSummary reporter teardownRun summary outputBenchmark summary outputGitHub Actions error outputStart Vitest from CLIDispatch lifecycle methodInitialize benchmark reporterLoad comparison reportInitialize test reportersInitialize base rep…Initialize live summarySetup window render…Dispatch lifecycle methodChoose TTY rendering modeSet render succeed…Dispatch lifecycle methodWrite console logsOutput to streamDispatch lifecycle methodEnd summary displayForward run-end eve…Flush buffered outputCle…Dispatch lifecycle methodPrint run summaryRecord end timePrint benchmark summaryWrite JSON reportPrint GitHub errorsFormat error comman…Write final reports
CLI Starter
Lifecycle
Benchmark
Reporters
Renderers
1Start Vitest from CLI — The command line starter begins by starting Vitest from the command line options and handling any fatal startup errors that occur. It sets the process title, dynamically loads the command line API, and normalizes any filters or options provided. If the server is not kept, it exits the context; if any startup error occurs, it prints a Startup Error banner and sets the exit code to 1.
2Initialize benchmark reporter — The benchmark reporter initializes the base reporter and optionally loads a flattened benchmark comparison report from a JSON file. If there are errors reading the comparison file, they are logged and swallowed. The base initialization runs first, then any optional comparison JSON is resolved, read, parsed, and flattened.
3Initialize base reporter — The test reporters initialize the base reporter and its optional summary reporter. This runs during each default reporter's initialization event. The base initialization runs first, followed by the optional summary initialization with verbose settings.
4Initialize live summary rendering — The test reporters initialize live-summary rendering for Vitest during reporter initialization. Options default to verbose being false, and a window renderer is constructed with a create summary callback. When closed, the duration interval is cleared and the renderer stops.
5Choose TTY rendering mode — The test reporters choose whether successful module output should be rendered in TTY mode and start the optional summary. In TTY mode, the render succeed flag is set to false by default, then set according to the number of specifications. The start event is forwarded to the optional summary.
6Write user console logs — The test reporters write an allowed user console log with a task header and optional origin frames to standard output or error. A logging gate checks if the log should be displayed, then the output stream is chosen based on the log type. The task header includes the full name and the origin stack is parsed to highlight the nearest test file.
7End summary reporter display — The test reporters end the optional summary reporter's display and finish the live summary. This clears internal maps, finishes the renderer, and clears the duration interval. The run-end event is forwarded to the optional summary.
8Flush buffered output — The output renderers mark rendering as finished, flush buffered output, and clear the render interval. This sets the finished flag to true, flushes the buffer which clears the live window, and clears the render interval. Stream interceptors remain installed until stopped.
9Print run summary — The test reporters record the end time and print either no-tests information or the run summary. Files and errors are defaulted from state, and performance end time is recorded. If no files or errors exist, a no test found message prints; otherwise, the run summary reports.
10Print benchmark summary — The benchmark reporter prints the base summary and optionally writes a benchmark JSON report. The base finish runs first, then if an output JSON path is specified, the directory is created and an indented JSON benchmark report is written, with a log message confirming the write.
11Print GitHub Actions errors — The test reporters print GitHub Actions error commands for task and unhandled errors with a nearest stack frame. Files and errors default to empty, and unhandled errors use the root with a title of Unhandled error. Failed task errors use full names and project information, with workflow error commands using transformed file paths and ANSI-stripped output.
12Write final reports — The test reporters write JSON task results through log tasks with the supplied coverage map, write JUnit XML with per-file statistics and test results, and print TAP version 13 with flattened tasks. Files default from state, and the JUnit report includes XML declaration, suite names, totals, and timestamps. TAP output includes a plan and numbered task results with passing, skipped, and pending tasks marked as ok, while failures are marked as not ok.
STEP · hover for full text