tstyche 1.0.0 → 2.0.0-beta.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 +9 -6
- package/build/index.d.cts +109 -50
- package/build/index.d.ts +109 -50
- package/build/tstyche.d.ts +101 -83
- package/build/tstyche.js +719 -388
- package/package.json +18 -23
- package/CHANGELOG.md +0 -156
package/build/tstyche.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ interface DiagnosticOrigin {
|
|
|
12
12
|
start: number;
|
|
13
13
|
}
|
|
14
14
|
declare class Diagnostic {
|
|
15
|
-
#private;
|
|
16
15
|
text: string | Array<string>;
|
|
17
16
|
category: DiagnosticCategory;
|
|
18
17
|
origin?: DiagnosticOrigin | undefined;
|
|
@@ -31,17 +30,22 @@ declare class Diagnostic {
|
|
|
31
30
|
static warning(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
|
|
32
31
|
}
|
|
33
32
|
|
|
33
|
+
declare class CancellationToken {
|
|
34
|
+
#private;
|
|
35
|
+
get isCancellationRequested(): boolean;
|
|
36
|
+
cancel(): void;
|
|
37
|
+
}
|
|
38
|
+
|
|
34
39
|
declare class StoreService {
|
|
35
40
|
#private;
|
|
36
41
|
constructor();
|
|
37
|
-
getSupportedTags(
|
|
38
|
-
install(tag: string,
|
|
39
|
-
load(tag: string,
|
|
40
|
-
open(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
validateTag(tag: string, signal?: AbortSignal): Promise<boolean>;
|
|
42
|
+
getSupportedTags(): Promise<Array<string>>;
|
|
43
|
+
install(tag: string, cancellationToken?: CancellationToken): Promise<string | undefined>;
|
|
44
|
+
load(tag: string, cancellationToken?: CancellationToken): Promise<typeof ts | undefined>;
|
|
45
|
+
open(): Promise<void>;
|
|
46
|
+
resolveTag(tag: string): Promise<string | undefined>;
|
|
47
|
+
update(): Promise<void>;
|
|
48
|
+
validateTag(tag: string): Promise<boolean | undefined>;
|
|
45
49
|
}
|
|
46
50
|
|
|
47
51
|
declare enum OptionBrand {
|
|
@@ -132,6 +136,10 @@ interface CommandLineOptions {
|
|
|
132
136
|
* Print the version number and exit.
|
|
133
137
|
*/
|
|
134
138
|
version?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Watch for changes and rerun related tests files.
|
|
141
|
+
*/
|
|
142
|
+
watch?: boolean;
|
|
135
143
|
}
|
|
136
144
|
|
|
137
145
|
/**
|
|
@@ -172,15 +180,23 @@ declare class ConfigService {
|
|
|
172
180
|
parseCommandLine(commandLineArgs: Array<string>): Promise<void>;
|
|
173
181
|
readConfigFile(): Promise<void>;
|
|
174
182
|
resolveConfig(): ResolvedConfig;
|
|
175
|
-
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
declare class SelectService {
|
|
186
|
+
#private;
|
|
187
|
+
readonly resolvedConfig: ResolvedConfig;
|
|
188
|
+
constructor(resolvedConfig: ResolvedConfig);
|
|
189
|
+
isTestFile(filePath: string): boolean;
|
|
190
|
+
selectFiles(): Promise<Array<string>>;
|
|
176
191
|
}
|
|
177
192
|
|
|
178
193
|
declare class TSTyche {
|
|
179
194
|
#private;
|
|
180
195
|
readonly resolvedConfig: ResolvedConfig;
|
|
181
|
-
static readonly version = "
|
|
196
|
+
static readonly version = "2.0.0-beta.0";
|
|
182
197
|
constructor(resolvedConfig: ResolvedConfig, storeService: StoreService);
|
|
183
198
|
run(testFiles: Array<string | URL>): Promise<void>;
|
|
199
|
+
watch(testFiles: Array<string>, selectService: SelectService): Promise<void>;
|
|
184
200
|
}
|
|
185
201
|
|
|
186
202
|
declare class Cli {
|
|
@@ -252,6 +268,10 @@ declare class CollectService {
|
|
|
252
268
|
|
|
253
269
|
declare class Environment {
|
|
254
270
|
#private;
|
|
271
|
+
/**
|
|
272
|
+
* Is `true` if the process is running in a continuous integration environment.
|
|
273
|
+
*/
|
|
274
|
+
static get isCi(): boolean;
|
|
255
275
|
/**
|
|
256
276
|
* Specifies whether color should be disabled in the output.
|
|
257
277
|
*/
|
|
@@ -371,12 +391,18 @@ declare class ResultManager {
|
|
|
371
391
|
handleEvent([eventName, payload]: Event): void;
|
|
372
392
|
}
|
|
373
393
|
|
|
374
|
-
type Event = ["
|
|
394
|
+
type Event = ["config:error", {
|
|
395
|
+
diagnostics: Array<Diagnostic>;
|
|
396
|
+
}] | ["deprecation:info", {
|
|
397
|
+
diagnostics: Array<Diagnostic>;
|
|
398
|
+
}] | ["input:info", {
|
|
399
|
+
key: string;
|
|
400
|
+
}] | ["select:error", {
|
|
401
|
+
diagnostics: Array<Diagnostic>;
|
|
402
|
+
}] | ["run:start", {
|
|
375
403
|
result: Result;
|
|
376
|
-
}] | ["end", {
|
|
404
|
+
}] | ["run:end", {
|
|
377
405
|
result: Result;
|
|
378
|
-
}] | ["config:error", {
|
|
379
|
-
diagnostics: Array<Diagnostic>;
|
|
380
406
|
}] | ["store:info", {
|
|
381
407
|
compilerVersion: string;
|
|
382
408
|
installationPath: string;
|
|
@@ -461,22 +487,28 @@ declare abstract class RelationMatcherBase {
|
|
|
461
487
|
typeChecker: TypeChecker;
|
|
462
488
|
abstract relation: Relation;
|
|
463
489
|
abstract relationExplanationText: string;
|
|
490
|
+
relationExplanationVerb: string;
|
|
464
491
|
constructor(typeChecker: TypeChecker);
|
|
465
492
|
protected explain(sourceType: ts.Type, targetType: ts.Type, isNot: boolean): Array<Diagnostic>;
|
|
466
493
|
match(sourceType: ts.Type, targetType: ts.Type, isNot: boolean): MatchResult;
|
|
467
494
|
}
|
|
468
495
|
|
|
469
|
-
declare class
|
|
496
|
+
declare class ToBe extends RelationMatcherBase {
|
|
470
497
|
relation: Relation;
|
|
471
498
|
relationExplanationText: string;
|
|
472
|
-
match(sourceType: ts.Type, targetType: ts.Type, isNot: boolean): MatchResult;
|
|
473
499
|
}
|
|
474
500
|
|
|
475
|
-
declare class
|
|
501
|
+
declare class ToBeAssignableTo extends RelationMatcherBase {
|
|
476
502
|
relation: Relation;
|
|
477
503
|
relationExplanationText: string;
|
|
478
504
|
}
|
|
479
505
|
|
|
506
|
+
declare class ToBeAssignableWith extends RelationMatcherBase {
|
|
507
|
+
relation: Relation;
|
|
508
|
+
relationExplanationText: string;
|
|
509
|
+
match(sourceType: ts.Type, targetType: ts.Type, isNot: boolean): MatchResult;
|
|
510
|
+
}
|
|
511
|
+
|
|
480
512
|
declare class ToHaveProperty {
|
|
481
513
|
#private;
|
|
482
514
|
compiler: typeof ts;
|
|
@@ -488,6 +520,7 @@ declare class ToHaveProperty {
|
|
|
488
520
|
declare class ToMatch extends RelationMatcherBase {
|
|
489
521
|
relation: Relation;
|
|
490
522
|
relationExplanationText: string;
|
|
523
|
+
relationExplanationVerb: string;
|
|
491
524
|
}
|
|
492
525
|
|
|
493
526
|
declare class ToRaiseError {
|
|
@@ -505,8 +538,11 @@ declare class Expect {
|
|
|
505
538
|
#private;
|
|
506
539
|
compiler: typeof ts;
|
|
507
540
|
typeChecker: TypeChecker;
|
|
541
|
+
toBe: ToBe;
|
|
508
542
|
toBeAny: PrimitiveTypeMatcher;
|
|
509
|
-
toBeAssignable:
|
|
543
|
+
toBeAssignable: ToBeAssignableWith;
|
|
544
|
+
toBeAssignableTo: ToBeAssignableTo;
|
|
545
|
+
toBeAssignableWith: ToBeAssignableWith;
|
|
510
546
|
toBeBigInt: PrimitiveTypeMatcher;
|
|
511
547
|
toBeBoolean: PrimitiveTypeMatcher;
|
|
512
548
|
toBeNever: PrimitiveTypeMatcher;
|
|
@@ -518,7 +554,7 @@ declare class Expect {
|
|
|
518
554
|
toBeUniqueSymbol: PrimitiveTypeMatcher;
|
|
519
555
|
toBeUnknown: PrimitiveTypeMatcher;
|
|
520
556
|
toBeVoid: PrimitiveTypeMatcher;
|
|
521
|
-
toEqual:
|
|
557
|
+
toEqual: ToBe;
|
|
522
558
|
toHaveProperty: ToHaveProperty;
|
|
523
559
|
toMatch: ToMatch;
|
|
524
560
|
toRaiseError: ToRaiseError;
|
|
@@ -527,48 +563,19 @@ declare class Expect {
|
|
|
527
563
|
match(assertion: Assertion, expectResult: ExpectResult): MatchResult | undefined;
|
|
528
564
|
}
|
|
529
565
|
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
* @param log - Message to write to the stream.
|
|
536
|
-
*/
|
|
537
|
-
write: (log: string) => void;
|
|
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;
|
|
538
571
|
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
*/
|
|
542
|
-
interface LoggerOptions {
|
|
543
|
-
/**
|
|
544
|
-
* Specifies whether color should be disabled in the output. Default: `Environment.noColor`.
|
|
545
|
-
*/
|
|
546
|
-
noColor?: boolean;
|
|
547
|
-
/**
|
|
548
|
-
* A stream to write warnings and errors. Default: `process.stderr`.
|
|
549
|
-
*/
|
|
550
|
-
stderr?: WriteStream;
|
|
551
|
-
/**
|
|
552
|
-
* A stream to write informational messages. Default: `process.stdout`.
|
|
553
|
-
*/
|
|
554
|
-
stdout?: WriteStream;
|
|
572
|
+
interface InputServiceOptions {
|
|
573
|
+
stdin?: ReadStream;
|
|
555
574
|
}
|
|
556
|
-
|
|
557
|
-
* Wraps the provided streams with a set of convenience methods.
|
|
558
|
-
*/
|
|
559
|
-
declare class Logger {
|
|
575
|
+
declare class InputService {
|
|
560
576
|
#private;
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
*/
|
|
564
|
-
constructor(options?: LoggerOptions);
|
|
565
|
-
/**
|
|
566
|
-
* Moves the cursor one line up in the `stdout` stream and erases that line.
|
|
567
|
-
*/
|
|
568
|
-
eraseLastLine(): void;
|
|
569
|
-
writeError(body: JSX.Element | Array<JSX.Element>): void;
|
|
570
|
-
writeMessage(body: JSX.Element | Array<JSX.Element>): void;
|
|
571
|
-
writeWarning(body: JSX.Element | Array<JSX.Element>): void;
|
|
577
|
+
constructor(options?: InputServiceOptions);
|
|
578
|
+
dispose(): void;
|
|
572
579
|
}
|
|
573
580
|
|
|
574
581
|
declare function addsPackageStepText(compilerVersion: string, installationPath: string): JSX.Element;
|
|
@@ -585,6 +592,24 @@ declare function formattedText(input: string | Array<string> | Record<string, un
|
|
|
585
592
|
|
|
586
593
|
declare function helpText(optionDefinitions: Map<string, OptionDefinition>, tstycheVersion: string): JSX.Element;
|
|
587
594
|
|
|
595
|
+
interface WriteStream {
|
|
596
|
+
write: (log: string) => void;
|
|
597
|
+
}
|
|
598
|
+
interface OutputServiceOptions {
|
|
599
|
+
noColor?: boolean;
|
|
600
|
+
stderr?: WriteStream;
|
|
601
|
+
stdout?: WriteStream;
|
|
602
|
+
}
|
|
603
|
+
declare class OutputService {
|
|
604
|
+
#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;
|
|
611
|
+
}
|
|
612
|
+
|
|
588
613
|
declare function summaryText({ duration, expectCount, fileCount, onlyMatch, pathMatch, skipMatch, targetCount, testCount, }: {
|
|
589
614
|
duration: number;
|
|
590
615
|
expectCount: ResultCount;
|
|
@@ -602,6 +627,8 @@ declare function usesCompilerStepText(compilerVersion: string, tsconfigFilePath:
|
|
|
602
627
|
prependEmptyLine: boolean;
|
|
603
628
|
}): JSX.Element;
|
|
604
629
|
|
|
630
|
+
declare function watchModeUsageText(): JSX.Element;
|
|
631
|
+
|
|
605
632
|
declare class Path {
|
|
606
633
|
static dirname(filePath: string): string;
|
|
607
634
|
static join(...filePaths: Array<string>): string;
|
|
@@ -622,7 +649,7 @@ declare class ProjectService {
|
|
|
622
649
|
|
|
623
650
|
declare abstract class Reporter {
|
|
624
651
|
readonly resolvedConfig: ResolvedConfig;
|
|
625
|
-
protected
|
|
652
|
+
protected outputService: OutputService;
|
|
626
653
|
constructor(resolvedConfig: ResolvedConfig);
|
|
627
654
|
abstract handleEvent([eventName, payload]: Event): void;
|
|
628
655
|
}
|
|
@@ -636,11 +663,15 @@ declare class ThoroughReporter extends Reporter {
|
|
|
636
663
|
handleEvent([eventName, payload]: Event): void;
|
|
637
664
|
}
|
|
638
665
|
|
|
666
|
+
declare class WatchModeReporter extends Reporter {
|
|
667
|
+
handleEvent([eventName]: Event): void;
|
|
668
|
+
}
|
|
669
|
+
|
|
639
670
|
declare class TaskRunner {
|
|
640
671
|
#private;
|
|
641
672
|
readonly resolvedConfig: ResolvedConfig;
|
|
642
673
|
constructor(resolvedConfig: ResolvedConfig, storeService: StoreService);
|
|
643
|
-
run(testFiles: Array<URL>, target: Array<string>,
|
|
674
|
+
run(testFiles: Array<URL>, target: Array<string>, cancellationToken?: CancellationToken): Promise<Result>;
|
|
644
675
|
}
|
|
645
676
|
|
|
646
677
|
declare enum Color {
|
|
@@ -699,35 +730,14 @@ declare global {
|
|
|
699
730
|
}
|
|
700
731
|
}
|
|
701
732
|
}
|
|
702
|
-
/**
|
|
703
|
-
* Options to configure an instance of the {@link Scribbler}.
|
|
704
|
-
*/
|
|
705
733
|
interface ScribblerOptions {
|
|
706
|
-
/**
|
|
707
|
-
* The end of line sequence to be used in the output. Default: `"\n"`.
|
|
708
|
-
*/
|
|
709
734
|
newLine?: string;
|
|
710
|
-
/**
|
|
711
|
-
* Do not include ANSI color escape codes in the output. Default: `false`.
|
|
712
|
-
*/
|
|
713
735
|
noColor?: boolean;
|
|
714
736
|
}
|
|
715
|
-
/**
|
|
716
|
-
* Provides the JSX factory function and renderer.
|
|
717
|
-
*/
|
|
718
737
|
declare class Scribbler {
|
|
719
738
|
#private;
|
|
720
|
-
/**
|
|
721
|
-
* @param options - {@link ScribblerOptions | Options} to configure an instance of the Scribbler.
|
|
722
|
-
*/
|
|
723
739
|
constructor(options?: ScribblerOptions);
|
|
724
|
-
/**
|
|
725
|
-
* Creates a new text element of the given `type`.
|
|
726
|
-
*/
|
|
727
740
|
static createElement(type: ComponentConstructor | string, props: Record<string, unknown> | null, ...children: Array<ElementChildren>): JSX.Element;
|
|
728
|
-
/**
|
|
729
|
-
* Renders the provided JSX `element` and returns the resulting string.
|
|
730
|
-
*/
|
|
731
741
|
render(element: JSX.Element | null): string;
|
|
732
742
|
}
|
|
733
743
|
|
|
@@ -749,4 +759,12 @@ declare class Version {
|
|
|
749
759
|
static isVersionTag(target: string): boolean;
|
|
750
760
|
}
|
|
751
761
|
|
|
752
|
-
|
|
762
|
+
type RunCallback = (testFiles: Array<string>) => Promise<void>;
|
|
763
|
+
declare class Watcher {
|
|
764
|
+
#private;
|
|
765
|
+
readonly resolvedConfig: ResolvedConfig;
|
|
766
|
+
constructor(resolvedConfig: ResolvedConfig, runCallback: RunCallback, selectService: SelectService, testFiles: Array<string>);
|
|
767
|
+
watch(): Promise<void>;
|
|
768
|
+
}
|
|
769
|
+
|
|
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 };
|