-
Notifications
You must be signed in to change notification settings - Fork 299
/
Copy pathtypes.ts
64 lines (59 loc) · 2.15 KB
/
types.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
import { ProjectWorkspace } from 'jest-editor-support';
import * as vscode from 'vscode';
import { LoggingFactory } from '../logging';
import { PluginResourceSettings } from '../Settings';
import { ProcessSession } from './process-session';
import { JestProcessInfo } from '../JestProcessManagement';
import { JestOutputTerminal } from './output-terminal';
import { TestIdentifier } from '../TestResults';
import type { AggregatedResult } from '@jest/reporters';
export enum WatchMode {
None = 'none',
Watch = 'watch',
WatchAll = 'watchAll',
}
export interface RunnerWorkspaceOptions {
outputFileSuffix?: string;
collectCoverage?: boolean;
}
export interface JestExtContext {
settings: PluginResourceSettings;
workspace: vscode.WorkspaceFolder;
loggingFactory: LoggingFactory;
createRunnerWorkspace: (options?: RunnerWorkspaceOptions) => ProjectWorkspace;
output: JestOutputTerminal;
}
export interface JestExtSessionContext extends JestExtContext {
session: ProcessSession;
}
export interface RunEventBase {
process: JestProcessInfo;
}
export type TestResultJestRunEventArguments = {
aggregatedResult: AggregatedResult;
};
export type JestRunEvent = RunEventBase &
(
| { type: 'scheduled' }
| { type: 'data'; text: string; raw?: string; newLine?: boolean; isError?: boolean }
| { type: 'process-start' }
| { type: 'start' }
| { type: 'end'; error?: string }
| { type: 'exit'; error?: string; code?: number }
| { type: 'long-run'; threshold: number; numTotalTestSuites?: number }
);
export interface JestSessionEvents {
onRunEvent: vscode.EventEmitter<JestRunEvent>;
onTestSessionStarted: vscode.EventEmitter<JestExtSessionContext>;
onTestSessionStopped: vscode.EventEmitter<void>;
}
export interface JestExtProcessContextRaw extends JestExtContext {
updateWithData: (data: AggregatedResult, process: JestProcessInfo) => void;
onRunEvent: vscode.EventEmitter<JestRunEvent>;
}
export type JestExtProcessContext = Readonly<JestExtProcessContextRaw>;
export type DebugTestIdentifier = string | TestIdentifier;
export type DebugFunction = (
document: vscode.TextDocument | string,
...ids: DebugTestIdentifier[]
) => Promise<void>;