-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
ThrowReport.ts
71 lines (55 loc) Β· 1.92 KB
/
ThrowReport.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
import {MessageName} from './MessageName';
import {Report, SectionOptions, TimerOptions} from './Report';
import {Locator} from './types';
export class ThrowReport extends Report {
reportCacheHit(locator: Locator) {
}
reportCacheMiss(locator: Locator) {
}
startSectionSync<T>(opts: SectionOptions, cb: () => T) {
return cb();
}
async startSectionPromise<T>(opts: SectionOptions, cb: () => Promise<T>) {
return await cb();
}
startTimerSync<T>(what: string, opts: TimerOptions, cb: () => T): T;
startTimerSync<T>(what: string, cb: () => T): T;
startTimerSync<T>(what: string, opts: TimerOptions | (() => T), cb?: () => T) {
const realCb = typeof opts === `function` ? opts : cb!;
return realCb();
}
async startTimerPromise<T>(what: string, opts: TimerOptions, cb: () => Promise<T>): Promise<T>;
async startTimerPromise<T>(what: string, cb: () => Promise<T>): Promise<T>;
async startTimerPromise<T>(what: string, opts: TimerOptions | (() => Promise<T>), cb?: () => Promise<T>) {
const realCb = typeof opts === `function` ? opts : cb!;
return await realCb();
}
reportSeparator() {
}
reportInfo(name: MessageName | null, text: string) {
}
reportWarning(name: MessageName, text: string) {
}
reportError(name: MessageName, text: string) {
}
reportProgress(progress: AsyncIterable<{progress: number, title?: string}>) {
const promise = Promise.resolve().then(async () => {
// eslint-disable-next-line no-empty-pattern
for await (const {} of progress) {
// No need to do anything; we just want to consume the progress events
}
});
const stop = () => {
// Nothing to stop
};
return {...promise, stop};
}
reportJson(data: any) {
// Just ignore the json output
}
reportFold(title: string, text: string) {
// Just ignore the fold output
}
async finalize() {
}
}