Skip to main content

BettererReporter

API > @betterer/betterer > BettererReporter

The interface for hooking into Betterer's reporter system.

Signature

export interface BettererReporter 

Remarks

There are two ways to specify a custom BettererReporter:

Defining the reporter inline when calling Betterer via one of the JS APIs:

Example 1

import { betterer } from '@betterer/betterer';

betterer({
reporters: [{
configError() {
// custom configError hook
}
}]
})

Defining the reporter in an npm module and passing the name to the package:

Example 2

import { betterer } from '@betterer/betterer';

betterer({
reporters: ['my-custom-reporter']
})

'my-custom-module' should export a reporter which implements the BettererReporter interface.

Methods

MethodDescription
configError(config, error)?(Optional) The configError() hook is called when there is an error while instantiating and validating the BettererConfig.
contextEnd(contextSummary)?(Optional) The contextEnd() hook is called when a BettererContext ends.
contextError(context, error)?(Optional) The contextError() hook is called when a BettererContext throw an error.
contextStart(context, lifecycle)?(Optional) The contextStart() hook is called when a BettererContext starts. The lifecycle promise will resolve when the context ends or reject when the context throws an error, so it can be used instead of the BettererReporter.contextEnd() and BettererReporter.contextError() hooks.
runEnd(runSummary)?(Optional) The runEnd() hook is called when a BettererRun ends.
runError(run, error)?(Optional) The runError() hook is called when a BettererRun throws an error.
runStart(run, lifecycle)?(Optional) The runStart() hook is called when a BettererRun starts. The lifecycle promise will resolve when the run ends and reject when the run throws an error, so it can be used instead of the BettererReporter.runEnd() and BettererReporter.runError() hooks.
suiteEnd(suiteSummary)?(Optional) The suiteEnd() hook is called when a BettererSuite run ends.
suiteError(suite, error)?(Optional) The suiteError() hook is called when a BettererSuite run throws an error.
suiteStart(suite, lifecycle)?(Optional) The suiteStart() hook is called when a BettererSuite run starts. The lifecycle promise will resolve when the suite run ends or reject when the suite run throws an error, so it can be used instead of the BettererReporter.suiteEnd() and BettererReporter.suiteError() hooks.