forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathshared.ts
More file actions
88 lines (72 loc) · 2.51 KB
/
shared.ts
File metadata and controls
88 lines (72 loc) · 2.51 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
namespace Harness.Parallel {
export interface RunnerTask {
runner: TestRunnerKind;
file: string;
size: number;
}
export interface UnitTestTask {
runner: "unittest";
file: string;
size: number;
}
export type Task = RunnerTask | UnitTestTask;
export interface TestInfo {
name: string[];
}
export interface ErrorInfo {
name: string[];
error: string;
stack: string;
}
export interface TaskTimeout {
duration: number | "reset";
}
export interface TaskResult {
passing: number;
errors: ErrorInfo[];
passes: TestInfo[];
duration: number;
task: Task;
}
export interface ParallelTestMessage {
type: "test";
payload: Task;
}
export interface ParallelBatchMessage {
type: "batch";
payload: Task[];
}
export interface ParallelCloseMessage {
type: "close";
}
export type ParallelHostMessage = ParallelTestMessage | ParallelCloseMessage | ParallelBatchMessage;
export interface ParallelErrorMessage {
type: "error";
payload: { error: string, stack: string, name?: string[] };
}
export interface ParallelResultMessage {
type: "result";
payload: TaskResult;
}
export interface ParallelBatchProgressMessage {
type: "progress";
payload: TaskResult;
}
export interface ParallelTimeoutChangeMessage {
type: "timeout";
payload: TaskTimeout;
}
export type ParallelClientMessage = ParallelErrorMessage | ParallelResultMessage | ParallelBatchProgressMessage | ParallelTimeoutChangeMessage;
export function shimNoopTestInterface(global: Mocha.MochaGlobals) {
global.before = ts.noop;
global.after = ts.noop;
global.beforeEach = ts.noop;
global.afterEach = ts.noop;
global.describe = global.context = ((_: any, __: any) => { /*empty*/ }) as Mocha.SuiteFunction;
global.describe.skip = global.xdescribe = global.xcontext = ts.noop as Mocha.PendingSuiteFunction;
global.describe.only = ts.noop as Mocha.ExclusiveSuiteFunction;
global.it = global.specify = ((_: any, __: any) => { /*empty*/ }) as Mocha.TestFunction;
global.it.skip = global.xit = global.xspecify = ts.noop as Mocha.PendingTestFunction;
global.it.only = ts.noop as Mocha.ExclusiveTestFunction;
}
}