tstyche 3.0.0-beta.3 → 3.0.0-beta.5

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
  */
@@ -159,6 +178,10 @@ interface ConfigFileOptions {
159
178
  * The list of glob patterns matching the test files.
160
179
  */
161
180
  testFileMatch?: Array<string>;
181
+ /**
182
+ * The look up strategy to be used to find the TSConfig file.
183
+ */
184
+ tsconfig?: string;
162
185
  }
163
186
 
164
187
  /**
@@ -189,10 +212,18 @@ interface CommandLineOptions {
189
212
  * Only run tests with matching name.
190
213
  */
191
214
  only?: string;
215
+ /**
216
+ * The list of plugins to use.
217
+ */
218
+ plugins?: Array<string>;
192
219
  /**
193
220
  * Remove all installed versions of the 'typescript' package and exit.
194
221
  */
195
222
  prune?: boolean;
223
+ /**
224
+ * The list of reporters to use.
225
+ */
226
+ reporters?: Array<string>;
196
227
  /**
197
228
  * Print the resolved configuration and exit.
198
229
  */
@@ -205,6 +236,10 @@ interface CommandLineOptions {
205
236
  * The list of TypeScript versions to be tested on.
206
237
  */
207
238
  target?: Array<string>;
239
+ /**
240
+ * The look up strategy to be used to find the TSConfig file.
241
+ */
242
+ tsconfig?: string;
208
243
  /**
209
244
  * Fetch the 'typescript' package metadata from the registry and exit.
210
245
  */
@@ -219,38 +254,7 @@ interface CommandLineOptions {
219
254
  watch?: boolean;
220
255
  }
221
256
 
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> {
257
+ interface ResolvedConfig extends Omit<CommandLineOptions, "config" | keyof ConfigFileOptions>, Required<ConfigFileOptions> {
254
258
  /**
255
259
  * The path to a TSTyche configuration file.
256
260
  */
@@ -260,11 +264,23 @@ interface ResolvedConfig extends EnvironmentOptions, Omit<CommandLineOptions, ke
260
264
  */
261
265
  pathMatch: Array<string>;
262
266
  }
263
- declare class ConfigService {
264
- #private;
265
- parseCommandLine(commandLineArgs: Array<string>, storeService: StoreService): Promise<void>;
266
- readConfigFile(storeService: StoreService): Promise<void>;
267
- resolveConfig(): ResolvedConfig;
267
+ declare class Config {
268
+ #private;
269
+ static parseCommandLine(commandLine: Array<string>): Promise<{
270
+ commandLineOptions: CommandLineOptions;
271
+ pathMatch: Array<string>;
272
+ }>;
273
+ static parseConfigFile(filePath?: string): Promise<{
274
+ configFileOptions: ConfigFileOptions;
275
+ configFilePath: string;
276
+ }>;
277
+ static resolve(options?: {
278
+ configFileOptions?: ConfigFileOptions;
279
+ configFilePath?: string;
280
+ commandLineOptions?: Omit<CommandLineOptions, "config">;
281
+ pathMatch?: Array<string>;
282
+ }): ResolvedConfig;
283
+ static resolveConfigFilePath(filePath?: string): string;
268
284
  }
269
285
 
270
286
  interface ItemDefinition {
@@ -286,77 +302,73 @@ interface ListTypeOptionDefinition extends BaseOptionDefinition {
286
302
  brand: OptionBrand.List;
287
303
  items: ItemDefinition;
288
304
  }
289
- declare class OptionDefinitionsMap {
305
+ declare class Options {
290
306
  #private;
291
307
  static for(optionGroup: OptionGroup): Map<string, OptionDefinition>;
292
308
  }
293
309
 
294
310
  declare const defaultOptions: Required<ConfigFileOptions>;
295
311
 
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"
312
+ interface EnvironmentOptions {
313
+ /**
314
+ * Is `true` if the process is running in continuous integration environment.
315
+ */
316
+ isCi: boolean;
317
+ /**
318
+ * Specifies whether color should be disabled in the output.
319
+ */
320
+ noColor: boolean;
321
+ /**
322
+ * Specifies whether interactive elements should be disabled in the output.
323
+ */
324
+ noInteractive: boolean;
325
+ /**
326
+ * The base URL of the 'npm' registry to use.
327
+ */
328
+ npmRegistry: string;
329
+ /**
330
+ * The directory where to store the 'typescript' packages.
331
+ */
332
+ storePath: string;
333
+ /**
334
+ * The number of seconds to wait before giving up stale operations.
335
+ */
336
+ timeout: number;
337
+ /**
338
+ * The path to the currently installed TypeScript module.
339
+ */
340
+ typescriptPath: string | undefined;
307
341
  }
308
342
 
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
- }
343
+ declare const environmentOptions: EnvironmentOptions;
330
344
 
331
- interface LineProps {
332
- children?: ScribblerNode;
333
- color?: Color;
334
- indent?: number;
345
+ interface Reporter {
346
+ on: (event: ReporterEvent) => void;
335
347
  }
336
- declare function Line({ children, color, indent }: LineProps): ScribblerJsx.Element;
348
+ type ReporterEvent = Exclude<Event, ["config:error" | "select:error", {}]>;
337
349
 
338
- interface ScribblerOptions {
339
- newLine?: string;
340
- noColor?: boolean;
350
+ declare abstract class BaseReporter implements Reporter {
351
+ protected resolvedConfig: ResolvedConfig;
352
+ constructor(resolvedConfig: ResolvedConfig);
353
+ abstract on([event, payload]: ReporterEvent): void;
341
354
  }
342
- declare class Scribbler {
355
+
356
+ declare class ListReporter extends BaseReporter {
343
357
  #private;
344
- constructor(options?: ScribblerOptions);
345
- render(element: ScribblerJsx.Element): string;
358
+ on([event, payload]: ReporterEvent): void;
346
359
  }
347
360
 
348
- interface TextProps {
349
- children?: ScribblerNode;
350
- color?: Color | undefined;
351
- indent?: number | undefined;
361
+ declare class SetupReporter {
362
+ on([event, payload]: ReporterEvent): void;
352
363
  }
353
- declare function Text({ children, color, indent }: TextProps): ScribblerJsx.Element;
354
-
355
- declare function addsPackageText(packageVersion: string, packagePath: string): ScribblerJsx.Element;
356
364
 
357
- declare function describeNameText(name: string, indent?: number): ScribblerJsx.Element;
365
+ declare class SummaryReporter extends BaseReporter {
366
+ on([event, payload]: ReporterEvent): void;
367
+ }
358
368
 
359
- declare function diagnosticText(diagnostic: Diagnostic): ScribblerJsx.Element;
369
+ declare class WatchReporter extends BaseReporter {
370
+ on([event, payload]: ReporterEvent): void;
371
+ }
360
372
 
361
373
  declare class ResultTiming {
362
374
  end: number;
@@ -439,10 +451,10 @@ type TargetResultStatus = ResultStatus.Runs | ResultStatus.Passed | ResultStatus
439
451
  declare class TargetResult {
440
452
  results: Map<string | undefined, ProjectResult>;
441
453
  status: TargetResultStatus;
454
+ target: string;
442
455
  tasks: Array<Task>;
443
456
  timing: ResultTiming;
444
- versionTag: string;
445
- constructor(versionTag: string, tasks: Array<Task>);
457
+ constructor(target: string, tasks: Array<Task>);
446
458
  }
447
459
 
448
460
  declare class Result {
@@ -457,92 +469,15 @@ declare class Result {
457
469
  constructor(resolvedConfig: ResolvedConfig, tasks: Array<Task>);
458
470
  }
459
471
 
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>;
472
+ interface EventHandler {
473
+ on: (event: Event) => void;
538
474
  }
539
-
540
475
  type Event = ["config:error", {
541
476
  diagnostics: Array<Diagnostic>;
542
- }] | ["deprecation:info", {
543
- diagnostics: Array<Diagnostic>;
544
477
  }] | ["select:error", {
545
478
  diagnostics: Array<Diagnostic>;
479
+ }] | ["deprecation:info", {
480
+ diagnostics: Array<Diagnostic>;
546
481
  }] | ["run:start", {
547
482
  result: Result;
548
483
  }] | ["run:end", {
@@ -601,15 +536,17 @@ type Event = ["config:error", {
601
536
  diagnostics: Array<Diagnostic>;
602
537
  }];
603
538
 
604
- interface EventHandler {
605
- handleEvent: (event: Event) => void;
606
- }
607
539
  declare class EventEmitter {
608
540
  #private;
541
+ static instanceCount: number;
542
+ constructor();
609
543
  addHandler(handler: EventHandler): void;
544
+ addReporter(reporter: Reporter): void;
610
545
  static dispatch(event: Event): void;
611
546
  removeHandler(handler: EventHandler): void;
547
+ removeReporter(reporter: Reporter): void;
612
548
  removeHandlers(): void;
549
+ removeReporters(): void;
613
550
  }
614
551
 
615
552
  type ArgumentNode = ts.Expression | ts.TypeNode;
@@ -763,50 +700,146 @@ declare class ExpectService {
763
700
  declare class CancellationHandler implements EventHandler {
764
701
  #private;
765
702
  constructor(cancellationToken: CancellationToken, cancellationReason: CancellationReason);
766
- handleEvent([, payload]: Event): void;
703
+ on([, payload]: Event): void;
767
704
  }
768
705
 
769
706
  declare class ExitCodeHandler implements EventHandler {
770
707
  #private;
771
- handleEvent([eventName, payload]: Event): void;
708
+ on([event, payload]: Event): void;
772
709
  resetCode(): void;
773
710
  }
774
711
 
775
712
  declare class ResultHandler implements EventHandler {
776
713
  #private;
777
- handleEvent([eventName, payload]: Event): void;
714
+ on([event, payload]: Event): void;
715
+ }
716
+
717
+ interface Hooks {
718
+ /**
719
+ * Is called after configuration is resolved and allows to modify it.
720
+ */
721
+ config?: (resolvedConfig: ResolvedConfig) => ResolvedConfig | Promise<ResolvedConfig>;
722
+ /**
723
+ * Is called after test files are selected and allows to modify the list.
724
+ */
725
+ select?: (testFiles: Array<string>) => Array<string | URL> | Promise<Array<string | URL>>;
778
726
  }
779
727
 
780
- declare abstract class Reporter implements EventHandler {
781
- protected outputService: OutputService;
782
- constructor(outputService: OutputService);
783
- abstract handleEvent([eventName, payload]: Event): void;
728
+ declare class HooksService {
729
+ #private;
730
+ static addHandler(hooks: Hooks): void;
731
+ static call(hook: "config", resolvedConfig: ResolvedConfig): Promise<ResolvedConfig>;
732
+ static call(hook: "select", testFiles: Array<string>): Promise<Array<string | URL>>;
733
+ static removeHandlers(): void;
784
734
  }
785
735
 
786
- declare class RunReporter extends Reporter implements EventHandler {
736
+ type InputHandler = (chunk: string) => void;
737
+ declare class InputService {
787
738
  #private;
788
- constructor(resolvedConfig: ResolvedConfig, outputService: OutputService);
789
- handleEvent([eventName, payload]: Event): void;
739
+ constructor(onInput: InputHandler);
740
+ close(): void;
790
741
  }
791
742
 
792
- declare class SetupReporter extends Reporter implements EventHandler {
793
- handleEvent([eventName, payload]: Event): void;
743
+ declare enum Color {
744
+ Reset = "0",
745
+ Red = "31",
746
+ Green = "32",
747
+ Yellow = "33",
748
+ Blue = "34",
749
+ Magenta = "35",
750
+ Cyan = "36",
751
+ Gray = "90"
794
752
  }
795
753
 
796
- declare class SummaryReporter extends Reporter implements EventHandler {
797
- handleEvent([eventName, payload]: Event): void;
754
+ type ScribblerNode = Array<ScribblerNode> | ScribblerJsx.Element | string | number | undefined;
755
+ type FunctionComponent = (props: Record<string, unknown>) => ScribblerJsx.Element;
756
+ declare namespace ScribblerJsx {
757
+ interface Element {
758
+ props: Record<string, unknown>;
759
+ type: FunctionComponent | number | string;
760
+ }
761
+ interface ElementChildrenAttribute {
762
+ children: ScribblerNode;
763
+ }
764
+ interface IntrinsicElements {
765
+ ansi: {
766
+ escapes: Color | Array<Color>;
767
+ };
768
+ newLine: {};
769
+ text: {
770
+ children: Array<ScribblerNode>;
771
+ indent: number;
772
+ };
773
+ }
798
774
  }
799
775
 
800
- declare class WatchReporter extends Reporter implements EventHandler {
801
- handleEvent([eventName, payload]: Event): void;
776
+ interface LineProps {
777
+ children?: ScribblerNode;
778
+ color?: Color;
779
+ indent?: number;
802
780
  }
781
+ declare function Line({ children, color, indent }: LineProps): ScribblerJsx.Element;
803
782
 
804
- type InputHandler = (chunk: string) => void;
805
- declare class InputService {
783
+ interface ScribblerOptions {
784
+ newLine?: string;
785
+ noColor?: boolean;
786
+ }
787
+ declare class Scribbler {
806
788
  #private;
807
- constructor(onInput: InputHandler);
808
- close(): void;
789
+ constructor(options?: ScribblerOptions);
790
+ render(element: ScribblerJsx.Element): string;
791
+ }
792
+
793
+ interface TextProps {
794
+ children?: ScribblerNode;
795
+ color?: Color | undefined;
796
+ indent?: number | undefined;
809
797
  }
798
+ declare function Text({ children, color, indent }: TextProps): ScribblerJsx.Element;
799
+
800
+ declare function addsPackageText(packageVersion: string, packagePath: string): ScribblerJsx.Element;
801
+
802
+ declare function describeNameText(name: string, indent?: number): ScribblerJsx.Element;
803
+
804
+ declare function diagnosticText(diagnostic: Diagnostic): ScribblerJsx.Element;
805
+
806
+ declare function taskStatusText(status: TaskResultStatus, task: Task): ScribblerJsx.Element;
807
+
808
+ declare function fileViewText(lines: Array<ScribblerJsx.Element>, addEmptyFinalLine: boolean): ScribblerJsx.Element;
809
+
810
+ declare function formattedText(input: string | Array<string> | Record<string, unknown>): ScribblerJsx.Element;
811
+
812
+ declare function helpText(options: Map<string, OptionDefinition>, version: string): ScribblerJsx.Element;
813
+
814
+ declare class OutputService {
815
+ #private;
816
+ static clearTerminal(): void;
817
+ static eraseLastLine(): void;
818
+ static writeError(element: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
819
+ static writeMessage(element: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
820
+ static writeWarning(element: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
821
+ }
822
+
823
+ declare function summaryText({ duration, expectCount, fileCount, onlyMatch, pathMatch, skipMatch, targetCount, testCount, }: {
824
+ duration: number;
825
+ expectCount: ResultCount;
826
+ fileCount: ResultCount;
827
+ onlyMatch: string | undefined;
828
+ pathMatch: Array<string>;
829
+ skipMatch: string | undefined;
830
+ targetCount: ResultCount;
831
+ testCount: ResultCount;
832
+ }): ScribblerJsx.Element;
833
+
834
+ declare function testNameText(status: "fail" | "pass" | "skip" | "todo", name: string, indent?: number): ScribblerJsx.Element;
835
+
836
+ declare function usesCompilerText(compilerVersion: string, projectConfigFilePath: string | undefined, options?: {
837
+ prependEmptyLine: boolean;
838
+ }): ScribblerJsx.Element;
839
+
840
+ declare function waitingForFileChangesText(): ScribblerJsx.Element;
841
+
842
+ declare function watchUsageText(): ScribblerJsx.Element;
810
843
 
811
844
  declare class Path {
812
845
  static normalizeSlashes: (filePath: string) => string;
@@ -818,7 +851,7 @@ declare class Path {
818
851
 
819
852
  declare class ProjectService {
820
853
  #private;
821
- constructor(compiler: typeof ts);
854
+ constructor(resolvedConfig: ResolvedConfig, compiler: typeof ts);
822
855
  closeFile(filePath: string): void;
823
856
  getDefaultProject(filePath: string): ts.server.Project | undefined;
824
857
  getLanguageService(filePath: string): ts.LanguageService | undefined;
@@ -827,9 +860,32 @@ declare class ProjectService {
827
860
 
828
861
  declare class Runner {
829
862
  #private;
830
- constructor(resolvedConfig: ResolvedConfig, selectService: SelectService, storeService: StoreService);
831
- close(): void;
832
- run(tasks: Array<Task>, cancellationToken?: CancellationToken): Promise<void>;
863
+ static version: string;
864
+ constructor(resolvedConfig: ResolvedConfig);
865
+ run(testFiles: Array<string | URL | Task>, cancellationToken?: CancellationToken): Promise<void>;
866
+ }
867
+
868
+ declare class Select {
869
+ #private;
870
+ static isTestFile(filePath: string, resolvedConfig: ResolvedConfig): boolean;
871
+ static selectFiles(resolvedConfig: ResolvedConfig): Promise<Array<string>>;
872
+ }
873
+
874
+ declare class SelectDiagnosticText {
875
+ #private;
876
+ static noTestFilesWereLeft(resolvedConfig: ResolvedConfig): Array<string>;
877
+ static noTestFilesWereSelected(resolvedConfig: ResolvedConfig): Array<string>;
878
+ }
879
+
880
+ declare class Store {
881
+ #private;
882
+ static getSupportedTags(): Promise<Array<string> | undefined>;
883
+ static install(tag: string): Promise<void>;
884
+ static load(tag: string): Promise<typeof ts | undefined>;
885
+ static open(): Promise<void>;
886
+ static prune(): Promise<void>;
887
+ static update(): Promise<void>;
888
+ static validateTag(tag: string): Promise<boolean | undefined>;
833
889
  }
834
890
 
835
891
  declare class Version {
@@ -857,8 +913,8 @@ declare class FileWatcher extends Watcher {
857
913
 
858
914
  declare class WatchService {
859
915
  #private;
860
- constructor(resolvedConfig: ResolvedConfig, selectService: SelectService, tasks: Array<Task>);
916
+ constructor(resolvedConfig: ResolvedConfig, tasks: Array<Task>);
861
917
  watch(cancellationToken: CancellationToken): AsyncIterable<Array<Task>>;
862
918
  }
863
919
 
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 };
920
+ 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 };