tstyche 1.1.0 → 2.0.0-beta.1

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.
@@ -30,10 +30,20 @@ declare class Diagnostic {
30
30
  static warning(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
31
31
  }
32
32
 
33
+ declare enum CancellationReason {
34
+ ConfigChange = "configChange",
35
+ ConfigError = "configError",
36
+ FailFast = "failFast"
37
+ }
38
+
39
+ type CancellationRequestedHandler = (reason: CancellationReason) => void;
33
40
  declare class CancellationToken {
34
41
  #private;
35
42
  get isCancellationRequested(): boolean;
36
- cancel(): void;
43
+ get reason(): CancellationReason | undefined;
44
+ cancel(reason: CancellationReason): void;
45
+ onCancellationRequested(handler: CancellationRequestedHandler): void;
46
+ reset(): void;
37
47
  }
38
48
 
39
49
  declare class StoreService {
@@ -43,7 +53,6 @@ declare class StoreService {
43
53
  install(tag: string, cancellationToken?: CancellationToken): Promise<string | undefined>;
44
54
  load(tag: string, cancellationToken?: CancellationToken): Promise<typeof ts | undefined>;
45
55
  open(): Promise<void>;
46
- prune: () => Promise<void>;
47
56
  resolveTag(tag: string): Promise<string | undefined>;
48
57
  update(): Promise<void>;
49
58
  validateTag(tag: string): Promise<boolean | undefined>;
@@ -53,7 +62,7 @@ declare enum OptionBrand {
53
62
  String = "string",
54
63
  Number = "number",
55
64
  Boolean = "boolean",
56
- True = "true",// an option which does not take a value
65
+ BareTrue = "bareTrue",// a boolean option that does not take a value and when specified is interpreted as 'true'
57
66
  List = "list"
58
67
  }
59
68
  declare enum OptionGroup {
@@ -74,7 +83,7 @@ interface BaseOptionDefinition {
74
83
  name: string;
75
84
  }
76
85
  interface PrimitiveTypeOptionDefinition extends BaseOptionDefinition {
77
- brand: OptionBrand.String | OptionBrand.Number | OptionBrand.Boolean | OptionBrand.True;
86
+ brand: OptionBrand.String | OptionBrand.Number | OptionBrand.Boolean | OptionBrand.BareTrue;
78
87
  }
79
88
  interface ListTypeOptionDefinition extends BaseOptionDefinition {
80
89
  brand: OptionBrand.List;
@@ -137,6 +146,10 @@ interface CommandLineOptions {
137
146
  * Print the version number and exit.
138
147
  */
139
148
  version?: boolean;
149
+ /**
150
+ * Watch for changes and rerun related test files.
151
+ */
152
+ watch?: boolean;
140
153
  }
141
154
 
142
155
  /**
@@ -161,37 +174,137 @@ interface ConfigFileOptions {
161
174
  testFileMatch?: Array<string>;
162
175
  }
163
176
 
164
- interface ResolvedConfig extends Omit<CommandLineOptions, keyof ConfigFileOptions>, Required<ConfigFileOptions> {
177
+ interface ResolvedConfig extends Omit<CommandLineOptions, keyof ConfigFileOptions | "config">, Required<ConfigFileOptions> {
178
+ /**
179
+ * The path to a TSTyche configuration file.
180
+ */
181
+ configFilePath: string;
165
182
  /**
166
183
  * Only run test files with matching path.
167
184
  */
168
185
  pathMatch: Array<string>;
169
186
  }
187
+ declare const defaultOptions: Required<ConfigFileOptions>;
170
188
  declare class ConfigService {
171
189
  #private;
172
190
  compiler: typeof ts;
173
191
  constructor(compiler: typeof ts, storeService: StoreService);
174
- get commandLineOptions(): CommandLineOptions;
175
- get configFileOptions(): ConfigFileOptions;
176
- static get defaultOptions(): Required<ConfigFileOptions>;
177
192
  parseCommandLine(commandLineArgs: Array<string>): Promise<void>;
178
193
  readConfigFile(): Promise<void>;
179
194
  resolveConfig(): ResolvedConfig;
180
- selectTestFiles(): Array<string>;
181
195
  }
182
196
 
183
- declare class TSTyche {
197
+ declare class OptionDiagnosticText {
184
198
  #private;
185
- readonly resolvedConfig: ResolvedConfig;
186
- static readonly version = "1.1.0";
187
- constructor(resolvedConfig: ResolvedConfig, storeService: StoreService);
188
- run(testFiles: Array<string | URL>): Promise<void>;
199
+ static doubleQuotesExpected(): string;
200
+ static expectsListItemType(optionName: string, optionBrand: OptionBrand): string;
201
+ static expectsValue(optionName: string, optionGroup: OptionGroup): string;
202
+ static fileDoesNotExist(filePath: string): string;
203
+ static noTestFilesWereLeft(resolvedConfig: ResolvedConfig): Array<string>;
204
+ static noTestFilesWereSelected(resolvedConfig: ResolvedConfig): Array<string>;
205
+ static requiresValueType(optionName: string, optionBrand: OptionBrand, optionGroup: OptionGroup): string;
206
+ static unknownOption(optionName: string): string;
207
+ static versionIsNotSupported(value: string): string;
208
+ static watchCannotBeEnabledInCiEnvironment(): string;
209
+ static watchIsNotAvailable(): string;
189
210
  }
190
211
 
191
- declare class Cli {
212
+ declare enum Color {
213
+ Reset = "0",
214
+ Red = "31",
215
+ Green = "32",
216
+ Yellow = "33",
217
+ Blue = "34",
218
+ Magenta = "35",
219
+ Cyan = "36",
220
+ Gray = "90"
221
+ }
222
+
223
+ type ElementChildren = Array<ElementChildren> | ScribblerJsx.Element | string | undefined;
224
+ type ComponentConstructor = new (props: Record<string, unknown>) => ScribblerJsx.ElementClass;
225
+ declare namespace ScribblerJsx {
226
+ interface Element {
227
+ props: Record<string, unknown>;
228
+ type: ComponentConstructor | string;
229
+ }
230
+ interface ElementAttributesProperty {
231
+ props: Record<string, unknown>;
232
+ }
233
+ interface ElementClass {
234
+ render: () => ScribblerJsx.Element;
235
+ }
236
+ interface ElementChildrenAttribute {
237
+ children: ElementChildren;
238
+ }
239
+ interface IntrinsicElements {
240
+ ansi: {
241
+ escapes: Color | Array<Color>;
242
+ };
243
+ newLine: {
244
+ [key: string]: never;
245
+ };
246
+ text: {
247
+ children: Array<ElementChildren>;
248
+ indent: number;
249
+ };
250
+ }
251
+ }
252
+
253
+ interface LineProps {
254
+ children?: ScribblerJsx.ElementChildrenAttribute["children"];
255
+ color?: Color;
256
+ indent?: number;
257
+ }
258
+ declare class Line implements ScribblerJsx.ElementClass {
259
+ readonly props: LineProps;
260
+ constructor(props: LineProps);
261
+ render(): ScribblerJsx.Element;
262
+ }
263
+
264
+ interface ScribblerOptions {
265
+ newLine?: string;
266
+ noColor?: boolean;
267
+ }
268
+ declare class Scribbler {
192
269
  #private;
193
- constructor();
194
- run(commandLineArguments: Array<string>): Promise<void>;
270
+ constructor(options?: ScribblerOptions);
271
+ render(element: ScribblerJsx.Element): string;
272
+ }
273
+
274
+ interface TextProps {
275
+ children?: ScribblerJsx.ElementChildrenAttribute["children"];
276
+ color?: Color | undefined;
277
+ indent?: number | undefined;
278
+ }
279
+ declare class Text implements ScribblerJsx.ElementClass {
280
+ readonly props: TextProps;
281
+ constructor(props: TextProps);
282
+ render(): ScribblerJsx.Element;
283
+ }
284
+
285
+ declare function addsPackageStepText(compilerVersion: string, installationPath: string): ScribblerJsx.Element;
286
+
287
+ declare function describeNameText(name: string, indent?: number): ScribblerJsx.Element;
288
+
289
+ declare function diagnosticText(diagnostic: Diagnostic): ScribblerJsx.Element;
290
+
291
+ declare class TestFile {
292
+ #private;
293
+ path: string;
294
+ position?: number;
295
+ constructor(identifier: string | URL);
296
+ add(options: {
297
+ position?: number;
298
+ }): this;
299
+ }
300
+
301
+ declare class TestTree {
302
+ compiler: typeof ts;
303
+ diagnostics: Set<ts.Diagnostic>;
304
+ sourceFile: ts.SourceFile;
305
+ members: Array<TestMember | Assertion>;
306
+ constructor(compiler: typeof ts, diagnostics: Set<ts.Diagnostic>, sourceFile: ts.SourceFile);
307
+ get hasOnly(): boolean;
195
308
  }
196
309
 
197
310
  declare enum TestMemberBrand {
@@ -207,15 +320,6 @@ declare enum TestMemberFlags {
207
320
  Todo = 8
208
321
  }
209
322
 
210
- declare class TestTree {
211
- compiler: typeof ts;
212
- diagnostics: Set<ts.Diagnostic>;
213
- sourceFile: ts.SourceFile;
214
- members: Array<TestMember | Assertion>;
215
- constructor(compiler: typeof ts, diagnostics: Set<ts.Diagnostic>, sourceFile: ts.SourceFile);
216
- get hasOnly(): boolean;
217
- }
218
-
219
323
  declare class TestMember {
220
324
  brand: TestMemberBrand;
221
325
  node: ts.CallExpression;
@@ -255,30 +359,6 @@ declare class CollectService {
255
359
  createTestTree(sourceFile: ts.SourceFile, semanticDiagnostics?: Array<ts.Diagnostic>): TestTree;
256
360
  }
257
361
 
258
- declare class Environment {
259
- #private;
260
- /**
261
- * Specifies whether color should be disabled in the output.
262
- */
263
- static get noColor(): boolean;
264
- /**
265
- * Specifies whether interactive elements should be disabled in the output.
266
- */
267
- static get noInteractive(): boolean;
268
- /**
269
- * The directory where to store the 'typescript' packages.
270
- */
271
- static get storePath(): string;
272
- /**
273
- * The number of seconds to wait before giving up stale operations.
274
- */
275
- static get timeout(): number;
276
- /**
277
- * The path to the currently installed TypeScript module.
278
- */
279
- static get typescriptPath(): string | undefined;
280
- }
281
-
282
362
  declare class ResultTiming {
283
363
  end: number;
284
364
  start: number;
@@ -331,14 +411,14 @@ declare class DescribeResult {
331
411
 
332
412
  type FileResultStatus = ResultStatus.Runs | ResultStatus.Passed | ResultStatus.Failed;
333
413
  declare class FileResult {
334
- testFile: URL;
414
+ testFile: TestFile;
335
415
  diagnostics: Array<Diagnostic>;
336
416
  expectCount: ResultCount;
337
417
  results: Array<DescribeResult | TestResult | ExpectResult>;
338
418
  status: FileResultStatus;
339
419
  testCount: ResultCount;
340
420
  timing: ResultTiming;
341
- constructor(testFile: URL);
421
+ constructor(testFile: TestFile);
342
422
  }
343
423
 
344
424
  declare class ProjectResult {
@@ -352,36 +432,35 @@ declare class ProjectResult {
352
432
  type TargetResultStatus = ResultStatus.Runs | ResultStatus.Passed | ResultStatus.Failed;
353
433
  declare class TargetResult {
354
434
  versionTag: string;
355
- testFiles: Array<URL>;
435
+ testFiles: Array<TestFile>;
356
436
  results: Map<string | undefined, ProjectResult>;
357
437
  status: TargetResultStatus;
358
438
  timing: ResultTiming;
359
- constructor(versionTag: string, testFiles: Array<URL>);
439
+ constructor(versionTag: string, testFiles: Array<TestFile>);
360
440
  }
361
441
 
362
442
  declare class Result {
363
443
  resolvedConfig: ResolvedConfig;
364
- testFiles: Array<URL>;
444
+ testFiles: Array<TestFile>;
365
445
  expectCount: ResultCount;
366
446
  fileCount: ResultCount;
367
447
  results: Array<TargetResult>;
368
448
  targetCount: ResultCount;
369
449
  testCount: ResultCount;
370
450
  timing: ResultTiming;
371
- constructor(resolvedConfig: ResolvedConfig, testFiles: Array<URL>);
372
- }
373
-
374
- declare class ResultManager {
375
- #private;
376
- handleEvent([eventName, payload]: Event): void;
451
+ constructor(resolvedConfig: ResolvedConfig, testFiles: Array<TestFile>);
377
452
  }
378
453
 
379
- type Event = ["start", {
454
+ type Event = ["config:error", {
455
+ diagnostics: Array<Diagnostic>;
456
+ }] | ["deprecation:info", {
457
+ diagnostics: Array<Diagnostic>;
458
+ }] | ["select:error", {
459
+ diagnostics: Array<Diagnostic>;
460
+ }] | ["run:start", {
380
461
  result: Result;
381
- }] | ["end", {
462
+ }] | ["run:end", {
382
463
  result: Result;
383
- }] | ["config:error", {
384
- diagnostics: Array<Diagnostic>;
385
464
  }] | ["store:info", {
386
465
  compilerVersion: string;
387
466
  installationPath: string;
@@ -432,13 +511,120 @@ type Event = ["start", {
432
511
  result: ExpectResult;
433
512
  }] | ["expect:skip", {
434
513
  result: ExpectResult;
514
+ }] | ["watch:error", {
515
+ diagnostics: Array<Diagnostic>;
435
516
  }];
436
- type EventHandler = (event: Event) => void;
517
+ interface EventHandler {
518
+ handleEvent: (event: Event) => void;
519
+ }
437
520
  declare class EventEmitter {
438
521
  #private;
439
- static addHandler(handler: EventHandler): void;
522
+ addHandler(handler: EventHandler): void;
440
523
  static dispatch(event: Event): void;
441
- static removeHandler(handler: EventHandler): void;
524
+ removeHandler(handler: EventHandler): void;
525
+ removeHandlers(): void;
526
+ }
527
+
528
+ declare class ResultHandler {
529
+ #private;
530
+ handleEvent([eventName, payload]: Event): void;
531
+ }
532
+
533
+ declare function fileStatusText(status: FileResultStatus, testFile: TestFile): ScribblerJsx.Element;
534
+
535
+ declare function fileViewText(lines: Array<ScribblerJsx.Element>, addEmptyFinalLine: boolean): ScribblerJsx.Element;
536
+
537
+ declare function formattedText(input: string | Array<string> | Record<string, unknown>): ScribblerJsx.Element;
538
+
539
+ declare function helpText(optionDefinitions: Map<string, OptionDefinition>, tstycheVersion: string): ScribblerJsx.Element;
540
+
541
+ interface WriteStream {
542
+ write: (log: string) => void;
543
+ }
544
+ interface OutputServiceOptions {
545
+ noColor?: boolean;
546
+ stderr?: WriteStream;
547
+ stdout?: WriteStream;
548
+ }
549
+ declare class OutputService {
550
+ #private;
551
+ constructor(options?: OutputServiceOptions);
552
+ clearTerminal(): void;
553
+ eraseLastLine(): void;
554
+ writeError(body: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
555
+ writeMessage(body: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
556
+ writeWarning(body: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
557
+ }
558
+
559
+ declare function summaryText({ duration, expectCount, fileCount, onlyMatch, pathMatch, skipMatch, targetCount, testCount, }: {
560
+ duration: number;
561
+ expectCount: ResultCount;
562
+ fileCount: ResultCount;
563
+ onlyMatch: string | undefined;
564
+ pathMatch: Array<string>;
565
+ skipMatch: string | undefined;
566
+ targetCount: ResultCount;
567
+ testCount: ResultCount;
568
+ }): ScribblerJsx.Element;
569
+
570
+ declare function testNameText(status: "fail" | "pass" | "skip" | "todo", name: string, indent?: number): ScribblerJsx.Element;
571
+
572
+ declare function usesCompilerStepText(compilerVersion: string, tsconfigFilePath: string | undefined, options?: {
573
+ prependEmptyLine: boolean;
574
+ }): ScribblerJsx.Element;
575
+
576
+ declare function waitingForFileChangesText(): ScribblerJsx.Element;
577
+
578
+ declare function watchUsageText(): ScribblerJsx.Element;
579
+
580
+ declare class SelectService {
581
+ #private;
582
+ readonly resolvedConfig: ResolvedConfig;
583
+ constructor(resolvedConfig: ResolvedConfig);
584
+ isTestFile(filePath: string): boolean;
585
+ selectFiles(): Promise<Array<string>>;
586
+ }
587
+
588
+ declare class TSTyche {
589
+ #private;
590
+ readonly resolvedConfig: ResolvedConfig;
591
+ static readonly version = "2.0.0-beta.1";
592
+ constructor(resolvedConfig: ResolvedConfig, outputService: OutputService, selectService: SelectService, storeService: StoreService);
593
+ close(): void;
594
+ run(testFiles: Array<string | URL>, cancellationToken?: CancellationToken): Promise<void>;
595
+ }
596
+
597
+ declare class Cli {
598
+ #private;
599
+ run(commandLineArguments: Array<string>, cancellationToken?: CancellationToken): Promise<void>;
600
+ }
601
+
602
+ declare class Environment {
603
+ #private;
604
+ /**
605
+ * Is `true` if the process is running in a continuous integration environment.
606
+ */
607
+ static get isCi(): boolean;
608
+ /**
609
+ * Specifies whether color should be disabled in the output.
610
+ */
611
+ static get noColor(): boolean;
612
+ /**
613
+ * Specifies whether interactive elements should be disabled in the output.
614
+ */
615
+ static get noInteractive(): boolean;
616
+ /**
617
+ * The directory where to store the 'typescript' packages.
618
+ */
619
+ static get storePath(): string;
620
+ /**
621
+ * The number of seconds to wait before giving up stale operations.
622
+ */
623
+ static get timeout(): number;
624
+ /**
625
+ * The path to the currently installed TypeScript module.
626
+ */
627
+ static get typescriptPath(): string | undefined;
442
628
  }
443
629
 
444
630
  interface MatchResult {
@@ -466,20 +652,26 @@ declare abstract class RelationMatcherBase {
466
652
  typeChecker: TypeChecker;
467
653
  abstract relation: Relation;
468
654
  abstract relationExplanationText: string;
655
+ relationExplanationVerb: string;
469
656
  constructor(typeChecker: TypeChecker);
470
657
  protected explain(sourceType: ts.Type, targetType: ts.Type, isNot: boolean): Array<Diagnostic>;
471
658
  match(sourceType: ts.Type, targetType: ts.Type, isNot: boolean): MatchResult;
472
659
  }
473
660
 
474
- declare class ToBeAssignable extends RelationMatcherBase {
661
+ declare class ToBe extends RelationMatcherBase {
662
+ relation: Relation;
663
+ relationExplanationText: string;
664
+ }
665
+
666
+ declare class ToBeAssignableTo extends RelationMatcherBase {
475
667
  relation: Relation;
476
668
  relationExplanationText: string;
477
- match(sourceType: ts.Type, targetType: ts.Type, isNot: boolean): MatchResult;
478
669
  }
479
670
 
480
- declare class ToEqual extends RelationMatcherBase {
671
+ declare class ToBeAssignableWith extends RelationMatcherBase {
481
672
  relation: Relation;
482
673
  relationExplanationText: string;
674
+ match(sourceType: ts.Type, targetType: ts.Type, isNot: boolean): MatchResult;
483
675
  }
484
676
 
485
677
  declare class ToHaveProperty {
@@ -493,6 +685,7 @@ declare class ToHaveProperty {
493
685
  declare class ToMatch extends RelationMatcherBase {
494
686
  relation: Relation;
495
687
  relationExplanationText: string;
688
+ relationExplanationVerb: string;
496
689
  }
497
690
 
498
691
  declare class ToRaiseError {
@@ -510,8 +703,11 @@ declare class Expect {
510
703
  #private;
511
704
  compiler: typeof ts;
512
705
  typeChecker: TypeChecker;
706
+ toBe: ToBe;
513
707
  toBeAny: PrimitiveTypeMatcher;
514
- toBeAssignable: ToBeAssignable;
708
+ toBeAssignable: ToBeAssignableWith;
709
+ toBeAssignableTo: ToBeAssignableTo;
710
+ toBeAssignableWith: ToBeAssignableWith;
515
711
  toBeBigInt: PrimitiveTypeMatcher;
516
712
  toBeBoolean: PrimitiveTypeMatcher;
517
713
  toBeNever: PrimitiveTypeMatcher;
@@ -523,7 +719,7 @@ declare class Expect {
523
719
  toBeUniqueSymbol: PrimitiveTypeMatcher;
524
720
  toBeUnknown: PrimitiveTypeMatcher;
525
721
  toBeVoid: PrimitiveTypeMatcher;
526
- toEqual: ToEqual;
722
+ toEqual: ToBe;
527
723
  toHaveProperty: ToHaveProperty;
528
724
  toMatch: ToMatch;
529
725
  toRaiseError: ToRaiseError;
@@ -532,80 +728,58 @@ declare class Expect {
532
728
  match(assertion: Assertion, expectResult: ExpectResult): MatchResult | undefined;
533
729
  }
534
730
 
535
- /**
536
- * A stream to output messages.
537
- */
538
- interface WriteStream {
539
- /**
540
- * @param log - Message to write to the stream.
541
- */
542
- write: (log: string) => void;
543
- }
544
- /**
545
- * Options to configure an instance of the {@link Logger}.
546
- */
547
- interface LoggerOptions {
548
- /**
549
- * Specifies whether color should be disabled in the output. Default: `Environment.noColor`.
550
- */
551
- noColor?: boolean;
552
- /**
553
- * A stream to write warnings and errors. Default: `process.stderr`.
554
- */
555
- stderr?: WriteStream;
556
- /**
557
- * A stream to write informational messages. Default: `process.stdout`.
558
- */
559
- stdout?: WriteStream;
560
- }
561
- /**
562
- * Wraps the provided streams with a set of convenience methods.
563
- */
564
- declare class Logger {
731
+ declare class CancellationHandler implements EventHandler {
565
732
  #private;
566
- /**
567
- * @param options - {@link LoggerOptions | Options} to configure an instance of the Logger.
568
- */
569
- constructor(options?: LoggerOptions);
570
- /**
571
- * Moves the cursor one line up in the `stdout` stream and erases that line.
572
- */
573
- eraseLastLine(): void;
574
- writeError(body: JSX.Element | Array<JSX.Element>): void;
575
- writeMessage(body: JSX.Element | Array<JSX.Element>): void;
576
- writeWarning(body: JSX.Element | Array<JSX.Element>): void;
733
+ constructor(cancellationToken: CancellationToken, cancellationReason: CancellationReason);
734
+ handleEvent([, payload]: Event): void;
577
735
  }
578
736
 
579
- declare function addsPackageStepText(compilerVersion: string, installationPath: string): JSX.Element;
580
-
581
- declare function describeNameText(name: string, indent?: number): JSX.Element;
582
-
583
- declare function diagnosticText(diagnostic: Diagnostic): JSX.Element;
584
-
585
- declare function fileStatusText(status: FileResultStatus, testFile: URL): JSX.Element;
586
-
587
- declare function fileViewText(lines: Array<JSX.Element>, addEmptyFinalLine: boolean): JSX.Element;
737
+ declare class ExitCodeHandler implements EventHandler {
738
+ #private;
739
+ handleEvent([eventName, payload]: Event): void;
740
+ resetCode(): void;
741
+ }
588
742
 
589
- declare function formattedText(input: string | Array<string> | Record<string, unknown>): JSX.Element;
743
+ declare class RuntimeReporter implements EventHandler {
744
+ #private;
745
+ readonly resolvedConfig: ResolvedConfig;
746
+ constructor(resolvedConfig: ResolvedConfig, outputService: OutputService);
747
+ handleEvent([eventName, payload]: Event): void;
748
+ }
590
749
 
591
- declare function helpText(optionDefinitions: Map<string, OptionDefinition>, tstycheVersion: string): JSX.Element;
750
+ declare class SetupReporter implements EventHandler {
751
+ #private;
752
+ constructor(outputService: OutputService);
753
+ handleEvent([eventName, payload]: Event): void;
754
+ }
592
755
 
593
- declare function summaryText({ duration, expectCount, fileCount, onlyMatch, pathMatch, skipMatch, targetCount, testCount, }: {
594
- duration: number;
595
- expectCount: ResultCount;
596
- fileCount: ResultCount;
597
- onlyMatch: string | undefined;
598
- pathMatch: Array<string>;
599
- skipMatch: string | undefined;
600
- targetCount: ResultCount;
601
- testCount: ResultCount;
602
- }): JSX.Element;
756
+ declare class SummaryReporter implements EventHandler {
757
+ #private;
758
+ constructor(outputService: OutputService);
759
+ handleEvent([eventName, payload]: Event): void;
760
+ }
603
761
 
604
- declare function testNameText(status: "fail" | "pass" | "skip" | "todo", name: string, indent?: number): JSX.Element;
762
+ declare class WatchReporter implements EventHandler {
763
+ #private;
764
+ constructor(outputService: OutputService);
765
+ handleEvent([eventName, payload]: Event): void;
766
+ }
605
767
 
606
- declare function usesCompilerStepText(compilerVersion: string, tsconfigFilePath: string | undefined, options?: {
607
- prependEmptyLine: boolean;
608
- }): JSX.Element;
768
+ type InputHandler = (chunk: Buffer) => void;
769
+ interface ReadStream {
770
+ addListener: (event: "data", handler: InputHandler) => this;
771
+ removeListener: (event: "data", handler: InputHandler) => this;
772
+ setRawMode?: (mode: boolean) => this;
773
+ unref: () => this;
774
+ }
775
+ interface InputServiceOptions {
776
+ stdin?: ReadStream;
777
+ }
778
+ declare class InputService {
779
+ #private;
780
+ constructor(onInput: InputHandler, options?: InputServiceOptions);
781
+ close(): void;
782
+ }
609
783
 
610
784
  declare class Path {
611
785
  static dirname(filePath: string): string;
@@ -625,133 +799,42 @@ declare class ProjectService {
625
799
  openFile(filePath: string, sourceText?: string | undefined, projectRootPath?: string | undefined): void;
626
800
  }
627
801
 
628
- declare abstract class Reporter {
629
- readonly resolvedConfig: ResolvedConfig;
630
- protected logger: Logger;
631
- constructor(resolvedConfig: ResolvedConfig);
632
- abstract handleEvent([eventName, payload]: Event): void;
633
- }
634
-
635
- declare class SummaryReporter extends Reporter {
636
- handleEvent([eventName, payload]: Event): void;
637
- }
638
-
639
- declare class ThoroughReporter extends Reporter {
640
- #private;
641
- handleEvent([eventName, payload]: Event): void;
642
- }
643
-
644
802
  declare class TaskRunner {
645
803
  #private;
646
804
  readonly resolvedConfig: ResolvedConfig;
647
- constructor(resolvedConfig: ResolvedConfig, storeService: StoreService);
648
- run(testFiles: Array<URL>, target: Array<string>, cancellationToken?: CancellationToken): Promise<Result>;
805
+ constructor(resolvedConfig: ResolvedConfig, selectService: SelectService, storeService: StoreService);
806
+ close(): void;
807
+ run(testFiles: Array<TestFile>, cancellationToken?: CancellationToken): Promise<void>;
649
808
  }
650
809
 
651
- declare enum Color {
652
- Reset = "0",
653
- Red = "31",
654
- Green = "32",
655
- Yellow = "33",
656
- Blue = "34",
657
- Magenta = "35",
658
- Cyan = "36",
659
- Gray = "90"
810
+ declare class Version {
811
+ #private;
812
+ static isGreaterThan(source: string, target: string): boolean;
813
+ static isSatisfiedWith(source: string, target: string): boolean;
814
+ static isVersionTag(target: string): boolean;
660
815
  }
661
816
 
662
- interface LineProps {
663
- children?: JSX.ElementChildrenAttribute["children"];
664
- color?: Color;
665
- indent?: number;
666
- }
667
- declare class Line implements JSX.ElementClass {
668
- readonly props: LineProps;
669
- constructor(props: LineProps);
670
- render(): JSX.Element;
671
- }
672
-
673
- type ElementChildren = Array<ElementChildren> | JSX.Element | string | undefined;
674
- type ComponentConstructor = new (props: Record<string, unknown>) => JSX.ElementClass;
675
- declare global {
676
- namespace JSX {
677
- interface Element {
678
- $$typeof: symbol;
679
- children: ElementChildren;
680
- props: Record<string, unknown> | null;
681
- type: ComponentConstructor | string;
682
- }
683
- interface ElementAttributesProperty {
684
- props: Record<string, unknown> | null;
685
- }
686
- interface ElementClass {
687
- render: () => JSX.Element | null;
688
- }
689
- interface ElementChildrenAttribute {
690
- children: ElementChildren;
691
- }
692
- interface IntrinsicElements {
693
- ansi: {
694
- children?: never;
695
- escapes: Color | Array<Color>;
696
- };
697
- newLine: {
698
- children?: never;
699
- };
700
- text: {
701
- children: ElementChildren;
702
- indent?: number | undefined;
703
- };
704
- }
705
- }
706
- }
707
- /**
708
- * Options to configure an instance of the {@link Scribbler}.
709
- */
710
- interface ScribblerOptions {
711
- /**
712
- * The end of line sequence to be used in the output. Default: `"\n"`.
713
- */
714
- newLine?: string;
715
- /**
716
- * Do not include ANSI color escape codes in the output. Default: `false`.
717
- */
718
- noColor?: boolean;
719
- }
720
- /**
721
- * Provides the JSX factory function and renderer.
722
- */
723
- declare class Scribbler {
817
+ type WatchHandler = (filePath: string) => void | Promise<void>;
818
+ declare class Watcher {
724
819
  #private;
725
- /**
726
- * @param options - {@link ScribblerOptions | Options} to configure an instance of the Scribbler.
727
- */
728
- constructor(options?: ScribblerOptions);
729
- /**
730
- * Creates a new text element of the given `type`.
731
- */
732
- static createElement(type: ComponentConstructor | string, props: Record<string, unknown> | null, ...children: Array<ElementChildren>): JSX.Element;
733
- /**
734
- * Renders the provided JSX `element` and returns the resulting string.
735
- */
736
- render(element: JSX.Element | null): string;
820
+ readonly targetPath: string;
821
+ constructor(targetPath: string, onChanged: WatchHandler, onRemoved?: WatchHandler, recursive?: boolean);
822
+ close(): void;
823
+ watch(): Promise<void>;
737
824
  }
738
825
 
739
- interface TextProps {
740
- children?: JSX.ElementChildrenAttribute["children"];
741
- color?: Color | undefined;
742
- indent?: number | undefined;
743
- }
744
- declare class Text implements JSX.ElementClass {
745
- readonly props: TextProps;
746
- constructor(props: TextProps);
747
- render(): JSX.Element;
826
+ type FileWatchHandler = () => void | Promise<void>;
827
+ declare class FileWatcher extends Watcher {
828
+ constructor(targetPath: string, onChanged: FileWatchHandler);
748
829
  }
749
830
 
750
- declare class Version {
831
+ type RunCallback = (testFiles: Array<TestFile>) => Promise<void>;
832
+ declare class WatchService {
751
833
  #private;
752
- static isGreaterThan(source: string, target: string): boolean;
753
- static isSatisfiedWith(source: string, target: string): boolean;
754
- static isVersionTag(target: string): boolean;
834
+ readonly resolvedConfig: ResolvedConfig;
835
+ constructor(resolvedConfig: ResolvedConfig, runCallback: RunCallback, selectService: SelectService, testFiles: Array<TestFile>);
836
+ close(): void;
837
+ watch(cancellationToken?: CancellationToken): Promise<Array<void>>;
755
838
  }
756
839
 
757
- export { Assertion, CancellationToken, Cli, CollectService, Color, type CommandLineOptions, type ConfigFileOptions, ConfigService, DescribeResult, Diagnostic, DiagnosticCategory, type DiagnosticOrigin, Environment, type Event, EventEmitter, type EventHandler, Expect, ExpectResult, FileResult, type FileResultStatus, type ItemDefinition, Line, Logger, type LoggerOptions, type MatchResult, OptionBrand, type OptionDefinition, OptionDefinitionsMap, OptionGroup, Path, ProjectResult, ProjectService, Reporter, type ResolvedConfig, Result, ResultCount, ResultManager, ResultStatus, ResultTiming, Scribbler, type ScribblerOptions, StoreService, SummaryReporter, TSTyche, TargetResult, type TargetResultStatus, TaskRunner, TestMember, TestMemberBrand, TestMemberFlags, TestResult, TestTree, Text, ThoroughReporter, type TypeChecker, Version, type WriteStream, addsPackageStepText, describeNameText, diagnosticText, fileStatusText, fileViewText, formattedText, helpText, summaryText, testNameText, usesCompilerStepText };
840
+ export { Assertion, CancellationHandler, CancellationReason, CancellationToken, Cli, CollectService, Color, type CommandLineOptions, type ConfigFileOptions, ConfigService, DescribeResult, Diagnostic, DiagnosticCategory, type 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 WriteStream, addsPackageStepText, defaultOptions, describeNameText, diagnosticText, fileStatusText, fileViewText, formattedText, helpText, summaryText, testNameText, usesCompilerStepText, waitingForFileChangesText, watchUsageText };