BettererRunSummary
API > @betterer/betterer > BettererRunSummary
The summary of a BettererTest
run. Includes everything from BettererRun
.
Signature
export interface BettererRunSummary extends 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
Property | Type | Description |
---|---|---|
delta | BettererDelta | null | The 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 . |
diff | BettererDiff | null | The verbose diff between the current test result and the expected result. Will be present when isWorse is true . |
error | Error | null | The error that cause the run to fail. Will be present when isFailed is true . |
isBetter | boolean | When 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 . |
isComplete | boolean | When 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. |
isExpired | boolean | When true , this test has expired because its deadline has passed. The default reporter will show that this test has expired. |
isFailed | boolean | When true , this test has failed because the test function threw an error. The default reporter will show that this test has failed. |
isSame | boolean | When 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. |
isUpdated | boolean | When 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. |
isWorse | boolean | When true , this test is "worse", based on the result of the constraint function. The results file will not be updated. |
printed | string | null | |
result | BettererResult | null | The result for the test run. Will be null when isFailed or isSkipped is true . |
timestamp | number | The time that the test started. Used for checking if a test has expired. |