Skip to Content
GuidesReporters

Reporters

The reporters allow to customize output of TSTyche.

Usage

To specify a reporter, pass it with the --reporters command line option:

tstyche --reporters list,tstyche-reporter,./custom-reporter.js

Or use the reporters configuration option:

{ "reporters": ["list", "tstyche-reporter", "./custom-reporter.js"] }

Built-in Reporters

By default, the built-in list and summary reporters are used.

dot

Prints a row of dots (·) for passing test files and crosses (×) for failed ones. Failures are listed at the end of the run.

list

Prints the status followed by the file name for each test file. Failures are listed immediately after the file finishes.

For single-file runs or when --verbose is enabled, the reporter includes the full test tree.

summary

Prints a concise summary of the test run. Failure details are omitted. In watch mode the reporter produces no output.

Custom Reporter

A custom reporter can be a package or a local module.

If you are publishing your reporter to npm, use the following naming pattern: tstyche-*-reporter.

The module must export a class that takes resolvedConfig as a constructor argument and implements the on() method:

export default class CustomReporter { /** * @param {import("tstyche/tstyche").ResolvedConfig} resolvedConfig */ constructor(resolvedConfig) { this.resolvedConfig = resolvedConfig; } /** * @param {import("tstyche/tstyche").ReporterEvent} reporterEvent */ on([event, payload]) { if (event === "run:start") { console.info("Hello from custom reporter!"); for (const task of payload.result.tasks) { console.info(task.filePath); } } } }
Last updated on