MCPcopy Create free account
hub / github.com/tinyplex/tinybase /

Class

test/vitest/reporter.ts:10–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8import {DefaultReporter} from 'vitest/reporters';
9
10export default class extends DefaultReporter {
11 tests: number = 0;
12 assertions: number = 0;
13 async onTestCaseResult(testCase: TestCase) {
14 this.assertions += (testCase.meta() as any).assertions || 0;
15 this.tests++;
16 super.onTestCaseResult(testCase);
17 }
18
19 async onTestRunEnd(
20 testModules: ReadonlyArray<TestModule>,
21 unhandledErrors: ReadonlyArray<SerializedError>,
22 reason: TestRunEndReason,
23 ) {
24 super.onTestRunEnd(testModules, unhandledErrors, reason);
25 this.ctx.logger.log(`\nTotal Assertions: ${this.assertions}`);
26 await writeFile(
27 './tmp/counts.json',
28 JSON.stringify({tests: this.tests, assertions: this.assertions}),
29 'utf8',
30 );
31 }
32}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected