Skip to main content

BettererRun

API > @betterer/betterer > BettererRun

A single BettererTest run. Will become a BettererRunSummary when the test run is completed.

Signature

export interface BettererRun 

Remarks

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

Example

const myReporter: BettererReporter = {
// Access the run before any tests are run:
runStart (run: BettererRun) {
// ...
},
// Access the run when something goes wrong:
runError (run: BettererRun) {
// ...
}
}

Properties

PropertyTypeDescription
baselineBettererResult | nullThe baseline result for the test run. If the BettererTest gets better over the lifetime of the BettererContext, baseline will always reflect the original result. Will be null when isNew is true.
expectedBettererResult | nullThe expected result for the test run. Will always reflect the result from the results file. If the BettererTest gets better over the lifetime of the BettererContext, expected will reflect the current result. Will be null when isNew is true.
filePathsBettererFilePaths | nullAn array of file paths that will be tested. Will be null if the test is not a BettererFileTest. If it is an empty array then all relevant files for the test (as defined by BettererFileTest.include() and BettererFileTest.exclude()) will be tested.
isNewbooleanWhen true, this is the first time that a test has been run. Both baseline and expected will be set to null. The default reporter will show that this test is new.
isSkippedbooleanWhen true, this test has been skipped and the test function will not run. The default reporter will show that this test has been skipped.
namestringThe name of the test for the run.