Guide
Reporters

Reporters

The reporters allow to customize output of TSTyche.

This feature is available since TSTyche 3.0.

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.

list

If only one test file is selected, lists each test case and their status. Otherwise, only names of test files and their status are listed. The details of every failing test are included.

summary

Prints out a summary of all tests. It does not include any details of test failure. The summary is disabled in watch mode.

Custom Reporter

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

If you are publishing your reporter to npm, consider prefixing its name with 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").Event} event
   */
  on([event, payload]) {
    if (event === "run:start") {
      console.info("Hello from custom reporter!");
 
      for (const task of payload.result.tasks) {
        console.info(task.filePath);
      }
    }
  }
}