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.
packages/vitest/src/node/clipackages/vitest/src/nodepackages/vitest/src/node/reporters/benchmarkpackages/vitest/src/node/reporterspackages/vitest/src/node/reporters/renderersThe 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.
start packages/vitest/src/node/cli/cac.ts — Starts Vitest from CLI options and handles fatal startup errors.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.
Vitest.report packages/vitest/src/node/core.ts — Dispatches one reporter lifecycle method concurrently.BenchmarkReporter.onInit packages/vitest/src/node/reporters/benchmark/reporter.ts — Initializes the base reporter and optionally loads a flattened benchmark comparison report.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.
DefaultReporter.onInit packages/vitest/src/node/reporters/default.ts — Initializes the base reporter and its optional summary reporter.Vitest.report packages/vitest/src/node/core.ts — Dispatches one reporter lifecycle method concurrently.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.
SummaryReporter.onInit packages/vitest/src/node/reporters/summary.ts — Initializes live-summary rendering for Vitest.Vitest.report packages/vitest/src/node/core.ts — Dispatches one reporter lifecycle method concurrently.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.
Vitest.report packages/vitest/src/node/core.ts — Dispatches one reporter lifecycle method concurrently.DefaultReporter.onTestRunStart packages/vitest/src/node/reporters/default.ts — Chooses whether successful module output should be rendered in TTY mode and starts the optional summary.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.
Vitest.report packages/vitest/src/node/core.ts — Dispatches one reporter lifecycle method concurrently.BaseReporter.onUserConsoleLog packages/vitest/src/node/reporters/base.ts — Writes an allowed user console log with a task header and optional origin frames to stdout or stderr.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.
Vitest.report packages/vitest/src/node/core.ts — Dispatches one reporter lifecycle method concurrently.DefaultReporter.onTestRunEnd packages/vitest/src/node/reporters/default.ts — Ends the optional summary reporter's display.SummaryReporter.onTestRunEnd packages/vitest/src/node/reporters/summary.ts — Finishes the live summary and stops duration updates.WindowRenderer.finish packages/vitest/src/node/reporters/renderers/windowedRenderer.ts — Marks rendering finished, flushes buffered output, and clears the render interval.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.
WindowRenderer.finish packages/vitest/src/node/reporters/renderers/windowedRenderer.ts — Marks rendering finished, flushes buffered output, and clears the render interval.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.
Vitest.report packages/vitest/src/node/core.ts — Dispatches one reporter lifecycle method concurrently.BaseReporter.onFinished packages/vitest/src/node/reporters/base.ts — Records the end time and prints either no-tests information or the run summary.DefaultReporter.onTestRunEnd packages/vitest/src/node/reporters/default.ts — Ends the optional summary reporter's display.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.
BenchmarkReporter.onFinished packages/vitest/src/node/reporters/benchmark/reporter.ts — Prints the base summary and optionally writes a benchmark JSON report.Vitest.report packages/vitest/src/node/core.ts — Dispatches one reporter lifecycle method concurrently.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.
GithubActionsReporter.onFinished packages/vitest/src/node/reporters/github-actions.ts — Prints GitHub Actions error commands for task and unhandled errors with a nearest stack frame.Vitest.report packages/vitest/src/node/core.ts — Dispatches one reporter lifecycle method concurrently.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.
JsonReporter.onFinished packages/vitest/src/node/reporters/json.ts — Writes JSON task results through logTasks with the supplied coverage map.JUnitReporter.onFinished packages/vitest/src/node/reporters/junit.ts — Writes JUnit XML with per-file statistics, test results, suite errors, and empty-file load failures, then closes the output file.TapFlatReporter.onFinished packages/vitest/src/node/reporters/tap-flat.ts — Prints TAP version 13 and reports flattened tasks.TapReporter.logTasks packages/vitest/src/node/reporters/tap.ts — Writes a TAP plan and recursively numbered task results.