tstyche 2.0.0-beta.0 → 2.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/tstyche.d.ts +329 -270
- package/build/tstyche.js +2519 -2499
- package/package.json +22 -28
package/build/tstyche.d.ts
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import type ts from 'typescript';
|
|
2
2
|
|
|
3
|
+
declare class DiagnosticOrigin {
|
|
4
|
+
breadcrumbs: Array<string> | undefined;
|
|
5
|
+
end: number;
|
|
6
|
+
sourceFile: ts.SourceFile;
|
|
7
|
+
start: number;
|
|
8
|
+
constructor(start: number, end: number, sourceFile: ts.SourceFile, breadcrumbs?: Array<string>);
|
|
9
|
+
static fromJsonNode(node: ts.Node, sourceFile: ts.SourceFile, skipTrivia: (position: number, sourceFile: ts.SourceFile) => number): DiagnosticOrigin;
|
|
10
|
+
static fromNode(node: ts.Node, breadcrumbs?: Array<string>): DiagnosticOrigin;
|
|
11
|
+
}
|
|
12
|
+
|
|
3
13
|
declare enum DiagnosticCategory {
|
|
4
14
|
Error = "error",
|
|
5
15
|
Warning = "warning"
|
|
6
16
|
}
|
|
7
17
|
|
|
8
|
-
interface DiagnosticOrigin {
|
|
9
|
-
breadcrumbs?: Array<string>;
|
|
10
|
-
end: number;
|
|
11
|
-
file: ts.SourceFile;
|
|
12
|
-
start: number;
|
|
13
|
-
}
|
|
14
18
|
declare class Diagnostic {
|
|
15
|
-
text: string | Array<string>;
|
|
16
19
|
category: DiagnosticCategory;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
code: string | undefined;
|
|
21
|
+
related: Array<Diagnostic> | undefined;
|
|
22
|
+
origin: DiagnosticOrigin | undefined;
|
|
23
|
+
text: string | Array<string>;
|
|
24
|
+
constructor(text: string | Array<string>, category: DiagnosticCategory, origin?: DiagnosticOrigin);
|
|
21
25
|
add(options: {
|
|
22
26
|
code?: string;
|
|
23
27
|
origin?: DiagnosticOrigin;
|
|
@@ -30,10 +34,20 @@ declare class Diagnostic {
|
|
|
30
34
|
static warning(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
|
|
31
35
|
}
|
|
32
36
|
|
|
37
|
+
declare enum CancellationReason {
|
|
38
|
+
ConfigChange = "configChange",
|
|
39
|
+
ConfigError = "configError",
|
|
40
|
+
FailFast = "failFast"
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type CancellationRequestedHandler = (reason: CancellationReason) => void;
|
|
33
44
|
declare class CancellationToken {
|
|
34
45
|
#private;
|
|
35
46
|
get isCancellationRequested(): boolean;
|
|
36
|
-
|
|
47
|
+
get reason(): CancellationReason | undefined;
|
|
48
|
+
cancel(reason: CancellationReason): void;
|
|
49
|
+
onCancellationRequested(handler: CancellationRequestedHandler): void;
|
|
50
|
+
reset(): void;
|
|
37
51
|
}
|
|
38
52
|
|
|
39
53
|
declare class StoreService {
|
|
@@ -52,7 +66,7 @@ declare enum OptionBrand {
|
|
|
52
66
|
String = "string",
|
|
53
67
|
Number = "number",
|
|
54
68
|
Boolean = "boolean",
|
|
55
|
-
|
|
69
|
+
BareTrue = "bareTrue",// a boolean option that does not take a value and when specified is interpreted as 'true'
|
|
56
70
|
List = "list"
|
|
57
71
|
}
|
|
58
72
|
declare enum OptionGroup {
|
|
@@ -73,7 +87,7 @@ interface BaseOptionDefinition {
|
|
|
73
87
|
name: string;
|
|
74
88
|
}
|
|
75
89
|
interface PrimitiveTypeOptionDefinition extends BaseOptionDefinition {
|
|
76
|
-
brand: OptionBrand.String | OptionBrand.Number | OptionBrand.Boolean | OptionBrand.
|
|
90
|
+
brand: OptionBrand.String | OptionBrand.Number | OptionBrand.Boolean | OptionBrand.BareTrue;
|
|
77
91
|
}
|
|
78
92
|
interface ListTypeOptionDefinition extends BaseOptionDefinition {
|
|
79
93
|
brand: OptionBrand.List;
|
|
@@ -137,7 +151,7 @@ interface CommandLineOptions {
|
|
|
137
151
|
*/
|
|
138
152
|
version?: boolean;
|
|
139
153
|
/**
|
|
140
|
-
* Watch for changes and rerun related
|
|
154
|
+
* Watch for changes and rerun related test files.
|
|
141
155
|
*/
|
|
142
156
|
watch?: boolean;
|
|
143
157
|
}
|
|
@@ -164,45 +178,133 @@ interface ConfigFileOptions {
|
|
|
164
178
|
testFileMatch?: Array<string>;
|
|
165
179
|
}
|
|
166
180
|
|
|
167
|
-
interface ResolvedConfig extends Omit<CommandLineOptions, keyof ConfigFileOptions>, Required<ConfigFileOptions> {
|
|
181
|
+
interface ResolvedConfig extends Omit<CommandLineOptions, keyof ConfigFileOptions | "config">, Required<ConfigFileOptions> {
|
|
182
|
+
/**
|
|
183
|
+
* The path to a TSTyche configuration file.
|
|
184
|
+
*/
|
|
185
|
+
configFilePath: string;
|
|
168
186
|
/**
|
|
169
187
|
* Only run test files with matching path.
|
|
170
188
|
*/
|
|
171
189
|
pathMatch: Array<string>;
|
|
172
190
|
}
|
|
191
|
+
declare const defaultOptions: Required<ConfigFileOptions>;
|
|
173
192
|
declare class ConfigService {
|
|
174
193
|
#private;
|
|
175
|
-
compiler: typeof ts;
|
|
176
194
|
constructor(compiler: typeof ts, storeService: StoreService);
|
|
177
|
-
get commandLineOptions(): CommandLineOptions;
|
|
178
|
-
get configFileOptions(): ConfigFileOptions;
|
|
179
|
-
static get defaultOptions(): Required<ConfigFileOptions>;
|
|
180
195
|
parseCommandLine(commandLineArgs: Array<string>): Promise<void>;
|
|
181
196
|
readConfigFile(): Promise<void>;
|
|
182
197
|
resolveConfig(): ResolvedConfig;
|
|
183
198
|
}
|
|
184
199
|
|
|
185
|
-
declare class
|
|
200
|
+
declare class OptionDiagnosticText {
|
|
186
201
|
#private;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
202
|
+
static doubleQuotesExpected(): string;
|
|
203
|
+
static expectsListItemType(optionName: string, optionBrand: OptionBrand): string;
|
|
204
|
+
static expectsValue(optionName: string, optionGroup: OptionGroup): string;
|
|
205
|
+
static fileDoesNotExist(filePath: string): string;
|
|
206
|
+
static noTestFilesWereLeft(resolvedConfig: ResolvedConfig): Array<string>;
|
|
207
|
+
static noTestFilesWereSelected(resolvedConfig: ResolvedConfig): Array<string>;
|
|
208
|
+
static testFileMatchCannotStartWith(segment: string): Array<string>;
|
|
209
|
+
static requiresValueType(optionName: string, optionBrand: OptionBrand, optionGroup: OptionGroup): string;
|
|
210
|
+
static unknownOption(optionName: string): string;
|
|
211
|
+
static versionIsNotSupported(value: string): string;
|
|
212
|
+
static watchCannotBeEnabledInCiEnvironment(): string;
|
|
213
|
+
static watchIsNotAvailable(): string;
|
|
191
214
|
}
|
|
192
215
|
|
|
193
|
-
declare
|
|
216
|
+
declare enum Color {
|
|
217
|
+
Reset = "0",
|
|
218
|
+
Red = "31",
|
|
219
|
+
Green = "32",
|
|
220
|
+
Yellow = "33",
|
|
221
|
+
Blue = "34",
|
|
222
|
+
Magenta = "35",
|
|
223
|
+
Cyan = "36",
|
|
224
|
+
Gray = "90"
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
type ElementChildren = Array<ElementChildren> | ScribblerJsx.Element | string | undefined;
|
|
228
|
+
type ComponentConstructor = new (props: Record<string, unknown>) => ScribblerJsx.ElementClass;
|
|
229
|
+
declare namespace ScribblerJsx {
|
|
230
|
+
interface Element {
|
|
231
|
+
props: Record<string, unknown>;
|
|
232
|
+
type: ComponentConstructor | string;
|
|
233
|
+
}
|
|
234
|
+
interface ElementAttributesProperty {
|
|
235
|
+
props: Record<string, unknown>;
|
|
236
|
+
}
|
|
237
|
+
interface ElementClass {
|
|
238
|
+
render: () => ScribblerJsx.Element;
|
|
239
|
+
}
|
|
240
|
+
interface ElementChildrenAttribute {
|
|
241
|
+
children: ElementChildren;
|
|
242
|
+
}
|
|
243
|
+
interface IntrinsicElements {
|
|
244
|
+
ansi: {
|
|
245
|
+
escapes: Color | Array<Color>;
|
|
246
|
+
};
|
|
247
|
+
newLine: {
|
|
248
|
+
[key: string]: never;
|
|
249
|
+
};
|
|
250
|
+
text: {
|
|
251
|
+
children: Array<ElementChildren>;
|
|
252
|
+
indent: number;
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
interface LineProps {
|
|
258
|
+
children?: ScribblerJsx.ElementChildrenAttribute["children"];
|
|
259
|
+
color?: Color;
|
|
260
|
+
indent?: number;
|
|
261
|
+
}
|
|
262
|
+
declare class Line implements ScribblerJsx.ElementClass {
|
|
263
|
+
props: LineProps;
|
|
264
|
+
constructor(props: LineProps);
|
|
265
|
+
render(): ScribblerJsx.Element;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
interface ScribblerOptions {
|
|
269
|
+
newLine?: string;
|
|
270
|
+
noColor?: boolean;
|
|
271
|
+
}
|
|
272
|
+
declare class Scribbler {
|
|
194
273
|
#private;
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
constructor(resolvedConfig: ResolvedConfig, storeService: StoreService);
|
|
198
|
-
run(testFiles: Array<string | URL>): Promise<void>;
|
|
199
|
-
watch(testFiles: Array<string>, selectService: SelectService): Promise<void>;
|
|
274
|
+
constructor(options?: ScribblerOptions);
|
|
275
|
+
render(element: ScribblerJsx.Element): string;
|
|
200
276
|
}
|
|
201
277
|
|
|
202
|
-
|
|
278
|
+
interface TextProps {
|
|
279
|
+
children?: ScribblerJsx.ElementChildrenAttribute["children"];
|
|
280
|
+
color?: Color | undefined;
|
|
281
|
+
indent?: number | undefined;
|
|
282
|
+
}
|
|
283
|
+
declare class Text implements ScribblerJsx.ElementClass {
|
|
284
|
+
props: TextProps;
|
|
285
|
+
constructor(props: TextProps);
|
|
286
|
+
render(): ScribblerJsx.Element;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
declare function addsPackageStepText(compilerVersion: string, installationPath: string): ScribblerJsx.Element;
|
|
290
|
+
|
|
291
|
+
declare function describeNameText(name: string, indent?: number): ScribblerJsx.Element;
|
|
292
|
+
|
|
293
|
+
declare function diagnosticText(diagnostic: Diagnostic): ScribblerJsx.Element;
|
|
294
|
+
|
|
295
|
+
declare class TestFile {
|
|
203
296
|
#private;
|
|
204
|
-
|
|
205
|
-
|
|
297
|
+
path: string;
|
|
298
|
+
position: number | undefined;
|
|
299
|
+
constructor(identifier: string | URL, position?: number);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
declare class TestTree {
|
|
303
|
+
diagnostics: Set<ts.Diagnostic>;
|
|
304
|
+
members: Array<TestMember | Assertion>;
|
|
305
|
+
sourceFile: ts.SourceFile;
|
|
306
|
+
constructor(diagnostics: Set<ts.Diagnostic>, sourceFile: ts.SourceFile);
|
|
307
|
+
get hasOnly(): boolean;
|
|
206
308
|
}
|
|
207
309
|
|
|
208
310
|
declare enum TestMemberBrand {
|
|
@@ -218,25 +320,15 @@ declare enum TestMemberFlags {
|
|
|
218
320
|
Todo = 8
|
|
219
321
|
}
|
|
220
322
|
|
|
221
|
-
declare class TestTree {
|
|
222
|
-
compiler: typeof ts;
|
|
223
|
-
diagnostics: Set<ts.Diagnostic>;
|
|
224
|
-
sourceFile: ts.SourceFile;
|
|
225
|
-
members: Array<TestMember | Assertion>;
|
|
226
|
-
constructor(compiler: typeof ts, diagnostics: Set<ts.Diagnostic>, sourceFile: ts.SourceFile);
|
|
227
|
-
get hasOnly(): boolean;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
323
|
declare class TestMember {
|
|
231
324
|
brand: TestMemberBrand;
|
|
232
|
-
node: ts.CallExpression;
|
|
233
|
-
parent: TestTree | TestMember;
|
|
234
|
-
flags: TestMemberFlags;
|
|
235
|
-
compiler: typeof ts;
|
|
236
325
|
diagnostics: Set<ts.Diagnostic>;
|
|
326
|
+
flags: TestMemberFlags;
|
|
237
327
|
members: Array<TestMember | Assertion>;
|
|
238
328
|
name: string;
|
|
239
|
-
|
|
329
|
+
node: ts.CallExpression;
|
|
330
|
+
parent: TestTree | TestMember;
|
|
331
|
+
constructor(compiler: typeof ts, brand: TestMemberBrand, node: ts.CallExpression, parent: TestTree | TestMember, flags: TestMemberFlags);
|
|
240
332
|
get ancestorNames(): Array<string>;
|
|
241
333
|
validate(): Array<Diagnostic>;
|
|
242
334
|
}
|
|
@@ -245,11 +337,11 @@ interface MatcherNode extends ts.CallExpression {
|
|
|
245
337
|
expression: ts.PropertyAccessExpression;
|
|
246
338
|
}
|
|
247
339
|
declare class Assertion extends TestMember {
|
|
340
|
+
isNot: boolean;
|
|
248
341
|
matcherNode: MatcherNode;
|
|
249
342
|
modifierNode: ts.PropertyAccessExpression;
|
|
250
343
|
notNode: ts.PropertyAccessExpression | undefined;
|
|
251
|
-
|
|
252
|
-
constructor(brand: TestMemberBrand, node: ts.CallExpression, parent: TestTree | TestMember, flags: TestMemberFlags, matcherNode: MatcherNode, modifierNode: ts.PropertyAccessExpression, notNode: ts.PropertyAccessExpression | undefined);
|
|
344
|
+
constructor(compiler: typeof ts, brand: TestMemberBrand, node: ts.CallExpression, parent: TestTree | TestMember, flags: TestMemberFlags, matcherNode: MatcherNode, modifierNode: ts.PropertyAccessExpression, notNode?: ts.PropertyAccessExpression);
|
|
253
345
|
get ancestorNames(): Array<string>;
|
|
254
346
|
get matcherName(): ts.MemberName;
|
|
255
347
|
get source(): ts.NodeArray<ts.Expression> | ts.NodeArray<ts.TypeNode>;
|
|
@@ -258,42 +350,10 @@ declare class Assertion extends TestMember {
|
|
|
258
350
|
|
|
259
351
|
declare class CollectService {
|
|
260
352
|
#private;
|
|
261
|
-
compiler: typeof ts;
|
|
262
|
-
readonly matcherIdentifiers: string[];
|
|
263
|
-
readonly modifierIdentifiers: string[];
|
|
264
|
-
readonly notIdentifier = "not";
|
|
265
353
|
constructor(compiler: typeof ts);
|
|
266
354
|
createTestTree(sourceFile: ts.SourceFile, semanticDiagnostics?: Array<ts.Diagnostic>): TestTree;
|
|
267
355
|
}
|
|
268
356
|
|
|
269
|
-
declare class Environment {
|
|
270
|
-
#private;
|
|
271
|
-
/**
|
|
272
|
-
* Is `true` if the process is running in a continuous integration environment.
|
|
273
|
-
*/
|
|
274
|
-
static get isCi(): boolean;
|
|
275
|
-
/**
|
|
276
|
-
* Specifies whether color should be disabled in the output.
|
|
277
|
-
*/
|
|
278
|
-
static get noColor(): boolean;
|
|
279
|
-
/**
|
|
280
|
-
* Specifies whether interactive elements should be disabled in the output.
|
|
281
|
-
*/
|
|
282
|
-
static get noInteractive(): boolean;
|
|
283
|
-
/**
|
|
284
|
-
* The directory where to store the 'typescript' packages.
|
|
285
|
-
*/
|
|
286
|
-
static get storePath(): string;
|
|
287
|
-
/**
|
|
288
|
-
* The number of seconds to wait before giving up stale operations.
|
|
289
|
-
*/
|
|
290
|
-
static get timeout(): number;
|
|
291
|
-
/**
|
|
292
|
-
* The path to the currently installed TypeScript module.
|
|
293
|
-
*/
|
|
294
|
-
static get typescriptPath(): string | undefined;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
357
|
declare class ResultTiming {
|
|
298
358
|
end: number;
|
|
299
359
|
start: number;
|
|
@@ -310,11 +370,11 @@ declare enum ResultStatus {
|
|
|
310
370
|
|
|
311
371
|
declare class ExpectResult {
|
|
312
372
|
assertion: Assertion;
|
|
313
|
-
parent: TestResult | undefined;
|
|
314
373
|
diagnostics: Array<Diagnostic>;
|
|
374
|
+
parent: TestResult | undefined;
|
|
315
375
|
status: ResultStatus;
|
|
316
376
|
timing: ResultTiming;
|
|
317
|
-
constructor(assertion: Assertion, parent
|
|
377
|
+
constructor(assertion: Assertion, parent?: TestResult);
|
|
318
378
|
}
|
|
319
379
|
|
|
320
380
|
declare class ResultCount {
|
|
@@ -326,14 +386,14 @@ declare class ResultCount {
|
|
|
326
386
|
}
|
|
327
387
|
|
|
328
388
|
declare class TestResult {
|
|
329
|
-
test: TestMember;
|
|
330
|
-
parent: DescribeResult | undefined;
|
|
331
389
|
diagnostics: Array<Diagnostic>;
|
|
332
390
|
expectCount: ResultCount;
|
|
391
|
+
parent: DescribeResult | undefined;
|
|
333
392
|
results: Array<ExpectResult>;
|
|
334
393
|
status: ResultStatus;
|
|
394
|
+
test: TestMember;
|
|
335
395
|
timing: ResultTiming;
|
|
336
|
-
constructor(test: TestMember, parent
|
|
396
|
+
constructor(test: TestMember, parent?: DescribeResult);
|
|
337
397
|
}
|
|
338
398
|
|
|
339
399
|
declare class DescribeResult {
|
|
@@ -341,62 +401,55 @@ declare class DescribeResult {
|
|
|
341
401
|
parent: DescribeResult | undefined;
|
|
342
402
|
results: Array<DescribeResult | TestResult>;
|
|
343
403
|
timing: ResultTiming;
|
|
344
|
-
constructor(describe: TestMember, parent
|
|
404
|
+
constructor(describe: TestMember, parent?: DescribeResult);
|
|
345
405
|
}
|
|
346
406
|
|
|
347
407
|
type FileResultStatus = ResultStatus.Runs | ResultStatus.Passed | ResultStatus.Failed;
|
|
348
408
|
declare class FileResult {
|
|
349
|
-
testFile: URL;
|
|
350
409
|
diagnostics: Array<Diagnostic>;
|
|
351
410
|
expectCount: ResultCount;
|
|
352
411
|
results: Array<DescribeResult | TestResult | ExpectResult>;
|
|
353
412
|
status: FileResultStatus;
|
|
354
413
|
testCount: ResultCount;
|
|
414
|
+
testFile: TestFile;
|
|
355
415
|
timing: ResultTiming;
|
|
356
|
-
constructor(testFile:
|
|
416
|
+
constructor(testFile: TestFile);
|
|
357
417
|
}
|
|
358
418
|
|
|
359
419
|
declare class ProjectResult {
|
|
360
420
|
compilerVersion: string;
|
|
361
|
-
projectConfigFilePath: string | undefined;
|
|
362
421
|
diagnostics: Array<Diagnostic>;
|
|
422
|
+
projectConfigFilePath: string | undefined;
|
|
363
423
|
results: Array<FileResult>;
|
|
364
424
|
constructor(compilerVersion: string, projectConfigFilePath: string | undefined);
|
|
365
425
|
}
|
|
366
426
|
|
|
367
427
|
type TargetResultStatus = ResultStatus.Runs | ResultStatus.Passed | ResultStatus.Failed;
|
|
368
428
|
declare class TargetResult {
|
|
369
|
-
versionTag: string;
|
|
370
|
-
testFiles: Array<URL>;
|
|
371
429
|
results: Map<string | undefined, ProjectResult>;
|
|
372
430
|
status: TargetResultStatus;
|
|
431
|
+
testFiles: Array<TestFile>;
|
|
373
432
|
timing: ResultTiming;
|
|
374
|
-
|
|
433
|
+
versionTag: string;
|
|
434
|
+
constructor(versionTag: string, testFiles: Array<TestFile>);
|
|
375
435
|
}
|
|
376
436
|
|
|
377
437
|
declare class Result {
|
|
378
|
-
resolvedConfig: ResolvedConfig;
|
|
379
|
-
testFiles: Array<URL>;
|
|
380
438
|
expectCount: ResultCount;
|
|
381
439
|
fileCount: ResultCount;
|
|
440
|
+
resolvedConfig: ResolvedConfig;
|
|
382
441
|
results: Array<TargetResult>;
|
|
383
442
|
targetCount: ResultCount;
|
|
384
443
|
testCount: ResultCount;
|
|
444
|
+
testFiles: Array<TestFile>;
|
|
385
445
|
timing: ResultTiming;
|
|
386
|
-
constructor(resolvedConfig: ResolvedConfig, testFiles: Array<
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
declare class ResultManager {
|
|
390
|
-
#private;
|
|
391
|
-
handleEvent([eventName, payload]: Event): void;
|
|
446
|
+
constructor(resolvedConfig: ResolvedConfig, testFiles: Array<TestFile>);
|
|
392
447
|
}
|
|
393
448
|
|
|
394
449
|
type Event = ["config:error", {
|
|
395
450
|
diagnostics: Array<Diagnostic>;
|
|
396
451
|
}] | ["deprecation:info", {
|
|
397
452
|
diagnostics: Array<Diagnostic>;
|
|
398
|
-
}] | ["input:info", {
|
|
399
|
-
key: string;
|
|
400
453
|
}] | ["select:error", {
|
|
401
454
|
diagnostics: Array<Diagnostic>;
|
|
402
455
|
}] | ["run:start", {
|
|
@@ -453,13 +506,118 @@ type Event = ["config:error", {
|
|
|
453
506
|
result: ExpectResult;
|
|
454
507
|
}] | ["expect:skip", {
|
|
455
508
|
result: ExpectResult;
|
|
509
|
+
}] | ["watch:error", {
|
|
510
|
+
diagnostics: Array<Diagnostic>;
|
|
456
511
|
}];
|
|
457
|
-
|
|
512
|
+
interface EventHandler {
|
|
513
|
+
handleEvent: (event: Event) => void;
|
|
514
|
+
}
|
|
458
515
|
declare class EventEmitter {
|
|
459
516
|
#private;
|
|
460
|
-
|
|
517
|
+
addHandler(handler: EventHandler): void;
|
|
461
518
|
static dispatch(event: Event): void;
|
|
462
|
-
|
|
519
|
+
removeHandler(handler: EventHandler): void;
|
|
520
|
+
removeHandlers(): void;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
declare class ResultHandler {
|
|
524
|
+
#private;
|
|
525
|
+
handleEvent([eventName, payload]: Event): void;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
declare function fileStatusText(status: FileResultStatus, testFile: TestFile): ScribblerJsx.Element;
|
|
529
|
+
|
|
530
|
+
declare function fileViewText(lines: Array<ScribblerJsx.Element>, addEmptyFinalLine: boolean): ScribblerJsx.Element;
|
|
531
|
+
|
|
532
|
+
declare function formattedText(input: string | Array<string> | Record<string, unknown>): ScribblerJsx.Element;
|
|
533
|
+
|
|
534
|
+
declare function helpText(optionDefinitions: Map<string, OptionDefinition>, tstycheVersion: string): ScribblerJsx.Element;
|
|
535
|
+
|
|
536
|
+
interface WriteStream {
|
|
537
|
+
write: (log: string) => void;
|
|
538
|
+
}
|
|
539
|
+
interface OutputServiceOptions {
|
|
540
|
+
noColor?: boolean;
|
|
541
|
+
stderr?: WriteStream;
|
|
542
|
+
stdout?: WriteStream;
|
|
543
|
+
}
|
|
544
|
+
declare class OutputService {
|
|
545
|
+
#private;
|
|
546
|
+
constructor(options?: OutputServiceOptions);
|
|
547
|
+
clearTerminal(): void;
|
|
548
|
+
eraseLastLine(): void;
|
|
549
|
+
writeError(body: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
|
|
550
|
+
writeMessage(body: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
|
|
551
|
+
writeWarning(body: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
declare function summaryText({ duration, expectCount, fileCount, onlyMatch, pathMatch, skipMatch, targetCount, testCount, }: {
|
|
555
|
+
duration: number;
|
|
556
|
+
expectCount: ResultCount;
|
|
557
|
+
fileCount: ResultCount;
|
|
558
|
+
onlyMatch: string | undefined;
|
|
559
|
+
pathMatch: Array<string>;
|
|
560
|
+
skipMatch: string | undefined;
|
|
561
|
+
targetCount: ResultCount;
|
|
562
|
+
testCount: ResultCount;
|
|
563
|
+
}): ScribblerJsx.Element;
|
|
564
|
+
|
|
565
|
+
declare function testNameText(status: "fail" | "pass" | "skip" | "todo", name: string, indent?: number): ScribblerJsx.Element;
|
|
566
|
+
|
|
567
|
+
declare function usesCompilerStepText(compilerVersion: string, tsconfigFilePath: string | undefined, options?: {
|
|
568
|
+
prependEmptyLine: boolean;
|
|
569
|
+
}): ScribblerJsx.Element;
|
|
570
|
+
|
|
571
|
+
declare function waitingForFileChangesText(): ScribblerJsx.Element;
|
|
572
|
+
|
|
573
|
+
declare function watchUsageText(): ScribblerJsx.Element;
|
|
574
|
+
|
|
575
|
+
declare class SelectService {
|
|
576
|
+
#private;
|
|
577
|
+
constructor(resolvedConfig: ResolvedConfig);
|
|
578
|
+
isTestFile(filePath: string): boolean;
|
|
579
|
+
selectFiles(): Promise<Array<string>>;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
declare class TSTyche {
|
|
583
|
+
#private;
|
|
584
|
+
static version: string;
|
|
585
|
+
constructor(resolvedConfig: ResolvedConfig, outputService: OutputService, selectService: SelectService, storeService: StoreService);
|
|
586
|
+
close(): void;
|
|
587
|
+
run(testFiles: Array<string | URL>, cancellationToken?: CancellationToken): Promise<void>;
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
declare class Cli {
|
|
591
|
+
#private;
|
|
592
|
+
run(commandLineArguments: Array<string>, cancellationToken?: CancellationToken): Promise<void>;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
declare class Environment {
|
|
596
|
+
#private;
|
|
597
|
+
/**
|
|
598
|
+
* Is `true` if the process is running in a continuous integration environment.
|
|
599
|
+
*/
|
|
600
|
+
static get isCi(): boolean;
|
|
601
|
+
/**
|
|
602
|
+
* Specifies whether color should be disabled in the output.
|
|
603
|
+
*/
|
|
604
|
+
static get noColor(): boolean;
|
|
605
|
+
/**
|
|
606
|
+
* Specifies whether interactive elements should be disabled in the output.
|
|
607
|
+
*/
|
|
608
|
+
static get noInteractive(): boolean;
|
|
609
|
+
/**
|
|
610
|
+
* The directory where to store the 'typescript' packages.
|
|
611
|
+
*/
|
|
612
|
+
static get storePath(): string;
|
|
613
|
+
/**
|
|
614
|
+
* The number of seconds to wait before giving up stale operations.
|
|
615
|
+
*/
|
|
616
|
+
static get timeout(): number;
|
|
617
|
+
/**
|
|
618
|
+
* The path to the currently installed TypeScript module.
|
|
619
|
+
*/
|
|
620
|
+
static get typescriptPath(): string | undefined;
|
|
463
621
|
}
|
|
464
622
|
|
|
465
623
|
interface MatchResult {
|
|
@@ -484,10 +642,10 @@ declare class PrimitiveTypeMatcher {
|
|
|
484
642
|
}
|
|
485
643
|
|
|
486
644
|
declare abstract class RelationMatcherBase {
|
|
487
|
-
typeChecker: TypeChecker;
|
|
488
645
|
abstract relation: Relation;
|
|
489
646
|
abstract relationExplanationText: string;
|
|
490
647
|
relationExplanationVerb: string;
|
|
648
|
+
typeChecker: TypeChecker;
|
|
491
649
|
constructor(typeChecker: TypeChecker);
|
|
492
650
|
protected explain(sourceType: ts.Type, targetType: ts.Type, isNot: boolean): Array<Diagnostic>;
|
|
493
651
|
match(sourceType: ts.Type, targetType: ts.Type, isNot: boolean): MatchResult;
|
|
@@ -536,8 +694,6 @@ declare class ToRaiseError {
|
|
|
536
694
|
|
|
537
695
|
declare class Expect {
|
|
538
696
|
#private;
|
|
539
|
-
compiler: typeof ts;
|
|
540
|
-
typeChecker: TypeChecker;
|
|
541
697
|
toBe: ToBe;
|
|
542
698
|
toBeAny: PrimitiveTypeMatcher;
|
|
543
699
|
toBeAssignable: ToBeAssignableWith;
|
|
@@ -563,83 +719,68 @@ declare class Expect {
|
|
|
563
719
|
match(assertion: Assertion, expectResult: ExpectResult): MatchResult | undefined;
|
|
564
720
|
}
|
|
565
721
|
|
|
566
|
-
|
|
567
|
-
on: (event: "data", listener: (chunk: string) => void) => this;
|
|
568
|
-
setEncoding: (encoding: "utf8") => this;
|
|
569
|
-
setRawMode?: (mode: boolean) => this;
|
|
570
|
-
unref: () => this;
|
|
571
|
-
}
|
|
572
|
-
interface InputServiceOptions {
|
|
573
|
-
stdin?: ReadStream;
|
|
574
|
-
}
|
|
575
|
-
declare class InputService {
|
|
722
|
+
declare class CancellationHandler implements EventHandler {
|
|
576
723
|
#private;
|
|
577
|
-
constructor(
|
|
578
|
-
|
|
724
|
+
constructor(cancellationToken: CancellationToken, cancellationReason: CancellationReason);
|
|
725
|
+
handleEvent([, payload]: Event): void;
|
|
579
726
|
}
|
|
580
727
|
|
|
581
|
-
declare
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
728
|
+
declare class ExitCodeHandler implements EventHandler {
|
|
729
|
+
#private;
|
|
730
|
+
handleEvent([eventName, payload]: Event): void;
|
|
731
|
+
resetCode(): void;
|
|
732
|
+
}
|
|
586
733
|
|
|
587
|
-
declare
|
|
734
|
+
declare class RuntimeReporter implements EventHandler {
|
|
735
|
+
#private;
|
|
736
|
+
constructor(resolvedConfig: ResolvedConfig, outputService: OutputService);
|
|
737
|
+
handleEvent([eventName, payload]: Event): void;
|
|
738
|
+
}
|
|
588
739
|
|
|
589
|
-
declare
|
|
740
|
+
declare class SetupReporter implements EventHandler {
|
|
741
|
+
#private;
|
|
742
|
+
constructor(outputService: OutputService);
|
|
743
|
+
handleEvent([eventName, payload]: Event): void;
|
|
744
|
+
}
|
|
590
745
|
|
|
591
|
-
declare
|
|
746
|
+
declare class SummaryReporter implements EventHandler {
|
|
747
|
+
#private;
|
|
748
|
+
constructor(outputService: OutputService);
|
|
749
|
+
handleEvent([eventName, payload]: Event): void;
|
|
750
|
+
}
|
|
592
751
|
|
|
593
|
-
declare
|
|
752
|
+
declare class WatchReporter implements EventHandler {
|
|
753
|
+
#private;
|
|
754
|
+
constructor(outputService: OutputService);
|
|
755
|
+
handleEvent([eventName, payload]: Event): void;
|
|
756
|
+
}
|
|
594
757
|
|
|
595
|
-
|
|
596
|
-
|
|
758
|
+
type InputHandler = (chunk: Buffer) => void;
|
|
759
|
+
interface ReadStream {
|
|
760
|
+
addListener: (event: "data", handler: InputHandler) => this;
|
|
761
|
+
removeListener: (event: "data", handler: InputHandler) => this;
|
|
762
|
+
setRawMode?: (mode: boolean) => this;
|
|
763
|
+
unref: () => this;
|
|
597
764
|
}
|
|
598
|
-
interface
|
|
599
|
-
|
|
600
|
-
stderr?: WriteStream;
|
|
601
|
-
stdout?: WriteStream;
|
|
765
|
+
interface InputServiceOptions {
|
|
766
|
+
stdin?: ReadStream;
|
|
602
767
|
}
|
|
603
|
-
declare class
|
|
768
|
+
declare class InputService {
|
|
604
769
|
#private;
|
|
605
|
-
constructor(options?:
|
|
606
|
-
|
|
607
|
-
eraseLastLine(): void;
|
|
608
|
-
writeError(body: JSX.Element | Array<JSX.Element>): void;
|
|
609
|
-
writeMessage(body: JSX.Element | Array<JSX.Element>): void;
|
|
610
|
-
writeWarning(body: JSX.Element | Array<JSX.Element>): void;
|
|
770
|
+
constructor(onInput: InputHandler, options?: InputServiceOptions);
|
|
771
|
+
close(): void;
|
|
611
772
|
}
|
|
612
773
|
|
|
613
|
-
declare function summaryText({ duration, expectCount, fileCount, onlyMatch, pathMatch, skipMatch, targetCount, testCount, }: {
|
|
614
|
-
duration: number;
|
|
615
|
-
expectCount: ResultCount;
|
|
616
|
-
fileCount: ResultCount;
|
|
617
|
-
onlyMatch: string | undefined;
|
|
618
|
-
pathMatch: Array<string>;
|
|
619
|
-
skipMatch: string | undefined;
|
|
620
|
-
targetCount: ResultCount;
|
|
621
|
-
testCount: ResultCount;
|
|
622
|
-
}): JSX.Element;
|
|
623
|
-
|
|
624
|
-
declare function testNameText(status: "fail" | "pass" | "skip" | "todo", name: string, indent?: number): JSX.Element;
|
|
625
|
-
|
|
626
|
-
declare function usesCompilerStepText(compilerVersion: string, tsconfigFilePath: string | undefined, options?: {
|
|
627
|
-
prependEmptyLine: boolean;
|
|
628
|
-
}): JSX.Element;
|
|
629
|
-
|
|
630
|
-
declare function watchModeUsageText(): JSX.Element;
|
|
631
|
-
|
|
632
774
|
declare class Path {
|
|
775
|
+
static normalizeSlashes: (filePath: string) => string;
|
|
633
776
|
static dirname(filePath: string): string;
|
|
634
777
|
static join(...filePaths: Array<string>): string;
|
|
635
|
-
static normalizeSlashes(filePath: string): string;
|
|
636
778
|
static relative(from: string, to: string): string;
|
|
637
779
|
static resolve(...filePaths: Array<string>): string;
|
|
638
780
|
}
|
|
639
781
|
|
|
640
782
|
declare class ProjectService {
|
|
641
783
|
#private;
|
|
642
|
-
compiler: typeof ts;
|
|
643
784
|
constructor(compiler: typeof ts);
|
|
644
785
|
closeFile(filePath: string): void;
|
|
645
786
|
getDefaultProject(filePath: string): ts.server.Project | undefined;
|
|
@@ -647,109 +788,11 @@ declare class ProjectService {
|
|
|
647
788
|
openFile(filePath: string, sourceText?: string | undefined, projectRootPath?: string | undefined): void;
|
|
648
789
|
}
|
|
649
790
|
|
|
650
|
-
declare abstract class Reporter {
|
|
651
|
-
readonly resolvedConfig: ResolvedConfig;
|
|
652
|
-
protected outputService: OutputService;
|
|
653
|
-
constructor(resolvedConfig: ResolvedConfig);
|
|
654
|
-
abstract handleEvent([eventName, payload]: Event): void;
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
declare class SummaryReporter extends Reporter {
|
|
658
|
-
handleEvent([eventName, payload]: Event): void;
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
declare class ThoroughReporter extends Reporter {
|
|
662
|
-
#private;
|
|
663
|
-
handleEvent([eventName, payload]: Event): void;
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
declare class WatchModeReporter extends Reporter {
|
|
667
|
-
handleEvent([eventName]: Event): void;
|
|
668
|
-
}
|
|
669
|
-
|
|
670
791
|
declare class TaskRunner {
|
|
671
792
|
#private;
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
run(testFiles: Array<
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
declare enum Color {
|
|
678
|
-
Reset = "0",
|
|
679
|
-
Red = "31",
|
|
680
|
-
Green = "32",
|
|
681
|
-
Yellow = "33",
|
|
682
|
-
Blue = "34",
|
|
683
|
-
Magenta = "35",
|
|
684
|
-
Cyan = "36",
|
|
685
|
-
Gray = "90"
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
interface LineProps {
|
|
689
|
-
children?: JSX.ElementChildrenAttribute["children"];
|
|
690
|
-
color?: Color;
|
|
691
|
-
indent?: number;
|
|
692
|
-
}
|
|
693
|
-
declare class Line implements JSX.ElementClass {
|
|
694
|
-
readonly props: LineProps;
|
|
695
|
-
constructor(props: LineProps);
|
|
696
|
-
render(): JSX.Element;
|
|
697
|
-
}
|
|
698
|
-
|
|
699
|
-
type ElementChildren = Array<ElementChildren> | JSX.Element | string | undefined;
|
|
700
|
-
type ComponentConstructor = new (props: Record<string, unknown>) => JSX.ElementClass;
|
|
701
|
-
declare global {
|
|
702
|
-
namespace JSX {
|
|
703
|
-
interface Element {
|
|
704
|
-
$$typeof: symbol;
|
|
705
|
-
children: ElementChildren;
|
|
706
|
-
props: Record<string, unknown> | null;
|
|
707
|
-
type: ComponentConstructor | string;
|
|
708
|
-
}
|
|
709
|
-
interface ElementAttributesProperty {
|
|
710
|
-
props: Record<string, unknown> | null;
|
|
711
|
-
}
|
|
712
|
-
interface ElementClass {
|
|
713
|
-
render: () => JSX.Element | null;
|
|
714
|
-
}
|
|
715
|
-
interface ElementChildrenAttribute {
|
|
716
|
-
children: ElementChildren;
|
|
717
|
-
}
|
|
718
|
-
interface IntrinsicElements {
|
|
719
|
-
ansi: {
|
|
720
|
-
children?: never;
|
|
721
|
-
escapes: Color | Array<Color>;
|
|
722
|
-
};
|
|
723
|
-
newLine: {
|
|
724
|
-
children?: never;
|
|
725
|
-
};
|
|
726
|
-
text: {
|
|
727
|
-
children: ElementChildren;
|
|
728
|
-
indent?: number | undefined;
|
|
729
|
-
};
|
|
730
|
-
}
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
interface ScribblerOptions {
|
|
734
|
-
newLine?: string;
|
|
735
|
-
noColor?: boolean;
|
|
736
|
-
}
|
|
737
|
-
declare class Scribbler {
|
|
738
|
-
#private;
|
|
739
|
-
constructor(options?: ScribblerOptions);
|
|
740
|
-
static createElement(type: ComponentConstructor | string, props: Record<string, unknown> | null, ...children: Array<ElementChildren>): JSX.Element;
|
|
741
|
-
render(element: JSX.Element | null): string;
|
|
742
|
-
}
|
|
743
|
-
|
|
744
|
-
interface TextProps {
|
|
745
|
-
children?: JSX.ElementChildrenAttribute["children"];
|
|
746
|
-
color?: Color | undefined;
|
|
747
|
-
indent?: number | undefined;
|
|
748
|
-
}
|
|
749
|
-
declare class Text implements JSX.ElementClass {
|
|
750
|
-
readonly props: TextProps;
|
|
751
|
-
constructor(props: TextProps);
|
|
752
|
-
render(): JSX.Element;
|
|
793
|
+
constructor(resolvedConfig: ResolvedConfig, selectService: SelectService, storeService: StoreService);
|
|
794
|
+
close(): void;
|
|
795
|
+
run(testFiles: Array<TestFile>, cancellationToken?: CancellationToken): Promise<void>;
|
|
753
796
|
}
|
|
754
797
|
|
|
755
798
|
declare class Version {
|
|
@@ -759,12 +802,28 @@ declare class Version {
|
|
|
759
802
|
static isVersionTag(target: string): boolean;
|
|
760
803
|
}
|
|
761
804
|
|
|
762
|
-
type
|
|
805
|
+
type WatchHandler = (filePath: string) => void | Promise<void>;
|
|
806
|
+
interface WatcherOptions {
|
|
807
|
+
recursive?: boolean;
|
|
808
|
+
}
|
|
763
809
|
declare class Watcher {
|
|
764
810
|
#private;
|
|
765
|
-
|
|
766
|
-
|
|
811
|
+
constructor(targetPath: string, onChanged: WatchHandler, onRemoved?: WatchHandler, options?: WatcherOptions);
|
|
812
|
+
close(): void;
|
|
767
813
|
watch(): Promise<void>;
|
|
768
814
|
}
|
|
769
815
|
|
|
770
|
-
|
|
816
|
+
type FileWatchHandler = () => void | Promise<void>;
|
|
817
|
+
declare class FileWatcher extends Watcher {
|
|
818
|
+
constructor(targetPath: string, onChanged: FileWatchHandler);
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
type RunCallback = (testFiles: Array<TestFile>) => Promise<void>;
|
|
822
|
+
declare class WatchService {
|
|
823
|
+
#private;
|
|
824
|
+
constructor(resolvedConfig: ResolvedConfig, runCallback: RunCallback, selectService: SelectService, testFiles: Array<TestFile>);
|
|
825
|
+
close(): void;
|
|
826
|
+
watch(cancellationToken?: CancellationToken): Promise<Array<void>>;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
export { Assertion, CancellationHandler, CancellationReason, CancellationToken, Cli, CollectService, Color, type CommandLineOptions, type ConfigFileOptions, ConfigService, DescribeResult, Diagnostic, DiagnosticCategory, DiagnosticOrigin, Environment, type Event, EventEmitter, type EventHandler, ExitCodeHandler, Expect, ExpectResult, FileResult, type FileResultStatus, type FileWatchHandler, FileWatcher, type InputHandler, InputService, type InputServiceOptions, type ItemDefinition, Line, type MatchResult, OptionBrand, type OptionDefinition, OptionDefinitionsMap, OptionDiagnosticText, OptionGroup, OutputService, type OutputServiceOptions, Path, ProjectResult, ProjectService, type ReadStream, type ResolvedConfig, Result, ResultCount, ResultHandler, ResultStatus, ResultTiming, type RunCallback, RuntimeReporter, Scribbler, ScribblerJsx, type ScribblerOptions, SelectService, SetupReporter, StoreService, SummaryReporter, TSTyche, TargetResult, type TargetResultStatus, TaskRunner, TestFile, TestMember, TestMemberBrand, TestMemberFlags, TestResult, TestTree, Text, type TypeChecker, Version, type WatchHandler, WatchReporter, WatchService, Watcher, type WatcherOptions, type WriteStream, addsPackageStepText, defaultOptions, describeNameText, diagnosticText, fileStatusText, fileViewText, formattedText, helpText, summaryText, testNameText, usesCompilerStepText, waitingForFileChangesText, watchUsageText };
|