tstyche 1.0.0-beta.7 → 1.0.0-beta.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.0.0-beta.8] - 2024-01-05
4
+
5
+ ### Changed
6
+
7
+ - **Breaking!** Make `"target": ["current"]` the default instead of `"target": ["latest"]` ([#81](https://github.com/tstyche/tstyche/pull/81), [#80](https://github.com/tstyche/tstyche/pull/80), [#66](https://github.com/tstyche/tstyche/pull/66))
8
+ - **New!** Load the installed TypeScript package for type testing instead of installing another copy to the store ([#71](https://github.com/tstyche/tstyche/pull/71), [#64](https://github.com/tstyche/tstyche/pull/64))
9
+
10
+ ### Added
11
+
12
+ - Add the `Path` class ([#59](https://github.com/tstyche/tstyche/pull/59))
13
+
14
+ ### Fixed
15
+
16
+ - Correctly handle command line options that do not take a value ([#58](https://github.com/tstyche/tstyche/pull/58))
17
+
3
18
  ## [1.0.0-beta.7] - 2023-12-29
4
19
 
5
20
  ### Changed
@@ -79,6 +94,7 @@
79
94
 
80
95
  _First pre-release._
81
96
 
97
+ [1.0.0-beta.8]: https://github.com/tstyche/tstyche/releases/tag/v1.0.0-beta.8
82
98
  [1.0.0-beta.7]: https://github.com/tstyche/tstyche/releases/tag/v1.0.0-beta.7
83
99
  [1.0.0-beta.6]: https://github.com/tstyche/tstyche/releases/tag/v1.0.0-beta.6
84
100
  [1.0.0-beta.5]: https://github.com/tstyche/tstyche/releases/tag/v1.0.0-beta.5
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" resolution-mode="require"/>
2
2
 
3
- import type ts from 'typescript/lib/tsserverlibrary.js';
3
+ import type ts from 'typescript';
4
4
 
5
5
  declare enum DiagnosticCategory {
6
6
  Error = "error",
@@ -36,20 +36,21 @@ declare class Diagnostic {
36
36
  declare class StoreService {
37
37
  #private;
38
38
  constructor();
39
- get supportedTags(): Array<string>;
39
+ getSupportedTags(signal?: AbortSignal): Promise<Array<string>>;
40
40
  install(tag: string, signal?: AbortSignal): Promise<string | undefined>;
41
41
  load(tag: string, signal?: AbortSignal): Promise<typeof ts | undefined>;
42
42
  open(signal?: AbortSignal): Promise<void>;
43
43
  prune: () => Promise<void>;
44
- resolveTag(tag: string): string | undefined;
44
+ resolveTag(tag: string, signal?: AbortSignal): Promise<string | undefined>;
45
45
  update(signal?: AbortSignal): Promise<void>;
46
- validateTag(tag: string): boolean;
46
+ validateTag(tag: string, signal?: AbortSignal): Promise<boolean>;
47
47
  }
48
48
 
49
49
  declare enum OptionBrand {
50
50
  String = "string",
51
51
  Number = "number",
52
52
  Boolean = "boolean",
53
+ True = "true",// an option which does not take a value
53
54
  List = "list",
54
55
  Object = "object"
55
56
  }
@@ -77,7 +78,7 @@ interface BaseOptionDefinition {
77
78
  required?: boolean;
78
79
  }
79
80
  interface PrimitiveTypeOptionDefinition extends BaseOptionDefinition {
80
- brand: OptionBrand.String | OptionBrand.Number | OptionBrand.Boolean;
81
+ brand: OptionBrand.String | OptionBrand.Number | OptionBrand.Boolean | OptionBrand.True;
81
82
  }
82
83
  interface ListTypeOptionDefinition extends BaseOptionDefinition {
83
84
  brand: OptionBrand.List;
@@ -110,7 +111,7 @@ interface CommandLineOptions {
110
111
  */
111
112
  failFast?: boolean;
112
113
  /**
113
- * Print the list of CLI options with brief descriptions and exit.
114
+ * Print the list of command line options with brief descriptions and exit.
114
115
  */
115
116
  help?: boolean;
116
117
  /**
@@ -190,7 +191,7 @@ declare class ConfigService {
190
191
  get commandLineOptions(): CommandLineOptions;
191
192
  get configFileOptions(): ConfigFileOptions;
192
193
  static get defaultOptions(): Required<ConfigFileOptions>;
193
- parseCommandLine(commandLineArgs: Array<string>): void;
194
+ parseCommandLine(commandLineArgs: Array<string>): Promise<void>;
194
195
  readConfigFile(filePath?: string, // TODO take URL as well
195
196
  sourceText?: string): Promise<void>;
196
197
  resolveConfig(): ResolvedConfig;
@@ -200,15 +201,15 @@ declare class ConfigService {
200
201
  declare class TSTyche {
201
202
  #private;
202
203
  readonly resolvedConfig: ResolvedConfig;
204
+ static readonly version = "__version__";
203
205
  constructor(resolvedConfig: ResolvedConfig, storeService: StoreService);
204
- static get version(): string;
205
206
  run(testFiles: Array<string | URL>): Promise<void>;
206
207
  }
207
208
 
208
209
  declare class Cli {
209
210
  #private;
210
211
  constructor(process: NodeJS.Process);
211
- run(commandLineArgs: Array<string>): Promise<void>;
212
+ run(commandLineArguments: Array<string>): Promise<void>;
212
213
  }
213
214
 
214
215
  declare enum TestMemberBrand {
@@ -227,21 +228,20 @@ declare enum TestMemberFlags {
227
228
 
228
229
  declare class TestTree {
229
230
  compiler: typeof ts;
230
- diagnostics: Array<ts.Diagnostic>;
231
+ diagnostics: Set<ts.Diagnostic>;
231
232
  sourceFile: ts.SourceFile;
232
233
  members: Array<TestMember | Assertion>;
233
- constructor(compiler: typeof ts, diagnostics: Array<ts.Diagnostic>, sourceFile: ts.SourceFile);
234
+ constructor(compiler: typeof ts, diagnostics: Set<ts.Diagnostic>, sourceFile: ts.SourceFile);
234
235
  get hasOnly(): boolean;
235
236
  }
236
237
 
237
238
  declare class TestMember {
238
- #private;
239
239
  brand: TestMemberBrand;
240
240
  node: ts.CallExpression;
241
241
  parent: TestTree | TestMember;
242
242
  flags: TestMemberFlags;
243
243
  compiler: typeof ts;
244
- diagnostics: Array<ts.Diagnostic>;
244
+ diagnostics: Set<ts.Diagnostic>;
245
245
  members: Array<TestMember | Assertion>;
246
246
  name: string;
247
247
  constructor(brand: TestMemberBrand, node: ts.CallExpression, parent: TestTree | TestMember, flags: TestMemberFlags);
@@ -253,12 +253,10 @@ interface MatcherNode extends ts.CallExpression {
253
253
  expression: ts.PropertyAccessExpression;
254
254
  }
255
255
  declare class Assertion extends TestMember {
256
- #private;
257
256
  matcherNode: MatcherNode;
258
257
  modifierNode: ts.PropertyAccessExpression;
259
258
  notNode: ts.PropertyAccessExpression | undefined;
260
259
  isNot: boolean;
261
- name: string;
262
260
  constructor(brand: TestMemberBrand, node: ts.CallExpression, parent: TestTree | TestMember, flags: TestMemberFlags, matcherNode: MatcherNode, modifierNode: ts.PropertyAccessExpression, notNode: ts.PropertyAccessExpression | undefined);
263
261
  get ancestorNames(): Array<string>;
264
262
  get matcherName(): ts.MemberName;
@@ -278,6 +276,10 @@ declare class CollectService {
278
276
 
279
277
  declare class Environment {
280
278
  #private;
279
+ /**
280
+ * Is `true` if the TypeScript package is installed.
281
+ */
282
+ static get isTypeScriptInstalled(): boolean;
281
283
  /**
282
284
  * Specifies whether color should be disabled in the output.
283
285
  */
@@ -576,6 +578,46 @@ declare class Logger {
576
578
  writeWarning(body: JSX.Element | Array<JSX.Element>): void;
577
579
  }
578
580
 
581
+ declare function addsPackageStepText(compilerVersion: string, installationPath: string): JSX.Element;
582
+
583
+ declare function describeNameText(name: string, indent?: number): JSX.Element;
584
+
585
+ declare function diagnosticText(diagnostic: Diagnostic): JSX.Element;
586
+
587
+ declare function fileStatusText(status: FileResultStatus, testFile: URL): JSX.Element;
588
+
589
+ declare function fileViewText(lines: Array<JSX.Element>, addEmptyFinalLine: boolean): JSX.Element;
590
+
591
+ declare function formattedText(input: string | Array<string> | Record<string, unknown>): JSX.Element;
592
+
593
+ declare function helpText(optionDefinitions: Map<string, OptionDefinition>, tstycheVersion: string): JSX.Element;
594
+
595
+ declare function summaryText({ duration, expectCount, fileCount, onlyMatch, pathMatch, skipMatch, targetCount, testCount, }: {
596
+ duration: number;
597
+ expectCount: ResultCount;
598
+ fileCount: ResultCount;
599
+ onlyMatch: string | undefined;
600
+ pathMatch: Array<string>;
601
+ skipMatch: string | undefined;
602
+ targetCount: ResultCount;
603
+ testCount: ResultCount;
604
+ }): JSX.Element;
605
+
606
+ declare function testNameText(status: "fail" | "pass" | "skip" | "todo", name: string, indent?: number): JSX.Element;
607
+
608
+ declare function usesCompilerStepText(compilerVersion: string, tsconfigFilePath: string | undefined, options?: {
609
+ prependEmptyLine: boolean;
610
+ }): JSX.Element;
611
+
612
+ declare class Path {
613
+ static basename(filePath: string): string;
614
+ static dirname(filePath: string): string;
615
+ static join(...filePaths: Array<string>): string;
616
+ static normalizeSlashes(filePath: string): string;
617
+ static relative(from: string, to: string): string;
618
+ static resolve(...filePaths: Array<string>): string;
619
+ }
620
+
579
621
  declare class ProjectService {
580
622
  #private;
581
623
  compiler: typeof ts;
@@ -609,37 +651,6 @@ declare class TaskRunner {
609
651
  run(testFiles: Array<URL>, target: Array<string>, signal?: AbortSignal): Promise<Result>;
610
652
  }
611
653
 
612
- declare function addsPackageStepText(compilerVersion: string, installationPath: string): JSX.Element;
613
-
614
- declare function describeNameText(name: string, indent?: number): JSX.Element;
615
-
616
- declare function diagnosticText(diagnostic: Diagnostic): JSX.Element;
617
-
618
- declare function fileStatusText(status: FileResultStatus, testFile: URL): JSX.Element;
619
-
620
- declare function fileViewText(lines: Array<JSX.Element>, addEmptyFinalLine: boolean): JSX.Element;
621
-
622
- declare function formattedText(input: string | Array<string> | Record<string, unknown>): JSX.Element;
623
-
624
- declare function helpText(optionDefinitions: Map<string, OptionDefinition>, tstycheVersion: string): JSX.Element;
625
-
626
- declare function summaryText({ duration, expectCount, fileCount, onlyMatch, pathMatch, skipMatch, targetCount, testCount, }: {
627
- duration: number;
628
- expectCount: ResultCount;
629
- fileCount: ResultCount;
630
- onlyMatch: string | undefined;
631
- pathMatch: Array<string>;
632
- skipMatch: string | undefined;
633
- targetCount: ResultCount;
634
- testCount: ResultCount;
635
- }): JSX.Element;
636
-
637
- declare function testNameText(status: "fail" | "pass" | "skip" | "todo", name: string, indent?: number): JSX.Element;
638
-
639
- declare function usesCompilerStepText(compilerVersion: string, tsconfigFilePath: string | undefined, options?: {
640
- prependEmptyLine: boolean;
641
- }): JSX.Element;
642
-
643
654
  declare enum Color {
644
655
  Reset = "0",
645
656
  Red = "31",
@@ -651,6 +662,17 @@ declare enum Color {
651
662
  Gray = "90"
652
663
  }
653
664
 
665
+ interface LineProps {
666
+ children?: JSX.ElementChildrenAttribute["children"];
667
+ color?: Color;
668
+ indent?: number;
669
+ }
670
+ declare class Line implements JSX.ElementClass {
671
+ readonly props: LineProps;
672
+ constructor(props: LineProps);
673
+ render(): JSX.Element;
674
+ }
675
+
654
676
  type ElementChildren = Array<ElementChildren> | JSX.Element | string | undefined;
655
677
  type ComponentConstructor = new (props: Record<string, unknown>) => JSX.ElementClass;
656
678
  declare global {
@@ -713,4 +735,15 @@ declare class Scribbler {
713
735
  render(element: JSX.Element | null): string;
714
736
  }
715
737
 
716
- export { Assertion, Cli, CollectService, type CommandLineOptions, type ConfigFileOptions, ConfigService, DescribeResult, Diagnostic, DiagnosticCategory, type DiagnosticOrigin, Environment, type Event, EventEmitter, type EventHandler, Expect, ExpectResult, FileResult, type FileResultStatus, type ItemDefinition, Logger, type LoggerOptions, type MatchResult, OptionBrand, type OptionDefinition, OptionDefinitionsMap, OptionGroup, ProjectResult, ProjectService, Reporter, type ResolvedConfig, Result, ResultCount, ResultManager, ResultStatus, ResultTiming, Scribbler, type ScribblerOptions, StoreService, SummaryReporter, TSTyche, TargetResult, TaskRunner, TestMember, TestMemberBrand, TestMemberFlags, TestResult, TestTree, ThoroughReporter, type TypeChecker, addsPackageStepText, describeNameText, diagnosticText, fileStatusText, fileViewText, formattedText, helpText, summaryText, testNameText, usesCompilerStepText };
738
+ interface TextProps {
739
+ children?: JSX.ElementChildrenAttribute["children"];
740
+ color?: Color | undefined;
741
+ indent?: number | undefined;
742
+ }
743
+ declare class Text implements JSX.ElementClass {
744
+ readonly props: TextProps;
745
+ constructor(props: TextProps);
746
+ render(): JSX.Element;
747
+ }
748
+
749
+ export { Assertion, Cli, CollectService, Color, type CommandLineOptions, type ConfigFileOptions, ConfigService, DescribeResult, Diagnostic, DiagnosticCategory, type DiagnosticOrigin, Environment, type Event, EventEmitter, type EventHandler, Expect, ExpectResult, FileResult, type FileResultStatus, type ItemDefinition, Line, Logger, type LoggerOptions, type MatchResult, OptionBrand, type OptionDefinition, OptionDefinitionsMap, OptionGroup, Path, ProjectResult, ProjectService, Reporter, type ResolvedConfig, Result, ResultCount, ResultManager, ResultStatus, ResultTiming, Scribbler, type ScribblerOptions, StoreService, SummaryReporter, TSTyche, TargetResult, TaskRunner, TestMember, TestMemberBrand, TestMemberFlags, TestResult, TestTree, Text, ThoroughReporter, type TypeChecker, addsPackageStepText, describeNameText, diagnosticText, fileStatusText, fileViewText, formattedText, helpText, summaryText, testNameText, usesCompilerStepText };