/
types.ts
105 lines (89 loc) · 3.29 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
import { CoverageColors } from '../Coverage/CoverageOverlay';
import { JESParserPluginOptions, ProjectWorkspace } from 'jest-editor-support';
import { RunShell } from '../JestExt/run-shell';
import { RunMode } from '../JestExt/run-mode';
export type JestTestProcessType =
| 'all-tests'
| 'watch-tests'
| 'watch-all-tests'
| 'by-file'
| 'by-file-test'
| 'not-test'
| 'by-file-test-pattern'
| 'by-file-pattern';
export type OnStartupType = Extract<JestTestProcessType, 'all-tests'>[];
export type OnSaveFileType = 'test-file' | 'test-src-file';
export type JestExtAutoRunShortHand = 'default' | 'watch' | 'on-save' | 'legacy' | 'off';
export type JestExtAutoRunConfig =
| { watch: true; onStartup?: OnStartupType }
| {
watch: false;
onStartup?: OnStartupType;
onSave?: OnSaveFileType;
};
export type JestExtAutoRunSetting = JestExtAutoRunShortHand | JestExtAutoRunConfig;
export interface JestRunModeOptions {
runAllTestsOnStartup?: boolean;
coverage?: boolean;
deferred?: boolean;
// TestExplorer related settings
showInlineError?: boolean;
}
export type JestRunMode = (
| { type: 'watch' }
| { type: 'on-demand' }
| { type: 'on-save'; testFileOnly?: boolean }
) &
JestRunModeOptions;
export type JestRunModeType = JestRunMode['type'];
export type JestPredefinedRunModeType = JestRunModeType | 'deferred';
export type JestRunModeSetting = JestRunMode | JestPredefinedRunModeType;
export interface JestRawOutputSetting {
revealWithFocus?: 'terminal' | 'test-results' | 'none';
revealOn?: 'run' | 'error' | 'demand';
clearOnRun?: 'both' | 'terminal' | 'test-results' | 'none';
}
export type JestPredefinedOutputSetting = 'neutral' | 'terminal-based' | 'test-results-based';
export type JestOutputSetting = JestPredefinedOutputSetting | JestRawOutputSetting;
export type TestExplorerConfigLegacy =
| { enabled: false }
| { enabled: true; showClassicStatus?: boolean; showInlineError?: boolean };
export interface TestExplorerConfig {
showInlineError?: boolean;
}
export type NodeEnv = ProjectWorkspace['nodeEnv'];
export type MonitorLongRun = 'off' | number;
export type AutoRevealOutputType = 'on-run' | 'on-exec-error' | 'off';
export interface PluginResourceSettings {
jestCommandLine?: string;
rootPath: string;
coverageFormatter: string;
debugMode?: boolean;
coverageColors?: CoverageColors;
runMode: RunMode;
nodeEnv?: NodeEnv;
shell: RunShell;
monitorLongRun?: MonitorLongRun;
enable?: boolean;
parserPluginOptions?: JESParserPluginOptions;
useDashedArgs?: boolean;
}
export interface DeprecatedPluginResourceSettings {
showCoverageOnLoad?: boolean;
autoRun?: JestExtAutoRunSetting | null;
testExplorer?: TestExplorerConfig;
}
export interface PluginWindowSettings {
disabledWorkspaceFolders: string[];
}
export type AllPluginResourceSettings = PluginResourceSettings & DeprecatedPluginResourceSettings;
export type VirtualFolderSettingKey = keyof AllPluginResourceSettings;
export interface VirtualFolderSettings extends AllPluginResourceSettings {
name: string;
}
export type GetConfigFunction = <T>(key: VirtualFolderSettingKey) => T | undefined;
export interface SettingDetail<T> {
value: T | undefined;
/** true if the setting is explicitly defined in a settings file, i.e., not from default value */
isExplicitlySet: boolean;
}