tstyche 2.0.0-beta.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.
Files changed (3) hide show
  1. package/build/tstyche.d.ts +302 -232
  2. package/build/tstyche.js +2477 -2396
  3. package/package.json +20 -25
@@ -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 {
@@ -52,7 +62,7 @@ declare enum OptionBrand {
52
62
  String = "string",
53
63
  Number = "number",
54
64
  Boolean = "boolean",
55
- 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'
56
66
  List = "list"
57
67
  }
58
68
  declare enum OptionGroup {
@@ -73,7 +83,7 @@ interface BaseOptionDefinition {
73
83
  name: string;
74
84
  }
75
85
  interface PrimitiveTypeOptionDefinition extends BaseOptionDefinition {
76
- brand: OptionBrand.String | OptionBrand.Number | OptionBrand.Boolean | OptionBrand.True;
86
+ brand: OptionBrand.String | OptionBrand.Number | OptionBrand.Boolean | OptionBrand.BareTrue;
77
87
  }
78
88
  interface ListTypeOptionDefinition extends BaseOptionDefinition {
79
89
  brand: OptionBrand.List;
@@ -137,7 +147,7 @@ interface CommandLineOptions {
137
147
  */
138
148
  version?: boolean;
139
149
  /**
140
- * Watch for changes and rerun related tests files.
150
+ * Watch for changes and rerun related test files.
141
151
  */
142
152
  watch?: boolean;
143
153
  }
@@ -164,45 +174,137 @@ interface ConfigFileOptions {
164
174
  testFileMatch?: Array<string>;
165
175
  }
166
176
 
167
- 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;
168
182
  /**
169
183
  * Only run test files with matching path.
170
184
  */
171
185
  pathMatch: Array<string>;
172
186
  }
187
+ declare const defaultOptions: Required<ConfigFileOptions>;
173
188
  declare class ConfigService {
174
189
  #private;
175
190
  compiler: typeof ts;
176
191
  constructor(compiler: typeof ts, storeService: StoreService);
177
- get commandLineOptions(): CommandLineOptions;
178
- get configFileOptions(): ConfigFileOptions;
179
- static get defaultOptions(): Required<ConfigFileOptions>;
180
192
  parseCommandLine(commandLineArgs: Array<string>): Promise<void>;
181
193
  readConfigFile(): Promise<void>;
182
194
  resolveConfig(): ResolvedConfig;
183
195
  }
184
196
 
185
- declare class SelectService {
197
+ declare class OptionDiagnosticText {
186
198
  #private;
187
- readonly resolvedConfig: ResolvedConfig;
188
- constructor(resolvedConfig: ResolvedConfig);
189
- isTestFile(filePath: string): boolean;
190
- selectFiles(): Promise<Array<string>>;
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;
191
210
  }
192
211
 
193
- declare class TSTyche {
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 {
194
269
  #private;
195
- readonly resolvedConfig: ResolvedConfig;
196
- static readonly version = "2.0.0-beta.0";
197
- constructor(resolvedConfig: ResolvedConfig, storeService: StoreService);
198
- run(testFiles: Array<string | URL>): Promise<void>;
199
- watch(testFiles: Array<string>, selectService: SelectService): Promise<void>;
270
+ constructor(options?: ScribblerOptions);
271
+ render(element: ScribblerJsx.Element): string;
200
272
  }
201
273
 
202
- declare class Cli {
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 {
203
292
  #private;
204
- constructor();
205
- run(commandLineArguments: Array<string>): Promise<void>;
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;
206
308
  }
207
309
 
208
310
  declare enum TestMemberBrand {
@@ -218,15 +320,6 @@ 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
325
  node: ts.CallExpression;
@@ -266,34 +359,6 @@ declare class CollectService {
266
359
  createTestTree(sourceFile: ts.SourceFile, semanticDiagnostics?: Array<ts.Diagnostic>): TestTree;
267
360
  }
268
361
 
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
362
  declare class ResultTiming {
298
363
  end: number;
299
364
  start: number;
@@ -346,14 +411,14 @@ declare class DescribeResult {
346
411
 
347
412
  type FileResultStatus = ResultStatus.Runs | ResultStatus.Passed | ResultStatus.Failed;
348
413
  declare class FileResult {
349
- testFile: URL;
414
+ testFile: TestFile;
350
415
  diagnostics: Array<Diagnostic>;
351
416
  expectCount: ResultCount;
352
417
  results: Array<DescribeResult | TestResult | ExpectResult>;
353
418
  status: FileResultStatus;
354
419
  testCount: ResultCount;
355
420
  timing: ResultTiming;
356
- constructor(testFile: URL);
421
+ constructor(testFile: TestFile);
357
422
  }
358
423
 
359
424
  declare class ProjectResult {
@@ -367,36 +432,29 @@ declare class ProjectResult {
367
432
  type TargetResultStatus = ResultStatus.Runs | ResultStatus.Passed | ResultStatus.Failed;
368
433
  declare class TargetResult {
369
434
  versionTag: string;
370
- testFiles: Array<URL>;
435
+ testFiles: Array<TestFile>;
371
436
  results: Map<string | undefined, ProjectResult>;
372
437
  status: TargetResultStatus;
373
438
  timing: ResultTiming;
374
- constructor(versionTag: string, testFiles: Array<URL>);
439
+ constructor(versionTag: string, testFiles: Array<TestFile>);
375
440
  }
376
441
 
377
442
  declare class Result {
378
443
  resolvedConfig: ResolvedConfig;
379
- testFiles: Array<URL>;
444
+ testFiles: Array<TestFile>;
380
445
  expectCount: ResultCount;
381
446
  fileCount: ResultCount;
382
447
  results: Array<TargetResult>;
383
448
  targetCount: ResultCount;
384
449
  testCount: ResultCount;
385
450
  timing: ResultTiming;
386
- constructor(resolvedConfig: ResolvedConfig, testFiles: Array<URL>);
387
- }
388
-
389
- declare class ResultManager {
390
- #private;
391
- handleEvent([eventName, payload]: Event): void;
451
+ constructor(resolvedConfig: ResolvedConfig, testFiles: Array<TestFile>);
392
452
  }
393
453
 
394
454
  type Event = ["config:error", {
395
455
  diagnostics: Array<Diagnostic>;
396
456
  }] | ["deprecation:info", {
397
457
  diagnostics: Array<Diagnostic>;
398
- }] | ["input:info", {
399
- key: string;
400
458
  }] | ["select:error", {
401
459
  diagnostics: Array<Diagnostic>;
402
460
  }] | ["run:start", {
@@ -453,13 +511,120 @@ type Event = ["config:error", {
453
511
  result: ExpectResult;
454
512
  }] | ["expect:skip", {
455
513
  result: ExpectResult;
514
+ }] | ["watch:error", {
515
+ diagnostics: Array<Diagnostic>;
456
516
  }];
457
- type EventHandler = (event: Event) => void;
517
+ interface EventHandler {
518
+ handleEvent: (event: Event) => void;
519
+ }
458
520
  declare class EventEmitter {
459
521
  #private;
460
- static addHandler(handler: EventHandler): void;
522
+ addHandler(handler: EventHandler): void;
461
523
  static dispatch(event: Event): void;
462
- 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;
463
628
  }
464
629
 
465
630
  interface MatchResult {
@@ -563,72 +728,59 @@ declare class Expect {
563
728
  match(assertion: Assertion, expectResult: ExpectResult): MatchResult | undefined;
564
729
  }
565
730
 
566
- interface ReadStream {
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 {
731
+ declare class CancellationHandler implements EventHandler {
576
732
  #private;
577
- constructor(options?: InputServiceOptions);
578
- dispose(): void;
733
+ constructor(cancellationToken: CancellationToken, cancellationReason: CancellationReason);
734
+ handleEvent([, payload]: Event): void;
579
735
  }
580
736
 
581
- declare function addsPackageStepText(compilerVersion: string, installationPath: string): JSX.Element;
582
-
583
- declare function describeNameText(name: string, indent?: number): JSX.Element;
584
-
585
- declare function diagnosticText(diagnostic: Diagnostic): JSX.Element;
737
+ declare class ExitCodeHandler implements EventHandler {
738
+ #private;
739
+ handleEvent([eventName, payload]: Event): void;
740
+ resetCode(): void;
741
+ }
586
742
 
587
- declare function fileStatusText(status: FileResultStatus, testFile: URL): 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
+ }
588
749
 
589
- declare function fileViewText(lines: Array<JSX.Element>, addEmptyFinalLine: boolean): JSX.Element;
750
+ declare class SetupReporter implements EventHandler {
751
+ #private;
752
+ constructor(outputService: OutputService);
753
+ handleEvent([eventName, payload]: Event): void;
754
+ }
590
755
 
591
- declare function formattedText(input: string | Array<string> | Record<string, unknown>): JSX.Element;
756
+ declare class SummaryReporter implements EventHandler {
757
+ #private;
758
+ constructor(outputService: OutputService);
759
+ handleEvent([eventName, payload]: Event): void;
760
+ }
592
761
 
593
- declare function helpText(optionDefinitions: Map<string, OptionDefinition>, tstycheVersion: string): JSX.Element;
762
+ declare class WatchReporter implements EventHandler {
763
+ #private;
764
+ constructor(outputService: OutputService);
765
+ handleEvent([eventName, payload]: Event): void;
766
+ }
594
767
 
595
- interface WriteStream {
596
- write: (log: string) => void;
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;
597
774
  }
598
- interface OutputServiceOptions {
599
- noColor?: boolean;
600
- stderr?: WriteStream;
601
- stdout?: WriteStream;
775
+ interface InputServiceOptions {
776
+ stdin?: ReadStream;
602
777
  }
603
- declare class OutputService {
778
+ declare class InputService {
604
779
  #private;
605
- constructor(options?: OutputServiceOptions);
606
- clearTerminal(): void;
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;
780
+ constructor(onInput: InputHandler, options?: InputServiceOptions);
781
+ close(): void;
611
782
  }
612
783
 
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
784
  declare class Path {
633
785
  static dirname(filePath: string): string;
634
786
  static join(...filePaths: Array<string>): string;
@@ -647,109 +799,12 @@ declare class ProjectService {
647
799
  openFile(filePath: string, sourceText?: string | undefined, projectRootPath?: string | undefined): void;
648
800
  }
649
801
 
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
802
  declare class TaskRunner {
671
803
  #private;
672
804
  readonly resolvedConfig: ResolvedConfig;
673
- constructor(resolvedConfig: ResolvedConfig, storeService: StoreService);
674
- run(testFiles: Array<URL>, target: Array<string>, cancellationToken?: CancellationToken): Promise<Result>;
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;
805
+ constructor(resolvedConfig: ResolvedConfig, selectService: SelectService, storeService: StoreService);
806
+ close(): void;
807
+ run(testFiles: Array<TestFile>, cancellationToken?: CancellationToken): Promise<void>;
753
808
  }
754
809
 
755
810
  declare class Version {
@@ -759,12 +814,27 @@ declare class Version {
759
814
  static isVersionTag(target: string): boolean;
760
815
  }
761
816
 
762
- type RunCallback = (testFiles: Array<string>) => Promise<void>;
817
+ type WatchHandler = (filePath: string) => void | Promise<void>;
763
818
  declare class Watcher {
764
819
  #private;
765
- readonly resolvedConfig: ResolvedConfig;
766
- constructor(resolvedConfig: ResolvedConfig, runCallback: RunCallback, selectService: SelectService, testFiles: Array<string>);
820
+ readonly targetPath: string;
821
+ constructor(targetPath: string, onChanged: WatchHandler, onRemoved?: WatchHandler, recursive?: boolean);
822
+ close(): void;
767
823
  watch(): Promise<void>;
768
824
  }
769
825
 
770
- 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, InputService, type InputServiceOptions, type ItemDefinition, Line, type MatchResult, OptionBrand, type OptionDefinition, OptionDefinitionsMap, OptionGroup, OutputService, type OutputServiceOptions, Path, ProjectResult, ProjectService, type ReadStream, Reporter, type ResolvedConfig, Result, ResultCount, ResultManager, ResultStatus, ResultTiming, Scribbler, type ScribblerOptions, SelectService, StoreService, SummaryReporter, TSTyche, TargetResult, type TargetResultStatus, TaskRunner, TestMember, TestMemberBrand, TestMemberFlags, TestResult, TestTree, Text, ThoroughReporter, type TypeChecker, Version, WatchModeReporter, Watcher, type WriteStream, addsPackageStepText, describeNameText, diagnosticText, fileStatusText, fileViewText, formattedText, helpText, summaryText, testNameText, usesCompilerStepText, watchModeUsageText };
826
+ type FileWatchHandler = () => void | Promise<void>;
827
+ declare class FileWatcher extends Watcher {
828
+ constructor(targetPath: string, onChanged: FileWatchHandler);
829
+ }
830
+
831
+ type RunCallback = (testFiles: Array<TestFile>) => Promise<void>;
832
+ declare class WatchService {
833
+ #private;
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>>;
838
+ }
839
+
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 };