forked from as-pect/as-pect
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CombinationReporter.ts
42 lines (34 loc) 路 1.25 KB
/
CombinationReporter.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { TestReporter } from "../test/TestReporter";
import { TestContext } from "../test/TestContext";
import { TestGroup } from "../test/TestGroup";
import { TestResult } from "../test/TestResult";
/**
* This reporter is used to combine a set of reporters into a single reporter object. It uses
* forEach() to call each reporter's function when each method is called.
*/
export default class CombinationReporter extends TestReporter {
constructor(protected reporters: TestReporter[]) {
super();
}
onFinish(suite: TestContext): void {
this.reporters.forEach(e => e.onFinish(suite));
}
onGroupFinish(group: TestGroup): void {
this.reporters.forEach(e => e.onGroupFinish(group));
}
onGroupStart(group: TestGroup): void {
this.reporters.forEach(e => e.onGroupStart(group));
}
onStart(suite: TestContext): void {
this.reporters.forEach(e => e.onStart(suite));
}
onTestStart(group: TestGroup, result: TestResult): void {
this.reporters.forEach(e => e.onTestStart(group, result));
}
onTestFinish(group: TestGroup, result: TestResult): void {
this.reporters.forEach(e => e.onTestFinish(group, result));
}
onTodo(group: TestGroup, todo: string): void {
this.reporters.forEach(e => e.onTodo(group, todo));
}
}