tstyche 2.0.0-rc.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -71,7 +71,7 @@ The `tstyche` command is the heart of TSTyche. For example, it can select test f
71
71
  tstyche JsonObject --only external --target 4.8,latest
72
72
  ```
73
73
 
74
- This simple!
74
+ This simple! (And it has the watch mode too.)
75
75
 
76
76
  ## Documentation
77
77
 
@@ -156,6 +156,19 @@ interface CommandLineOptions {
156
156
  watch?: boolean;
157
157
  }
158
158
 
159
+ declare class ConfigDiagnosticText {
160
+ #private;
161
+ static doubleQuotesExpected(): string;
162
+ static expectsListItemType(optionName: string, optionBrand: OptionBrand): string;
163
+ static expectsValue(optionName: string, optionGroup: OptionGroup): string;
164
+ static fileDoesNotExist(filePath: string): string;
165
+ static testFileMatchCannotStartWith(segment: string): Array<string>;
166
+ static requiresValueType(optionName: string, optionBrand: OptionBrand, optionGroup: OptionGroup): string;
167
+ static unknownOption(optionName: string): string;
168
+ static versionIsNotSupported(value: string): string;
169
+ static watchCannotBeEnabled(): string;
170
+ }
171
+
159
172
  /**
160
173
  * Options loaded from the configuration file.
161
174
  */
@@ -197,22 +210,6 @@ declare class ConfigService {
197
210
  resolveConfig(): ResolvedConfig;
198
211
  }
199
212
 
200
- declare class OptionDiagnosticText {
201
- #private;
202
- static doubleQuotesExpected(): string;
203
- static expectsListItemType(optionName: string, optionBrand: OptionBrand): string;
204
- static expectsValue(optionName: string, optionGroup: OptionGroup): string;
205
- static fileDoesNotExist(filePath: string): string;
206
- static noTestFilesWereLeft(resolvedConfig: ResolvedConfig): Array<string>;
207
- static noTestFilesWereSelected(resolvedConfig: ResolvedConfig): Array<string>;
208
- static testFileMatchCannotStartWith(segment: string): Array<string>;
209
- static requiresValueType(optionName: string, optionBrand: OptionBrand, optionGroup: OptionGroup): string;
210
- static unknownOption(optionName: string): string;
211
- static versionIsNotSupported(value: string): string;
212
- static watchCannotBeEnabledInCiEnvironment(): string;
213
- static watchIsNotAvailable(): string;
214
- }
215
-
216
213
  declare enum Color {
217
214
  Reset = "0",
218
215
  Red = "31",
@@ -224,46 +221,34 @@ declare enum Color {
224
221
  Gray = "90"
225
222
  }
226
223
 
227
- type ElementChildren = Array<ElementChildren> | ScribblerJsx.Element | string | undefined;
228
- type ComponentConstructor = new (props: Record<string, unknown>) => ScribblerJsx.ElementClass;
224
+ type ScribblerNode = Array<ScribblerNode> | ScribblerJsx.Element | string | undefined;
225
+ type FunctionComponent = (props: Record<string, unknown>) => ScribblerJsx.Element;
229
226
  declare namespace ScribblerJsx {
230
227
  interface Element {
231
228
  props: Record<string, unknown>;
232
- type: ComponentConstructor | string;
233
- }
234
- interface ElementAttributesProperty {
235
- props: Record<string, unknown>;
236
- }
237
- interface ElementClass {
238
- render: () => ScribblerJsx.Element;
229
+ type: FunctionComponent | string;
239
230
  }
240
231
  interface ElementChildrenAttribute {
241
- children: ElementChildren;
232
+ children: ScribblerNode;
242
233
  }
243
234
  interface IntrinsicElements {
244
235
  ansi: {
245
236
  escapes: Color | Array<Color>;
246
237
  };
247
- newLine: {
248
- [key: string]: never;
249
- };
238
+ newLine: {};
250
239
  text: {
251
- children: Array<ElementChildren>;
240
+ children: Array<ScribblerNode>;
252
241
  indent: number;
253
242
  };
254
243
  }
255
244
  }
256
245
 
257
246
  interface LineProps {
258
- children?: ScribblerJsx.ElementChildrenAttribute["children"];
247
+ children?: ScribblerNode;
259
248
  color?: Color;
260
249
  indent?: number;
261
250
  }
262
- declare class Line implements ScribblerJsx.ElementClass {
263
- props: LineProps;
264
- constructor(props: LineProps);
265
- render(): ScribblerJsx.Element;
266
- }
251
+ declare function Line({ children, color, indent }: LineProps): ScribblerJsx.Element;
267
252
 
268
253
  interface ScribblerOptions {
269
254
  newLine?: string;
@@ -276,15 +261,11 @@ declare class Scribbler {
276
261
  }
277
262
 
278
263
  interface TextProps {
279
- children?: ScribblerJsx.ElementChildrenAttribute["children"];
264
+ children?: ScribblerNode;
280
265
  color?: Color | undefined;
281
266
  indent?: number | undefined;
282
267
  }
283
- declare class Text implements ScribblerJsx.ElementClass {
284
- props: TextProps;
285
- constructor(props: TextProps);
286
- render(): ScribblerJsx.Element;
287
- }
268
+ declare function Text({ children, color, indent }: TextProps): ScribblerJsx.Element;
288
269
 
289
270
  declare function addsPackageStepText(compilerVersion: string, installationPath: string): ScribblerJsx.Element;
290
271
 
@@ -446,85 +427,6 @@ declare class Result {
446
427
  constructor(resolvedConfig: ResolvedConfig, testFiles: Array<TestFile>);
447
428
  }
448
429
 
449
- type Event = ["config:error", {
450
- diagnostics: Array<Diagnostic>;
451
- }] | ["deprecation:info", {
452
- diagnostics: Array<Diagnostic>;
453
- }] | ["select:error", {
454
- diagnostics: Array<Diagnostic>;
455
- }] | ["run:start", {
456
- result: Result;
457
- }] | ["run:end", {
458
- result: Result;
459
- }] | ["store:info", {
460
- compilerVersion: string;
461
- installationPath: string;
462
- }] | ["store:error", {
463
- diagnostics: Array<Diagnostic>;
464
- }] | ["target:start", {
465
- result: TargetResult;
466
- }] | ["target:end", {
467
- result: TargetResult;
468
- }] | ["project:info", {
469
- compilerVersion: string;
470
- projectConfigFilePath: string | undefined;
471
- }] | ["project:error", {
472
- diagnostics: Array<Diagnostic>;
473
- }] | ["file:start", {
474
- result: FileResult;
475
- }] | ["file:error", {
476
- diagnostics: Array<Diagnostic>;
477
- result: FileResult;
478
- }] | ["file:end", {
479
- result: FileResult;
480
- }] | ["describe:start", {
481
- result: DescribeResult;
482
- }] | ["describe:end", {
483
- result: DescribeResult;
484
- }] | ["test:start", {
485
- result: TestResult;
486
- }] | ["test:error", {
487
- diagnostics: Array<Diagnostic>;
488
- result: TestResult;
489
- }] | ["test:fail", {
490
- result: TestResult;
491
- }] | ["test:pass", {
492
- result: TestResult;
493
- }] | ["test:skip", {
494
- result: TestResult;
495
- }] | ["test:todo", {
496
- result: TestResult;
497
- }] | ["expect:start", {
498
- result: ExpectResult;
499
- }] | ["expect:error", {
500
- diagnostics: Array<Diagnostic>;
501
- result: ExpectResult;
502
- }] | ["expect:fail", {
503
- diagnostics: Array<Diagnostic>;
504
- result: ExpectResult;
505
- }] | ["expect:pass", {
506
- result: ExpectResult;
507
- }] | ["expect:skip", {
508
- result: ExpectResult;
509
- }] | ["watch:error", {
510
- diagnostics: Array<Diagnostic>;
511
- }];
512
- interface EventHandler {
513
- handleEvent: (event: Event) => void;
514
- }
515
- declare class EventEmitter {
516
- #private;
517
- addHandler(handler: EventHandler): void;
518
- static dispatch(event: Event): void;
519
- removeHandler(handler: EventHandler): void;
520
- removeHandlers(): void;
521
- }
522
-
523
- declare class ResultHandler {
524
- #private;
525
- handleEvent([eventName, payload]: Event): void;
526
- }
527
-
528
430
  declare function fileStatusText(status: FileResultStatus, testFile: TestFile): ScribblerJsx.Element;
529
431
 
530
432
  declare function fileViewText(lines: Array<ScribblerJsx.Element>, addEmptyFinalLine: boolean): ScribblerJsx.Element;
@@ -572,6 +474,12 @@ declare function waitingForFileChangesText(): ScribblerJsx.Element;
572
474
 
573
475
  declare function watchUsageText(): ScribblerJsx.Element;
574
476
 
477
+ declare class SelectDiagnosticText {
478
+ #private;
479
+ static noTestFilesWereLeft(resolvedConfig: ResolvedConfig): Array<string>;
480
+ static noTestFilesWereSelected(resolvedConfig: ResolvedConfig): Array<string>;
481
+ }
482
+
575
483
  declare class SelectService {
576
484
  #private;
577
485
  constructor(resolvedConfig: ResolvedConfig);
@@ -620,6 +528,81 @@ declare class Environment {
620
528
  static get typescriptPath(): string | undefined;
621
529
  }
622
530
 
531
+ type Event = ["config:error", {
532
+ diagnostics: Array<Diagnostic>;
533
+ }] | ["deprecation:info", {
534
+ diagnostics: Array<Diagnostic>;
535
+ }] | ["select:error", {
536
+ diagnostics: Array<Diagnostic>;
537
+ }] | ["run:start", {
538
+ result: Result;
539
+ }] | ["run:end", {
540
+ result: Result;
541
+ }] | ["store:info", {
542
+ compilerVersion: string;
543
+ installationPath: string;
544
+ }] | ["store:error", {
545
+ diagnostics: Array<Diagnostic>;
546
+ }] | ["target:start", {
547
+ result: TargetResult;
548
+ }] | ["target:end", {
549
+ result: TargetResult;
550
+ }] | ["project:info", {
551
+ compilerVersion: string;
552
+ projectConfigFilePath: string | undefined;
553
+ }] | ["project:error", {
554
+ diagnostics: Array<Diagnostic>;
555
+ }] | ["file:start", {
556
+ result: FileResult;
557
+ }] | ["file:error", {
558
+ diagnostics: Array<Diagnostic>;
559
+ result: FileResult;
560
+ }] | ["file:end", {
561
+ result: FileResult;
562
+ }] | ["describe:start", {
563
+ result: DescribeResult;
564
+ }] | ["describe:end", {
565
+ result: DescribeResult;
566
+ }] | ["test:start", {
567
+ result: TestResult;
568
+ }] | ["test:error", {
569
+ diagnostics: Array<Diagnostic>;
570
+ result: TestResult;
571
+ }] | ["test:fail", {
572
+ result: TestResult;
573
+ }] | ["test:pass", {
574
+ result: TestResult;
575
+ }] | ["test:skip", {
576
+ result: TestResult;
577
+ }] | ["test:todo", {
578
+ result: TestResult;
579
+ }] | ["expect:start", {
580
+ result: ExpectResult;
581
+ }] | ["expect:error", {
582
+ diagnostics: Array<Diagnostic>;
583
+ result: ExpectResult;
584
+ }] | ["expect:fail", {
585
+ diagnostics: Array<Diagnostic>;
586
+ result: ExpectResult;
587
+ }] | ["expect:pass", {
588
+ result: ExpectResult;
589
+ }] | ["expect:skip", {
590
+ result: ExpectResult;
591
+ }] | ["watch:error", {
592
+ diagnostics: Array<Diagnostic>;
593
+ }];
594
+
595
+ interface EventHandler {
596
+ handleEvent: (event: Event) => void;
597
+ }
598
+ declare class EventEmitter {
599
+ #private;
600
+ addHandler(handler: EventHandler): void;
601
+ static dispatch(event: Event): void;
602
+ removeHandler(handler: EventHandler): void;
603
+ removeHandlers(): void;
604
+ }
605
+
623
606
  interface MatchResult {
624
607
  explain: () => Array<Diagnostic>;
625
608
  isMatch: boolean;
@@ -731,34 +714,40 @@ declare class ExitCodeHandler implements EventHandler {
731
714
  resetCode(): void;
732
715
  }
733
716
 
734
- declare class RuntimeReporter implements EventHandler {
717
+ declare class ResultHandler implements EventHandler {
735
718
  #private;
736
- constructor(resolvedConfig: ResolvedConfig, outputService: OutputService);
737
719
  handleEvent([eventName, payload]: Event): void;
738
720
  }
739
721
 
740
- declare class SetupReporter implements EventHandler {
741
- #private;
722
+ declare abstract class Reporter implements EventHandler {
723
+ protected outputService: OutputService;
742
724
  constructor(outputService: OutputService);
743
- handleEvent([eventName, payload]: Event): void;
725
+ abstract handleEvent([eventName, payload]: Event): void;
744
726
  }
745
727
 
746
- declare class SummaryReporter implements EventHandler {
728
+ declare class RunReporter extends Reporter implements EventHandler {
747
729
  #private;
748
- constructor(outputService: OutputService);
730
+ constructor(resolvedConfig: ResolvedConfig, outputService: OutputService);
749
731
  handleEvent([eventName, payload]: Event): void;
750
732
  }
751
733
 
752
- declare class WatchReporter implements EventHandler {
753
- #private;
754
- constructor(outputService: OutputService);
734
+ declare class SetupReporter extends Reporter implements EventHandler {
735
+ handleEvent([eventName, payload]: Event): void;
736
+ }
737
+
738
+ declare class SummaryReporter extends Reporter implements EventHandler {
739
+ handleEvent([eventName, payload]: Event): void;
740
+ }
741
+
742
+ declare class WatchReporter extends Reporter implements EventHandler {
755
743
  handleEvent([eventName, payload]: Event): void;
756
744
  }
757
745
 
758
- type InputHandler = (chunk: Buffer) => void;
746
+ type InputHandler = (chunk: string) => void;
759
747
  interface ReadStream {
760
748
  addListener: (event: "data", handler: InputHandler) => this;
761
749
  removeListener: (event: "data", handler: InputHandler) => this;
750
+ setEncoding: (encoding: "utf8") => this;
762
751
  setRawMode?: (mode: boolean) => this;
763
752
  unref: () => this;
764
753
  }
@@ -826,4 +815,4 @@ declare class WatchService {
826
815
  watch(cancellationToken?: CancellationToken): Promise<Array<void>>;
827
816
  }
828
817
 
829
- export { Assertion, CancellationHandler, CancellationReason, CancellationToken, Cli, CollectService, Color, type CommandLineOptions, type ConfigFileOptions, ConfigService, DescribeResult, Diagnostic, DiagnosticCategory, DiagnosticOrigin, Environment, type Event, EventEmitter, type EventHandler, ExitCodeHandler, Expect, ExpectResult, FileResult, type FileResultStatus, type FileWatchHandler, FileWatcher, type InputHandler, InputService, type InputServiceOptions, type ItemDefinition, Line, type MatchResult, OptionBrand, type OptionDefinition, OptionDefinitionsMap, OptionDiagnosticText, OptionGroup, OutputService, type OutputServiceOptions, Path, ProjectResult, ProjectService, type ReadStream, type ResolvedConfig, Result, ResultCount, ResultHandler, ResultStatus, ResultTiming, type RunCallback, RuntimeReporter, Scribbler, ScribblerJsx, type ScribblerOptions, SelectService, SetupReporter, StoreService, SummaryReporter, TSTyche, TargetResult, type TargetResultStatus, TaskRunner, TestFile, TestMember, TestMemberBrand, TestMemberFlags, TestResult, TestTree, Text, type TypeChecker, Version, type WatchHandler, WatchReporter, WatchService, Watcher, type WatcherOptions, type WriteStream, addsPackageStepText, defaultOptions, describeNameText, diagnosticText, fileStatusText, fileViewText, formattedText, helpText, summaryText, testNameText, usesCompilerStepText, waitingForFileChangesText, watchUsageText };
818
+ export { Assertion, CancellationHandler, CancellationReason, CancellationToken, Cli, CollectService, Color, type CommandLineOptions, ConfigDiagnosticText, type ConfigFileOptions, ConfigService, DescribeResult, Diagnostic, DiagnosticCategory, DiagnosticOrigin, Environment, type Event, EventEmitter, type EventHandler, ExitCodeHandler, Expect, ExpectResult, FileResult, type FileResultStatus, type FileWatchHandler, FileWatcher, type InputHandler, InputService, type InputServiceOptions, type ItemDefinition, Line, type MatchResult, OptionBrand, type OptionDefinition, OptionDefinitionsMap, OptionGroup, OutputService, type OutputServiceOptions, Path, ProjectResult, ProjectService, type ReadStream, type ResolvedConfig, Result, ResultCount, ResultHandler, ResultStatus, ResultTiming, type RunCallback, RunReporter, Scribbler, ScribblerJsx, type ScribblerOptions, SelectDiagnosticText, SelectService, SetupReporter, StoreService, SummaryReporter, TSTyche, TargetResult, type TargetResultStatus, TaskRunner, TestFile, TestMember, TestMemberBrand, TestMemberFlags, TestResult, TestTree, Text, type TypeChecker, Version, type WatchHandler, WatchReporter, WatchService, Watcher, type WatcherOptions, type WriteStream, addsPackageStepText, defaultOptions, describeNameText, diagnosticText, fileStatusText, fileViewText, formattedText, helpText, summaryText, testNameText, usesCompilerStepText, waitingForFileChangesText, watchUsageText };