Skip to main content

BettererContext

API > @betterer/betterer > BettererContext

The context of a set of test suite runs.

Signature

export interface BettererContext 

Remarks

The internal implementation of BettererContext is responsible for a lot more than this interface suggests, but we want to minimise the public API surface as much as possible. You can get the BettererContext via the BettererReporter interface.

Example

const myReporter: BettererReporter = {
// Access the context before any tests are run:
contextStart (context: BettererContext) {
// ...
},
// Access the context when something goes wrong:
contextError (context: BettererContext) {
// ...
}
}

Properties

PropertyTypeDescription
configBettererConfigThe config of the context. You probably don't want to mess with this directly 🔥. If you need to update the config, you should use BettererContext.options() instead.

Methods

MethodDescription
options(optionsOverride)Make changes to the context config. The updated config will be used for the next run.
stop()Stop the test run and clean everything up. If tests are running, waits for them to end before stopping.