@@ -35,12 +35,65 @@ export const BOOLEAN_CLI_ARGS = [
35
35
'verbose' ,
36
36
'version' ,
37
37
'watch' ,
38
+
39
+ // JEST CLI OPTIONS
40
+ 'all' ,
41
+ 'automock' ,
42
+ 'bail' ,
43
+ // 'cache', Stencil already supports this argument
44
+ 'changedFilesWithAncestor' ,
45
+ // 'ci', Stencil already supports this argument
46
+ 'clearCache' ,
47
+ 'clearMocks' ,
48
+ 'collectCoverage' ,
49
+ 'color' ,
50
+ 'colors' ,
51
+ 'coverage' ,
52
+ // 'debug', Stencil already supports this argument
53
+ 'detectLeaks' ,
54
+ 'detectOpenHandles' ,
55
+ 'errorOnDeprecated' ,
56
+ 'expand' ,
57
+ 'findRelatedTests' ,
58
+ 'forceExit' ,
59
+ 'init' ,
60
+ 'injectGlobals' ,
61
+ 'json' ,
62
+ 'lastCommit' ,
63
+ 'listTests' ,
64
+ 'logHeapUsage' ,
65
+ 'noStackTrace' ,
66
+ 'notify' ,
67
+ 'onlyChanged' ,
68
+ 'onlyFailures' ,
69
+ 'passWithNoTests' ,
70
+ 'resetMocks' ,
71
+ 'resetModules' ,
72
+ 'restoreMocks' ,
73
+ 'runInBand' ,
74
+ 'runTestsByPath' ,
75
+ 'showConfig' ,
76
+ 'silent' ,
77
+ 'skipFilter' ,
78
+ 'testLocationInResults' ,
79
+ 'updateSnapshot' ,
80
+ 'useStderr' ,
81
+ // 'verbose', Stencil already supports this argument
82
+ // 'version', Stencil already supports this argument
83
+ // 'watch', Stencil already supports this argument
84
+ 'watchAll' ,
85
+ 'watchman' ,
38
86
] as const ;
39
87
40
88
/**
41
89
* All the Number options supported by the Stencil CLI
42
90
*/
43
- export const NUMBER_CLI_ARGS = [ 'maxWorkers' , 'port' ] as const ;
91
+ export const NUMBER_CLI_ARGS = [
92
+ 'port' ,
93
+ // JEST CLI ARGS
94
+ 'maxConcurrency' ,
95
+ 'testTimeout' ,
96
+ ] as const ;
44
97
45
98
/**
46
99
* All the String options supported by the Stencil CLI
@@ -53,8 +106,71 @@ export const STRING_CLI_ARGS = [
53
106
'emulate' ,
54
107
'root' ,
55
108
'screenshotConnector' ,
109
+
110
+ // JEST CLI ARGS
111
+ 'cacheDirectory' ,
112
+ 'changedSince' ,
113
+ 'collectCoverageFrom' ,
114
+ // 'config', Stencil already supports this argument
115
+ 'coverageDirectory' ,
116
+ 'coverageThreshold' ,
117
+ 'env' ,
118
+ 'filter' ,
119
+ 'globalSetup' ,
120
+ 'globalTeardown' ,
121
+ 'globals' ,
122
+ 'haste' ,
123
+ 'moduleNameMapper' ,
124
+ 'notifyMode' ,
125
+ 'outputFile' ,
126
+ 'preset' ,
127
+ 'prettierPath' ,
128
+ 'resolver' ,
129
+ 'rootDir' ,
130
+ 'runner' ,
131
+ 'testEnvironment' ,
132
+ 'testEnvironmentOptions' ,
133
+ 'testFailureExitCode' ,
134
+ 'testNamePattern' ,
135
+ 'testResultsProcessor' ,
136
+ 'testRunner' ,
137
+ 'testSequencer' ,
138
+ 'testURL' ,
139
+ 'timers' ,
140
+ 'transform' ,
141
+
142
+ // ARRAY ARGS
143
+ 'collectCoverageOnlyFrom' ,
144
+ 'coveragePathIgnorePatterns' ,
145
+ 'coverageReporters' ,
146
+ 'moduleDirectories' ,
147
+ 'moduleFileExtensions' ,
148
+ 'modulePathIgnorePatterns' ,
149
+ 'modulePaths' ,
150
+ 'projects' ,
151
+ 'reporters' ,
152
+ 'roots' ,
153
+ 'selectProjects' ,
154
+ 'setupFiles' ,
155
+ 'setupFilesAfterEnv' ,
156
+ 'snapshotSerializers' ,
157
+ 'testMatch' ,
158
+ 'testPathIgnorePatterns' ,
159
+ 'testPathPattern' ,
160
+ 'testRegex' ,
161
+ 'transformIgnorePatterns' ,
162
+ 'unmockedModulePathPatterns' ,
163
+ 'watchPathIgnorePatterns' ,
56
164
] as const ;
57
165
166
+ /**
167
+ * All the CLI arguments which may have string or number values
168
+ *
169
+ * `maxWorkers` is an argument which is used both by Stencil _and_ by Jest,
170
+ * which means that we need to support parsing both string and number values.
171
+ */
172
+ export const STRING_NUMBER_CLI_ARGS = [ 'maxWorkers' ] as const ;
173
+
58
174
/**
59
175
* All the LogLevel-type options supported by the Stencil CLI
60
176
*
@@ -74,9 +190,10 @@ type ArrayValuesAsUnion<T extends ReadonlyArray<string>> = T[number];
74
190
export type BooleanCLIArg = ArrayValuesAsUnion < typeof BOOLEAN_CLI_ARGS > ;
75
191
export type StringCLIArg = ArrayValuesAsUnion < typeof STRING_CLI_ARGS > ;
76
192
export type NumberCLIArg = ArrayValuesAsUnion < typeof NUMBER_CLI_ARGS > ;
193
+ export type StringNumberCLIArg = ArrayValuesAsUnion < typeof STRING_NUMBER_CLI_ARGS > ;
77
194
export type LogCLIArg = ArrayValuesAsUnion < typeof LOG_LEVEL_CLI_ARGS > ;
78
195
79
- type KnownCLIArg = BooleanCLIArg | StringCLIArg | NumberCLIArg | LogCLIArg ;
196
+ type KnownCLIArg = BooleanCLIArg | StringCLIArg | NumberCLIArg | StringNumberCLIArg | LogCLIArg ;
80
197
81
198
type AliasMap = Partial < Record < KnownCLIArg , string > > ;
82
199
@@ -107,16 +224,25 @@ type ObjectFromKeys<K extends ReadonlyArray<string>, T> = {
107
224
* in ConfigFlags, below
108
225
*/
109
226
type BooleanConfigFlags = ObjectFromKeys < typeof BOOLEAN_CLI_ARGS , boolean > ;
227
+
110
228
/**
111
229
* Type containing the possible String configuration flags, to be included
112
230
* in ConfigFlags, below
113
231
*/
114
232
type StringConfigFlags = ObjectFromKeys < typeof STRING_CLI_ARGS , string > ;
233
+
115
234
/**
116
235
* Type containing the possible numeric configuration flags, to be included
117
236
* in ConfigFlags, below
118
237
*/
119
238
type NumberConfigFlags = ObjectFromKeys < typeof NUMBER_CLI_ARGS , number > ;
239
+
240
+ /**
241
+ * Type containing the configuration flags which may be set to either string
242
+ * or number values.
243
+ */
244
+ type StringNumberConfigFlags = ObjectFromKeys < typeof STRING_NUMBER_CLI_ARGS , string | number > ;
245
+
120
246
/**
121
247
* Type containing the possible LogLevel configuration flags, to be included
122
248
* in ConfigFlags, below
@@ -137,7 +263,12 @@ type LogLevelFlags = ObjectFromKeys<typeof LOG_LEVEL_CLI_ARGS, LogLevel>;
137
263
* options we support and a runtime list of strings which can be used to match
138
264
* on actual flags passed by the user.
139
265
*/
140
- export interface ConfigFlags extends BooleanConfigFlags , StringConfigFlags , NumberConfigFlags , LogLevelFlags {
266
+ export interface ConfigFlags
267
+ extends BooleanConfigFlags ,
268
+ StringConfigFlags ,
269
+ NumberConfigFlags ,
270
+ StringNumberConfigFlags ,
271
+ LogLevelFlags {
141
272
task ?: TaskCommand | null ;
142
273
args ?: string [ ] ;
143
274
knownArgs ?: string [ ] ;
0 commit comments