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 BettererRun
s 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
Property | Type | Description |
---|---|---|
baseline | BettererResult | null | The 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 . |
expected | BettererResult | null | The 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 . |
filePaths | BettererFilePaths | null | An 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. |
isNew | boolean | When 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. |
isSkipped | boolean | When true , this test has been skipped and the test function will not run. The default reporter will show that this test has been skipped. |
name | string | The name of the test for the run. |