Reporters
TestReporter class reporting for duty!
Reporters are the way tests get reported. When running the CLI, the SummaryReporter is used and all the values will be logged to the console. The test suite itself does not log out test results. If you want to use a custom reporter, you can create your own by extending the abstract Reporter class.
export abstract class TestReporter {
public abstract onStart(suite: TestSuite): void;
public abstract onGroupStart(group: TestGroup): void;
public abstract onGroupFinish(group: TestGroup): void;
public abstract onTestStart(group: TestGroup, result: TestResult): void;
public abstract onTestFinish(group: TestGroup, result: TestResult): void;
public abstract onFinish(suite: TestSuite): void;
public abstract onTodo(group: TestGroup, todo: string): void;
}
Each test suite run will use the provided reporter and call onStart(suite: TestSuite) to notify a consumer that a test has started. This happens once per test file. Since a file can have multiple describe function calls, these are logically placed into TestGroups. Each TestGroup has it's own description and contains a list of TestResults that were run.
If no reporter is provided to the configuration, one will be provided that uses stdout and chalk to provide colored output.
If performance is enabled, then the times array will be populated with the runtime values measured in milliseconds. Please note that the Performance api will be deprecated, and so will this TestReporter interface by version 4.0.0.
Copy link