Skip to main content

BettererRunSummary

API > @betterer/betterer > BettererRunSummary

The summary of a BettererTest run. Includes everything from BettererRun.

Signature

export interface BettererRunSummary extends BettererRun 
Extends: [BettererRun](/betterer/docs/betterer.bettererrun)

Remarks

You can get the BettererRunSummary via the BettererReporter interface.

Example 1

const myReporter: BettererReporter = {
// Access the summary after the run has ended:
runEnd (runSummary: BettererRunSummary) {
// ...
}
}

or by using BettererReporter's Promise-based lifecycle interface:

Example 2

const myReporter: BettererReporter = {
// Access the summary after the run has ended:
runStart (run: BettererRun, lifecycle: Promise<BettererRunSummary>) {
const summary: BettererRunSummary = await lifecycle;
// ...
}
}

Properties

PropertyTypeDescription
deltaBettererDelta | nullThe change between a test run's result and its baseline. Will be present when the test has a progress handler and isBetter, isNew, isSame or isWorse is true.
diffBettererDiff | nullThe verbose diff between the current test result and the expected result. Will be present when isWorse is true.
errorError | nullThe error that cause the run to fail. Will be present when isFailed is true.
isBetterbooleanWhen true, this test has become "better", based on the result of the constraint function. The results file will be updated with the new result. If the test has met its goal, isComplete will also be true.
isCompletebooleanWhen true, this test has successfully met its goal. isBetter will also be true the first time the test meets its goal. isSame will also be true on subsequent runs. The default reporter will show that this test has met its goal.
isExpiredbooleanWhen true, this test has expired because its deadline has passed. The default reporter will show that this test has expired.
isFailedbooleanWhen true, this test has failed because the test function threw an error. The default reporter will show that this test has failed.
isSamebooleanWhen true, this test is "the same", based on the result of the constraint function. The results file will be updated if the serialised result has changed, for example when a linting issue in a file moves to a different location in the file.
isUpdatedbooleanWhen true, this test is "worse", based on the result of the constraint function, but the --update option was used. The results file will be updated with the new result.
isWorsebooleanWhen true, this test is "worse", based on the result of the constraint function. The results file will not be updated.
printedstring | null
resultBettererResult | nullThe result for the test run. Will be null when isFailed or isSkipped is true.
timestampnumberThe time that the test started. Used for checking if a test has expired.