tstyche 3.0.0-beta.3 → 3.0.0-beta.4

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.
@@ -1,42 +1,23 @@
1
1
  import type ts from 'typescript';
2
2
 
3
- declare enum OptionBrand {
4
- String = "string",
5
- Number = "number",
6
- Boolean = "boolean",
7
- BareTrue = "bareTrue",// a boolean option that does not take a value and when specified is interpreted as 'true'
8
- List = "list"
9
- }
10
-
11
- declare enum OptionGroup {
12
- CommandLine = 2,
13
- ConfigFile = 4
3
+ declare enum CancellationReason {
4
+ ConfigChange = "configChange",
5
+ ConfigError = "configError",
6
+ FailFast = "failFast",
7
+ WatchClose = "watchClose"
14
8
  }
15
9
 
16
- declare class ConfigDiagnosticText {
10
+ declare class CancellationToken {
17
11
  #private;
18
- static expected(element: string): string;
19
- static expectsListItemType(optionName: string, optionBrand: OptionBrand): string;
20
- static expectsValue(optionName: string, optionGroup: OptionGroup): string;
21
- static fileDoesNotExist(filePath: string): string;
22
- static seen(element: string): string;
23
- static testFileMatchCannotStartWith(segment: string): Array<string>;
24
- static requiresValueType(optionName: string, optionBrand: OptionBrand, optionGroup: OptionGroup): string;
25
- static unknownOption(optionName: string): string;
26
- static versionIsNotSupported(value: string): string;
27
- static watchCannotBeEnabled(): string;
12
+ get isCancellationRequested(): boolean;
13
+ get reason(): CancellationReason | undefined;
14
+ cancel(reason: CancellationReason): void;
15
+ reset(): void;
28
16
  }
29
17
 
30
- declare class StoreService {
18
+ declare class Cli {
31
19
  #private;
32
- constructor();
33
- getSupportedTags(): Promise<Array<string> | undefined>;
34
- install(tag: string): Promise<void>;
35
- load(tag: string): Promise<typeof ts | undefined>;
36
- open(): Promise<void>;
37
- prune(): Promise<void>;
38
- update(): Promise<void>;
39
- validateTag(tag: string): Promise<boolean | undefined>;
20
+ run(commandLine: Array<string>, cancellationToken?: CancellationToken): Promise<void>;
40
21
  }
41
22
 
42
23
  declare enum DiagnosticCategory {
@@ -44,6 +25,48 @@ declare enum DiagnosticCategory {
44
25
  Warning = "warning"
45
26
  }
46
27
 
28
+ declare class SourceFile {
29
+ #private;
30
+ fileName: string;
31
+ text: string;
32
+ constructor(fileName: string, text: string);
33
+ getLineStarts(): Array<number>;
34
+ getLineAndCharacterOfPosition(position: number): {
35
+ line: number;
36
+ character: number;
37
+ };
38
+ }
39
+
40
+ declare class DiagnosticOrigin {
41
+ assertion: Assertion | undefined;
42
+ end: number;
43
+ sourceFile: SourceFile | ts.SourceFile;
44
+ start: number;
45
+ constructor(start: number, end: number, sourceFile: SourceFile | ts.SourceFile, assertion?: Assertion);
46
+ static fromAssertion(assertion: Assertion): DiagnosticOrigin;
47
+ static fromNode(node: ts.Node, assertion?: Assertion): DiagnosticOrigin;
48
+ }
49
+
50
+ declare class Diagnostic {
51
+ #private;
52
+ category: DiagnosticCategory;
53
+ code: string | undefined;
54
+ origin: DiagnosticOrigin | undefined;
55
+ related: Array<Diagnostic> | undefined;
56
+ text: string | Array<string>;
57
+ constructor(text: string | Array<string>, category: DiagnosticCategory, origin?: DiagnosticOrigin);
58
+ add(options: {
59
+ code?: string | undefined;
60
+ related?: Array<Diagnostic> | undefined;
61
+ }): this;
62
+ static error(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
63
+ extendWith(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
64
+ static fromDiagnostics(diagnostics: Array<ts.Diagnostic>, compiler: typeof ts): Array<Diagnostic>;
65
+ static warning(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
66
+ }
67
+
68
+ type DiagnosticsHandler$1 = (this: void, diagnostic: Diagnostic) => void;
69
+
47
70
  declare enum TestMemberBrand {
48
71
  Describe = "describe",
49
72
  Test = "test",
@@ -99,44 +122,32 @@ declare class CollectService {
99
122
  createTestTree(sourceFile: ts.SourceFile, semanticDiagnostics?: Array<ts.Diagnostic>): TestTree;
100
123
  }
101
124
 
102
- declare class SourceFile {
103
- #private;
104
- fileName: string;
105
- text: string;
106
- constructor(fileName: string, text: string);
107
- getLineStarts(): Array<number>;
108
- getLineAndCharacterOfPosition(position: number): {
109
- line: number;
110
- character: number;
111
- };
125
+ declare enum OptionBrand {
126
+ String = "string",
127
+ Number = "number",
128
+ Boolean = "boolean",
129
+ BareTrue = "bareTrue",// a boolean option that does not take a value and when specified is interpreted as 'true'
130
+ List = "list"
112
131
  }
113
132
 
114
- declare class DiagnosticOrigin {
115
- assertion: Assertion | undefined;
116
- end: number;
117
- sourceFile: SourceFile | ts.SourceFile;
118
- start: number;
119
- constructor(start: number, end: number, sourceFile: SourceFile | ts.SourceFile, assertion?: Assertion);
120
- static fromAssertion(assertion: Assertion): DiagnosticOrigin;
121
- static fromNode(node: ts.Node, assertion?: Assertion): DiagnosticOrigin;
133
+ declare enum OptionGroup {
134
+ CommandLine = 2,
135
+ ConfigFile = 4
122
136
  }
123
137
 
124
- declare class Diagnostic {
138
+ declare class ConfigDiagnosticText {
125
139
  #private;
126
- category: DiagnosticCategory;
127
- code: string | undefined;
128
- origin: DiagnosticOrigin | undefined;
129
- related: Array<Diagnostic> | undefined;
130
- text: string | Array<string>;
131
- constructor(text: string | Array<string>, category: DiagnosticCategory, origin?: DiagnosticOrigin);
132
- add(options: {
133
- code?: string | undefined;
134
- related?: Array<Diagnostic> | undefined;
135
- }): this;
136
- static error(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
137
- extendWith(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
138
- static fromDiagnostics(diagnostics: Array<ts.Diagnostic>, compiler: typeof ts): Array<Diagnostic>;
139
- static warning(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
140
+ static expected(element: string): string;
141
+ static expectsListItemType(optionName: string, optionBrand: OptionBrand): string;
142
+ static expectsValue(optionName: string, optionGroup: OptionGroup): string;
143
+ static fileDoesNotExist(filePath: string): string;
144
+ static moduleWasNotFound(specifier: string): string;
145
+ static seen(element: string): string;
146
+ static testFileMatchCannotStartWith(segment: string): Array<string>;
147
+ static requiresValueType(optionName: string, optionBrand: OptionBrand, optionGroup: OptionGroup): string;
148
+ static unknownOption(optionName: string): string;
149
+ static versionIsNotSupported(value: string): string;
150
+ static watchCannotBeEnabled(): string;
140
151
  }
141
152
 
142
153
  /**
@@ -147,6 +158,14 @@ interface ConfigFileOptions {
147
158
  * Stop running tests after the first failed assertion.
148
159
  */
149
160
  failFast?: boolean;
161
+ /**
162
+ * The list of plugins to use.
163
+ */
164
+ plugins?: Array<string>;
165
+ /**
166
+ * The list of reporters to use.
167
+ */
168
+ reporters?: Array<string>;
150
169
  /**
151
170
  * The path to a directory containing files of a test project.
152
171
  */
@@ -189,10 +208,18 @@ interface CommandLineOptions {
189
208
  * Only run tests with matching name.
190
209
  */
191
210
  only?: string;
211
+ /**
212
+ * The list of plugins to use.
213
+ */
214
+ plugins?: Array<string>;
192
215
  /**
193
216
  * Remove all installed versions of the 'typescript' package and exit.
194
217
  */
195
218
  prune?: boolean;
219
+ /**
220
+ * The list of reporters to use.
221
+ */
222
+ reporters?: Array<string>;
196
223
  /**
197
224
  * Print the resolved configuration and exit.
198
225
  */
@@ -219,38 +246,7 @@ interface CommandLineOptions {
219
246
  watch?: boolean;
220
247
  }
221
248
 
222
- interface EnvironmentOptions {
223
- /**
224
- * Is `true` if the process is running in a continuous integration environment.
225
- */
226
- isCi: boolean;
227
- /**
228
- * Specifies whether color should be disabled in the output.
229
- */
230
- noColor: boolean;
231
- /**
232
- * Specifies whether interactive elements should be disabled in the output.
233
- */
234
- noInteractive: boolean;
235
- /**
236
- * The base URL of the 'npm' registry to use.
237
- */
238
- npmRegistry: string;
239
- /**
240
- * The directory where to store the 'typescript' packages.
241
- */
242
- storePath: string;
243
- /**
244
- * The number of seconds to wait before giving up stale operations.
245
- */
246
- timeout: number;
247
- /**
248
- * The path to the currently installed TypeScript module.
249
- */
250
- typescriptPath: string | undefined;
251
- }
252
-
253
- interface ResolvedConfig extends EnvironmentOptions, Omit<CommandLineOptions, keyof ConfigFileOptions | "config">, Required<ConfigFileOptions> {
249
+ interface ResolvedConfig extends Omit<CommandLineOptions, "config" | keyof ConfigFileOptions>, Required<ConfigFileOptions> {
254
250
  /**
255
251
  * The path to a TSTyche configuration file.
256
252
  */
@@ -260,11 +256,23 @@ interface ResolvedConfig extends EnvironmentOptions, Omit<CommandLineOptions, ke
260
256
  */
261
257
  pathMatch: Array<string>;
262
258
  }
263
- declare class ConfigService {
264
- #private;
265
- parseCommandLine(commandLineArgs: Array<string>, storeService: StoreService): Promise<void>;
266
- readConfigFile(storeService: StoreService): Promise<void>;
267
- resolveConfig(): ResolvedConfig;
259
+ declare class Config {
260
+ #private;
261
+ static parseCommandLine(commandLine: Array<string>): Promise<{
262
+ commandLineOptions: CommandLineOptions;
263
+ pathMatch: Array<string>;
264
+ }>;
265
+ static parseConfigFile(filePath?: string): Promise<{
266
+ configFileOptions: ConfigFileOptions;
267
+ configFilePath: string;
268
+ }>;
269
+ static resolve(options?: {
270
+ configFileOptions?: ConfigFileOptions;
271
+ configFilePath?: string;
272
+ commandLineOptions?: Omit<CommandLineOptions, "config">;
273
+ pathMatch?: Array<string>;
274
+ }): ResolvedConfig;
275
+ static resolveConfigFilePath(filePath?: string): string;
268
276
  }
269
277
 
270
278
  interface ItemDefinition {
@@ -286,77 +294,73 @@ interface ListTypeOptionDefinition extends BaseOptionDefinition {
286
294
  brand: OptionBrand.List;
287
295
  items: ItemDefinition;
288
296
  }
289
- declare class OptionDefinitionsMap {
297
+ declare class Options {
290
298
  #private;
291
299
  static for(optionGroup: OptionGroup): Map<string, OptionDefinition>;
292
300
  }
293
301
 
294
302
  declare const defaultOptions: Required<ConfigFileOptions>;
295
303
 
296
- declare const environmentOptions: EnvironmentOptions;
297
-
298
- declare enum Color {
299
- Reset = "0",
300
- Red = "31",
301
- Green = "32",
302
- Yellow = "33",
303
- Blue = "34",
304
- Magenta = "35",
305
- Cyan = "36",
306
- Gray = "90"
304
+ interface EnvironmentOptions {
305
+ /**
306
+ * Is `true` if the process is running in continuous integration environment.
307
+ */
308
+ isCi: boolean;
309
+ /**
310
+ * Specifies whether color should be disabled in the output.
311
+ */
312
+ noColor: boolean;
313
+ /**
314
+ * Specifies whether interactive elements should be disabled in the output.
315
+ */
316
+ noInteractive: boolean;
317
+ /**
318
+ * The base URL of the 'npm' registry to use.
319
+ */
320
+ npmRegistry: string;
321
+ /**
322
+ * The directory where to store the 'typescript' packages.
323
+ */
324
+ storePath: string;
325
+ /**
326
+ * The number of seconds to wait before giving up stale operations.
327
+ */
328
+ timeout: number;
329
+ /**
330
+ * The path to the currently installed TypeScript module.
331
+ */
332
+ typescriptPath: string | undefined;
307
333
  }
308
334
 
309
- type ScribblerNode = Array<ScribblerNode> | ScribblerJsx.Element | string | number | undefined;
310
- type FunctionComponent = (props: Record<string, unknown>) => ScribblerJsx.Element;
311
- declare namespace ScribblerJsx {
312
- interface Element {
313
- props: Record<string, unknown>;
314
- type: FunctionComponent | number | string;
315
- }
316
- interface ElementChildrenAttribute {
317
- children: ScribblerNode;
318
- }
319
- interface IntrinsicElements {
320
- ansi: {
321
- escapes: Color | Array<Color>;
322
- };
323
- newLine: {};
324
- text: {
325
- children: Array<ScribblerNode>;
326
- indent: number;
327
- };
328
- }
329
- }
335
+ declare const environmentOptions: EnvironmentOptions;
330
336
 
331
- interface LineProps {
332
- children?: ScribblerNode;
333
- color?: Color;
334
- indent?: number;
337
+ interface Reporter {
338
+ on: (event: ReporterEvent) => void;
335
339
  }
336
- declare function Line({ children, color, indent }: LineProps): ScribblerJsx.Element;
340
+ type ReporterEvent = Exclude<Event, ["config:error" | "select:error", {}]>;
337
341
 
338
- interface ScribblerOptions {
339
- newLine?: string;
340
- noColor?: boolean;
342
+ declare abstract class BaseReporter implements Reporter {
343
+ protected resolvedConfig: ResolvedConfig;
344
+ constructor(resolvedConfig: ResolvedConfig);
345
+ abstract on([event, payload]: ReporterEvent): void;
341
346
  }
342
- declare class Scribbler {
347
+
348
+ declare class ListReporter extends BaseReporter {
343
349
  #private;
344
- constructor(options?: ScribblerOptions);
345
- render(element: ScribblerJsx.Element): string;
350
+ on([event, payload]: ReporterEvent): void;
346
351
  }
347
352
 
348
- interface TextProps {
349
- children?: ScribblerNode;
350
- color?: Color | undefined;
351
- indent?: number | undefined;
353
+ declare class SetupReporter {
354
+ on([event, payload]: ReporterEvent): void;
352
355
  }
353
- declare function Text({ children, color, indent }: TextProps): ScribblerJsx.Element;
354
356
 
355
- declare function addsPackageText(packageVersion: string, packagePath: string): ScribblerJsx.Element;
356
-
357
- declare function describeNameText(name: string, indent?: number): ScribblerJsx.Element;
357
+ declare class SummaryReporter extends BaseReporter {
358
+ on([event, payload]: ReporterEvent): void;
359
+ }
358
360
 
359
- declare function diagnosticText(diagnostic: Diagnostic): ScribblerJsx.Element;
361
+ declare class WatchReporter extends BaseReporter {
362
+ on([event, payload]: ReporterEvent): void;
363
+ }
360
364
 
361
365
  declare class ResultTiming {
362
366
  end: number;
@@ -457,92 +461,15 @@ declare class Result {
457
461
  constructor(resolvedConfig: ResolvedConfig, tasks: Array<Task>);
458
462
  }
459
463
 
460
- declare function taskStatusText(status: TaskResultStatus, task: Task): ScribblerJsx.Element;
461
-
462
- declare function fileViewText(lines: Array<ScribblerJsx.Element>, addEmptyFinalLine: boolean): ScribblerJsx.Element;
463
-
464
- declare function formattedText(input: string | Array<string> | Record<string, unknown>): ScribblerJsx.Element;
465
-
466
- declare function helpText(optionDefinitions: Map<string, OptionDefinition>, tstycheVersion: string): ScribblerJsx.Element;
467
-
468
- declare class OutputService {
469
- #private;
470
- constructor();
471
- clearTerminal(): void;
472
- eraseLastLine(): void;
473
- writeError(element: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
474
- writeMessage(element: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
475
- writeWarning(element: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
476
- }
477
-
478
- declare function summaryText({ duration, expectCount, fileCount, onlyMatch, pathMatch, skipMatch, targetCount, testCount, }: {
479
- duration: number;
480
- expectCount: ResultCount;
481
- fileCount: ResultCount;
482
- onlyMatch: string | undefined;
483
- pathMatch: Array<string>;
484
- skipMatch: string | undefined;
485
- targetCount: ResultCount;
486
- testCount: ResultCount;
487
- }): ScribblerJsx.Element;
488
-
489
- declare function testNameText(status: "fail" | "pass" | "skip" | "todo", name: string, indent?: number): ScribblerJsx.Element;
490
-
491
- declare function usesCompilerText(compilerVersion: string, projectConfigFilePath: string | undefined, options?: {
492
- prependEmptyLine: boolean;
493
- }): ScribblerJsx.Element;
494
-
495
- declare function waitingForFileChangesText(): ScribblerJsx.Element;
496
-
497
- declare function watchUsageText(): ScribblerJsx.Element;
498
-
499
- declare class SelectDiagnosticText {
500
- #private;
501
- static noTestFilesWereLeft(resolvedConfig: ResolvedConfig): Array<string>;
502
- static noTestFilesWereSelected(resolvedConfig: ResolvedConfig): Array<string>;
503
- }
504
-
505
- declare class SelectService {
506
- #private;
507
- constructor(resolvedConfig: ResolvedConfig);
508
- isTestFile(filePath: string): boolean;
509
- selectFiles(): Promise<Array<string>>;
510
- }
511
-
512
- declare enum CancellationReason {
513
- ConfigChange = "configChange",
514
- ConfigError = "configError",
515
- FailFast = "failFast",
516
- WatchClose = "watchClose"
517
- }
518
-
519
- declare class CancellationToken {
520
- #private;
521
- get isCancellationRequested(): boolean;
522
- get reason(): CancellationReason | undefined;
523
- cancel(reason: CancellationReason): void;
524
- reset(): void;
525
- }
526
-
527
- declare class TSTyche {
528
- #private;
529
- static version: string;
530
- constructor(resolvedConfig: ResolvedConfig, outputService: OutputService, selectService: SelectService, storeService: StoreService);
531
- close(): void;
532
- run(testFiles: Array<string | URL>, cancellationToken?: CancellationToken): Promise<void>;
533
- }
534
-
535
- declare class Cli {
536
- #private;
537
- run(commandLineArguments: Array<string>, cancellationToken?: CancellationToken): Promise<void>;
464
+ interface EventHandler {
465
+ on: (event: Event) => void;
538
466
  }
539
-
540
467
  type Event = ["config:error", {
541
468
  diagnostics: Array<Diagnostic>;
542
- }] | ["deprecation:info", {
543
- diagnostics: Array<Diagnostic>;
544
469
  }] | ["select:error", {
545
470
  diagnostics: Array<Diagnostic>;
471
+ }] | ["deprecation:info", {
472
+ diagnostics: Array<Diagnostic>;
546
473
  }] | ["run:start", {
547
474
  result: Result;
548
475
  }] | ["run:end", {
@@ -601,15 +528,17 @@ type Event = ["config:error", {
601
528
  diagnostics: Array<Diagnostic>;
602
529
  }];
603
530
 
604
- interface EventHandler {
605
- handleEvent: (event: Event) => void;
606
- }
607
531
  declare class EventEmitter {
608
532
  #private;
533
+ static instanceCount: number;
534
+ constructor();
609
535
  addHandler(handler: EventHandler): void;
536
+ addReporter(reporter: Reporter): void;
610
537
  static dispatch(event: Event): void;
611
538
  removeHandler(handler: EventHandler): void;
539
+ removeReporter(reporter: Reporter): void;
612
540
  removeHandlers(): void;
541
+ removeReporters(): void;
613
542
  }
614
543
 
615
544
  type ArgumentNode = ts.Expression | ts.TypeNode;
@@ -763,50 +692,146 @@ declare class ExpectService {
763
692
  declare class CancellationHandler implements EventHandler {
764
693
  #private;
765
694
  constructor(cancellationToken: CancellationToken, cancellationReason: CancellationReason);
766
- handleEvent([, payload]: Event): void;
695
+ on([, payload]: Event): void;
767
696
  }
768
697
 
769
698
  declare class ExitCodeHandler implements EventHandler {
770
699
  #private;
771
- handleEvent([eventName, payload]: Event): void;
700
+ on([event, payload]: Event): void;
772
701
  resetCode(): void;
773
702
  }
774
703
 
775
704
  declare class ResultHandler implements EventHandler {
776
705
  #private;
777
- handleEvent([eventName, payload]: Event): void;
706
+ on([event, payload]: Event): void;
778
707
  }
779
708
 
780
- declare abstract class Reporter implements EventHandler {
781
- protected outputService: OutputService;
782
- constructor(outputService: OutputService);
783
- abstract handleEvent([eventName, payload]: Event): void;
709
+ interface Hooks {
710
+ /**
711
+ * Is called after configuration is resolved and allows to modify it.
712
+ */
713
+ config?: (resolvedConfig: ResolvedConfig) => ResolvedConfig | Promise<ResolvedConfig>;
714
+ /**
715
+ * Is called after test files are selected and allows to modify the list.
716
+ */
717
+ select?: (testFiles: Array<string>) => Array<string | URL> | Promise<Array<string | URL>>;
784
718
  }
785
719
 
786
- declare class RunReporter extends Reporter implements EventHandler {
720
+ declare class HooksService {
787
721
  #private;
788
- constructor(resolvedConfig: ResolvedConfig, outputService: OutputService);
789
- handleEvent([eventName, payload]: Event): void;
722
+ static addHandler(hooks: Hooks): void;
723
+ static call(hook: "config", resolvedConfig: ResolvedConfig): Promise<ResolvedConfig>;
724
+ static call(hook: "select", testFiles: Array<string>): Promise<Array<string | URL>>;
725
+ static removeHandlers(): void;
790
726
  }
791
727
 
792
- declare class SetupReporter extends Reporter implements EventHandler {
793
- handleEvent([eventName, payload]: Event): void;
728
+ type InputHandler = (chunk: string) => void;
729
+ declare class InputService {
730
+ #private;
731
+ constructor(onInput: InputHandler);
732
+ close(): void;
794
733
  }
795
734
 
796
- declare class SummaryReporter extends Reporter implements EventHandler {
797
- handleEvent([eventName, payload]: Event): void;
735
+ declare enum Color {
736
+ Reset = "0",
737
+ Red = "31",
738
+ Green = "32",
739
+ Yellow = "33",
740
+ Blue = "34",
741
+ Magenta = "35",
742
+ Cyan = "36",
743
+ Gray = "90"
798
744
  }
799
745
 
800
- declare class WatchReporter extends Reporter implements EventHandler {
801
- handleEvent([eventName, payload]: Event): void;
746
+ type ScribblerNode = Array<ScribblerNode> | ScribblerJsx.Element | string | number | undefined;
747
+ type FunctionComponent = (props: Record<string, unknown>) => ScribblerJsx.Element;
748
+ declare namespace ScribblerJsx {
749
+ interface Element {
750
+ props: Record<string, unknown>;
751
+ type: FunctionComponent | number | string;
752
+ }
753
+ interface ElementChildrenAttribute {
754
+ children: ScribblerNode;
755
+ }
756
+ interface IntrinsicElements {
757
+ ansi: {
758
+ escapes: Color | Array<Color>;
759
+ };
760
+ newLine: {};
761
+ text: {
762
+ children: Array<ScribblerNode>;
763
+ indent: number;
764
+ };
765
+ }
802
766
  }
803
767
 
804
- type InputHandler = (chunk: string) => void;
805
- declare class InputService {
768
+ interface LineProps {
769
+ children?: ScribblerNode;
770
+ color?: Color;
771
+ indent?: number;
772
+ }
773
+ declare function Line({ children, color, indent }: LineProps): ScribblerJsx.Element;
774
+
775
+ interface ScribblerOptions {
776
+ newLine?: string;
777
+ noColor?: boolean;
778
+ }
779
+ declare class Scribbler {
806
780
  #private;
807
- constructor(onInput: InputHandler);
808
- close(): void;
781
+ constructor(options?: ScribblerOptions);
782
+ render(element: ScribblerJsx.Element): string;
783
+ }
784
+
785
+ interface TextProps {
786
+ children?: ScribblerNode;
787
+ color?: Color | undefined;
788
+ indent?: number | undefined;
809
789
  }
790
+ declare function Text({ children, color, indent }: TextProps): ScribblerJsx.Element;
791
+
792
+ declare function addsPackageText(packageVersion: string, packagePath: string): ScribblerJsx.Element;
793
+
794
+ declare function describeNameText(name: string, indent?: number): ScribblerJsx.Element;
795
+
796
+ declare function diagnosticText(diagnostic: Diagnostic): ScribblerJsx.Element;
797
+
798
+ declare function taskStatusText(status: TaskResultStatus, task: Task): ScribblerJsx.Element;
799
+
800
+ declare function fileViewText(lines: Array<ScribblerJsx.Element>, addEmptyFinalLine: boolean): ScribblerJsx.Element;
801
+
802
+ declare function formattedText(input: string | Array<string> | Record<string, unknown>): ScribblerJsx.Element;
803
+
804
+ declare function helpText(options: Map<string, OptionDefinition>, version: string): ScribblerJsx.Element;
805
+
806
+ declare class OutputService {
807
+ #private;
808
+ static clearTerminal(): void;
809
+ static eraseLastLine(): void;
810
+ static writeError(element: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
811
+ static writeMessage(element: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
812
+ static writeWarning(element: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
813
+ }
814
+
815
+ declare function summaryText({ duration, expectCount, fileCount, onlyMatch, pathMatch, skipMatch, targetCount, testCount, }: {
816
+ duration: number;
817
+ expectCount: ResultCount;
818
+ fileCount: ResultCount;
819
+ onlyMatch: string | undefined;
820
+ pathMatch: Array<string>;
821
+ skipMatch: string | undefined;
822
+ targetCount: ResultCount;
823
+ testCount: ResultCount;
824
+ }): ScribblerJsx.Element;
825
+
826
+ declare function testNameText(status: "fail" | "pass" | "skip" | "todo", name: string, indent?: number): ScribblerJsx.Element;
827
+
828
+ declare function usesCompilerText(compilerVersion: string, projectConfigFilePath: string | undefined, options?: {
829
+ prependEmptyLine: boolean;
830
+ }): ScribblerJsx.Element;
831
+
832
+ declare function waitingForFileChangesText(): ScribblerJsx.Element;
833
+
834
+ declare function watchUsageText(): ScribblerJsx.Element;
810
835
 
811
836
  declare class Path {
812
837
  static normalizeSlashes: (filePath: string) => string;
@@ -827,9 +852,32 @@ declare class ProjectService {
827
852
 
828
853
  declare class Runner {
829
854
  #private;
830
- constructor(resolvedConfig: ResolvedConfig, selectService: SelectService, storeService: StoreService);
831
- close(): void;
832
- run(tasks: Array<Task>, cancellationToken?: CancellationToken): Promise<void>;
855
+ static version: string;
856
+ constructor(resolvedConfig: ResolvedConfig);
857
+ run(testFiles: Array<string | URL | Task>, cancellationToken?: CancellationToken): Promise<void>;
858
+ }
859
+
860
+ declare class Select {
861
+ #private;
862
+ static isTestFile(filePath: string, resolvedConfig: ResolvedConfig): boolean;
863
+ static selectFiles(resolvedConfig: ResolvedConfig): Promise<Array<string>>;
864
+ }
865
+
866
+ declare class SelectDiagnosticText {
867
+ #private;
868
+ static noTestFilesWereLeft(resolvedConfig: ResolvedConfig): Array<string>;
869
+ static noTestFilesWereSelected(resolvedConfig: ResolvedConfig): Array<string>;
870
+ }
871
+
872
+ declare class Store {
873
+ #private;
874
+ static getSupportedTags(): Promise<Array<string> | undefined>;
875
+ static install(tag: string): Promise<void>;
876
+ static load(tag: string): Promise<typeof ts | undefined>;
877
+ static open(): Promise<void>;
878
+ static prune(): Promise<void>;
879
+ static update(): Promise<void>;
880
+ static validateTag(tag: string): Promise<boolean | undefined>;
833
881
  }
834
882
 
835
883
  declare class Version {
@@ -857,8 +905,8 @@ declare class FileWatcher extends Watcher {
857
905
 
858
906
  declare class WatchService {
859
907
  #private;
860
- constructor(resolvedConfig: ResolvedConfig, selectService: SelectService, tasks: Array<Task>);
908
+ constructor(resolvedConfig: ResolvedConfig, tasks: Array<Task>);
861
909
  watch(cancellationToken: CancellationToken): AsyncIterable<Array<Task>>;
862
910
  }
863
911
 
864
- export { Assertion, CancellationHandler, CancellationReason, CancellationToken, Cli, CollectService, Color, type CommandLineOptions, ConfigDiagnosticText, type ConfigFileOptions, ConfigService, DescribeResult, Diagnostic, DiagnosticCategory, DiagnosticOrigin, type Event, EventEmitter, type EventHandler, ExitCodeHandler, ExpectResult, ExpectService, type FileWatchHandler, FileWatcher, type InputHandler, InputService, type ItemDefinition, Line, type MatchResult, OptionBrand, type OptionDefinition, OptionDefinitionsMap, OptionGroup, OutputService, Path, ProjectResult, ProjectService, type ResolvedConfig, Result, ResultCount, ResultHandler, ResultStatus, ResultTiming, RunReporter, Runner, Scribbler, ScribblerJsx, type ScribblerOptions, SelectDiagnosticText, SelectService, SetupReporter, SourceFile, StoreService, SummaryReporter, TSTyche, TargetResult, type TargetResultStatus, Task, TaskResult, type TaskResultStatus, TestMember, TestMemberBrand, TestMemberFlags, TestResult, TestTree, Text, type TypeChecker, Version, type WatchHandler, WatchReporter, WatchService, Watcher, type WatcherOptions, addsPackageText, defaultOptions, describeNameText, diagnosticText, environmentOptions, fileViewText, formattedText, helpText, summaryText, taskStatusText, testNameText, usesCompilerText, waitingForFileChangesText, watchUsageText };
912
+ export { Assertion, BaseReporter, CancellationHandler, CancellationReason, CancellationToken, Cli, CollectService, Color, type CommandLineOptions, Config, ConfigDiagnosticText, type ConfigFileOptions, DescribeResult, Diagnostic, DiagnosticCategory, DiagnosticOrigin, type DiagnosticsHandler$1 as DiagnosticsHandler, type EnvironmentOptions, type Event, EventEmitter, type EventHandler, ExitCodeHandler, ExpectResult, ExpectService, type FileWatchHandler, FileWatcher, type Hooks, HooksService, type InputHandler, InputService, type ItemDefinition, Line, ListReporter, type MatchResult, OptionBrand, type OptionDefinition, OptionGroup, Options, OutputService, Path, ProjectResult, ProjectService, type Reporter, type ReporterEvent, type ResolvedConfig, Result, ResultCount, ResultHandler, ResultStatus, ResultTiming, Runner, Scribbler, ScribblerJsx, type ScribblerOptions, Select, SelectDiagnosticText, SetupReporter, SourceFile, Store, SummaryReporter, TargetResult, type TargetResultStatus, Task, TaskResult, type TaskResultStatus, TestMember, TestMemberBrand, TestMemberFlags, TestResult, TestTree, Text, type TypeChecker, Version, type WatchHandler, WatchReporter, WatchService, Watcher, type WatcherOptions, addsPackageText, defaultOptions, describeNameText, diagnosticText, environmentOptions, fileViewText, formattedText, helpText, summaryText, taskStatusText, testNameText, usesCompilerText, waitingForFileChangesText, watchUsageText };