tstyche 3.0.0-beta.1 → 3.0.0-beta.2

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
@@ -39,8 +39,8 @@ To organize, debug and plan tests TSTyche has:
39
39
  The assertions can be used to write type tests (like in the above example) or mixed in your functional tests:
40
40
 
41
41
  ```ts
42
- import assert from "node:assert/strict";
43
- import { test } from "node:test";
42
+ import assert from "node:assert";
43
+ import test from "node:test";
44
44
  import * as tstyche from "tstyche";
45
45
 
46
46
  function secondItem<T>(target: Array<T>): T | undefined {
@@ -1,11 +1,47 @@
1
1
  import type ts from 'typescript';
2
2
 
3
- declare class TestTree {
4
- diagnostics: Set<ts.Diagnostic>;
5
- members: Array<TestMember | Assertion>;
6
- sourceFile: ts.SourceFile;
7
- constructor(diagnostics: Set<ts.Diagnostic>, sourceFile: ts.SourceFile);
8
- get hasOnly(): boolean;
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
14
+ }
15
+
16
+ declare class ConfigDiagnosticText {
17
+ #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;
28
+ }
29
+
30
+ declare class StoreService {
31
+ #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>;
40
+ }
41
+
42
+ declare enum DiagnosticCategory {
43
+ Error = "error",
44
+ Warning = "warning"
9
45
  }
10
46
 
11
47
  declare enum TestMemberBrand {
@@ -13,6 +49,7 @@ declare enum TestMemberBrand {
13
49
  Test = "test",
14
50
  Expect = "expect"
15
51
  }
52
+
16
53
  declare enum TestMemberFlags {
17
54
  None = 0,
18
55
  Fail = 1,
@@ -21,6 +58,14 @@ declare enum TestMemberFlags {
21
58
  Todo = 8
22
59
  }
23
60
 
61
+ declare class TestTree {
62
+ diagnostics: Set<ts.Diagnostic>;
63
+ members: Array<TestMember | Assertion>;
64
+ sourceFile: ts.SourceFile;
65
+ constructor(diagnostics: Set<ts.Diagnostic>, sourceFile: ts.SourceFile);
66
+ get hasOnly(): boolean;
67
+ }
68
+
24
69
  declare class TestMember {
25
70
  #private;
26
71
  brand: TestMemberBrand;
@@ -54,22 +99,28 @@ declare class CollectService {
54
99
  createTestTree(sourceFile: ts.SourceFile, semanticDiagnostics?: Array<ts.Diagnostic>): TestTree;
55
100
  }
56
101
 
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
+ };
112
+ }
113
+
57
114
  declare class DiagnosticOrigin {
58
115
  assertion: Assertion | undefined;
59
116
  end: number;
60
- sourceFile: ts.SourceFile;
117
+ sourceFile: SourceFile | ts.SourceFile;
61
118
  start: number;
62
- constructor(start: number, end: number, sourceFile: ts.SourceFile, assertion?: Assertion);
119
+ constructor(start: number, end: number, sourceFile: SourceFile | ts.SourceFile, assertion?: Assertion);
63
120
  static fromAssertion(assertion: Assertion): DiagnosticOrigin;
64
- static fromJsonNode(node: ts.Node, sourceFile: ts.SourceFile, skipTrivia: (position: number, sourceFile: ts.SourceFile) => number): DiagnosticOrigin;
65
121
  static fromNode(node: ts.Node, assertion?: Assertion): DiagnosticOrigin;
66
122
  }
67
123
 
68
- declare enum DiagnosticCategory {
69
- Error = "error",
70
- Warning = "warning"
71
- }
72
-
73
124
  declare class Diagnostic {
74
125
  #private;
75
126
  category: DiagnosticCategory;
@@ -199,43 +250,6 @@ interface EnvironmentOptions {
199
250
  typescriptPath: string | undefined;
200
251
  }
201
252
 
202
- declare enum OptionBrand {
203
- String = "string",
204
- Number = "number",
205
- Boolean = "boolean",
206
- BareTrue = "bareTrue",// a boolean option that does not take a value and when specified is interpreted as 'true'
207
- List = "list"
208
- }
209
- declare enum OptionGroup {
210
- CommandLine = 2,
211
- ConfigFile = 4
212
- }
213
-
214
- declare class ConfigDiagnosticText {
215
- #private;
216
- static doubleQuotesExpected(): string;
217
- static expectsListItemType(optionName: string, optionBrand: OptionBrand): string;
218
- static expectsValue(optionName: string, optionGroup: OptionGroup): string;
219
- static fileDoesNotExist(filePath: string): string;
220
- static testFileMatchCannotStartWith(segment: string): Array<string>;
221
- static requiresValueType(optionName: string, optionBrand: OptionBrand, optionGroup: OptionGroup): string;
222
- static unknownOption(optionName: string): string;
223
- static versionIsNotSupported(value: string): string;
224
- static watchCannotBeEnabled(): string;
225
- }
226
-
227
- declare class StoreService {
228
- #private;
229
- constructor();
230
- getSupportedTags(): Promise<Array<string> | undefined>;
231
- install(tag: string): Promise<void>;
232
- load(tag: string): Promise<typeof ts | undefined>;
233
- open(): Promise<void>;
234
- prune(): Promise<void>;
235
- update(): Promise<void>;
236
- validateTag(tag: string): Promise<boolean | undefined>;
237
- }
238
-
239
253
  interface ResolvedConfig extends EnvironmentOptions, Omit<CommandLineOptions, keyof ConfigFileOptions | "config">, Required<ConfigFileOptions> {
240
254
  /**
241
255
  * The path to a TSTyche configuration file.
@@ -844,4 +858,4 @@ declare class WatchService {
844
858
  watch(cancellationToken: CancellationToken): AsyncIterable<Array<Task>>;
845
859
  }
846
860
 
847
- 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, 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 };
861
+ 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 };