tstyche 4.0.0-beta.8 → 4.0.0-rc.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
@@ -77,7 +77,7 @@ This simple! (And it has watch mode too.)
77
77
 
78
78
  ## Documentation
79
79
 
80
- Visit [https://tstyche.org](https://tstyche.org) to view the full documentation.
80
+ Visit [tstyche.org](https://tstyche.org) to view the full documentation.
81
81
 
82
82
  ## Feedback
83
83
 
package/build/index.d.cts CHANGED
@@ -85,15 +85,15 @@ interface Matchers {
85
85
  (target: unknown): void;
86
86
  };
87
87
  /**
88
- * Checks if the source type is identical to the target type.
88
+ * Checks if the source type is the same as the target type.
89
89
  */
90
90
  toBe: {
91
91
  /**
92
- * Checks if the source type is identical to the target type.
92
+ * Checks if the source type is the same as the target type.
93
93
  */
94
94
  <Target>(): void;
95
95
  /**
96
- * Checks if the source type is identical to type of the target expression.
96
+ * Checks if the source type is the same as type of the target expression.
97
97
  */
98
98
  (target: unknown): void;
99
99
  };
package/build/index.d.ts CHANGED
@@ -85,15 +85,15 @@ interface Matchers {
85
85
  (target: unknown): void;
86
86
  };
87
87
  /**
88
- * Checks if the source type is identical to the target type.
88
+ * Checks if the source type is the same as the target type.
89
89
  */
90
90
  toBe: {
91
91
  /**
92
- * Checks if the source type is identical to the target type.
92
+ * Checks if the source type is the same as the target type.
93
93
  */
94
94
  <Target>(): void;
95
95
  /**
96
- * Checks if the source type is identical to type of the target expression.
96
+ * Checks if the source type is the same as type of the target expression.
97
97
  */
98
98
  (target: unknown): void;
99
99
  };
@@ -3,7 +3,6 @@ import type ts from 'typescript';
3
3
  declare enum CancellationReason {
4
4
  ConfigChange = "configChange",
5
5
  ConfigError = "configError",
6
- CollectError = "collectError",
7
6
  FailFast = "failFast",
8
7
  WatchClose = "watchClose"
9
8
  }
@@ -21,58 +20,6 @@ declare class Cli {
21
20
  run(commandLine: Array<string>, cancellationToken?: CancellationToken): Promise<void>;
22
21
  }
23
22
 
24
- declare enum DiagnosticCategory {
25
- Error = "error",
26
- Warning = "warning"
27
- }
28
-
29
- declare class SourceFile {
30
- #private;
31
- fileName: string;
32
- text: string;
33
- constructor(fileName: string, text: string);
34
- getLineStarts(): Array<number>;
35
- getLineAndCharacterOfPosition(position: number): {
36
- line: number;
37
- character: number;
38
- };
39
- }
40
-
41
- declare class DiagnosticOrigin {
42
- assertion: AssertionNode | undefined;
43
- end: number;
44
- sourceFile: SourceFile | ts.SourceFile;
45
- start: number;
46
- constructor(start: number, end: number, sourceFile: SourceFile | ts.SourceFile, assertion?: AssertionNode);
47
- static fromAssertion(assertion: AssertionNode): DiagnosticOrigin;
48
- static fromNode(node: ts.Node, assertion?: AssertionNode): DiagnosticOrigin;
49
- static fromNodes(nodes: ts.NodeArray<ts.Node>, assertion?: AssertionNode): DiagnosticOrigin;
50
- }
51
-
52
- declare class Diagnostic {
53
- category: DiagnosticCategory;
54
- code: string | undefined;
55
- origin: DiagnosticOrigin | undefined;
56
- related: Array<Diagnostic> | undefined;
57
- text: string | Array<string>;
58
- constructor(text: string | Array<string>, category: DiagnosticCategory, origin?: DiagnosticOrigin);
59
- add(options: {
60
- code?: string | undefined;
61
- related?: Array<Diagnostic> | undefined;
62
- }): this;
63
- static error(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
64
- extendWith(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
65
- static fromDiagnostics(diagnostics: Array<ts.Diagnostic>): Array<Diagnostic>;
66
- static warning(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
67
- }
68
-
69
- declare function diagnosticBelongsToNode(diagnostic: ts.Diagnostic, node: ts.NodeArray<ts.Node> | ts.Node): boolean;
70
- declare function getDiagnosticMessageText(diagnostic: ts.Diagnostic): string | Array<string>;
71
- declare function getTextSpanEnd(span: ts.TextSpan): number;
72
- declare function isDiagnosticWithLocation(diagnostic: ts.Diagnostic): diagnostic is ts.DiagnosticWithLocation;
73
-
74
- type DiagnosticsHandler<T extends Diagnostic | Array<Diagnostic> = Diagnostic> = (this: void, diagnostics: T) => void;
75
-
76
23
  declare enum TestTreeNodeBrand {
77
24
  Describe = "describe",
78
25
  Test = "test",
@@ -88,21 +35,27 @@ declare enum TestTreeNodeFlags {
88
35
  Todo = 8
89
36
  }
90
37
 
38
+ declare class WhenNode extends TestTreeNode {
39
+ actionNode: ts.CallExpression;
40
+ actionNameNode: ts.PropertyAccessExpression;
41
+ abilityDiagnostics: Set<ts.Diagnostic> | undefined;
42
+ target: ts.NodeArray<ts.Expression> | ts.NodeArray<ts.TypeNode>;
43
+ constructor(compiler: typeof ts, brand: TestTreeNodeBrand, node: ts.CallExpression, parent: TestTree | TestTreeNode, flags: TestTreeNodeFlags, actionNode: ts.CallExpression, actionNameNode: ts.PropertyAccessExpression);
44
+ }
45
+
91
46
  declare class TestTreeNode {
92
- #private;
93
47
  brand: TestTreeNodeBrand;
94
- children: Array<TestTreeNode | AssertionNode>;
48
+ children: Array<TestTreeNode | AssertionNode | WhenNode>;
95
49
  diagnostics: Set<ts.Diagnostic>;
96
50
  flags: TestTreeNodeFlags;
97
51
  name: string;
98
52
  node: ts.CallExpression;
99
53
  parent: TestTree | TestTreeNode;
100
54
  constructor(compiler: typeof ts, brand: TestTreeNodeBrand, node: ts.CallExpression, parent: TestTree | TestTreeNode, flags: TestTreeNodeFlags);
101
- validate(): Array<Diagnostic>;
102
55
  }
103
56
 
104
57
  declare class TestTree {
105
- children: Array<TestTreeNode | AssertionNode>;
58
+ children: Array<TestTreeNode | AssertionNode | WhenNode>;
106
59
  diagnostics: Set<ts.Diagnostic>;
107
60
  hasOnly: boolean;
108
61
  sourceFile: ts.SourceFile;
@@ -296,6 +249,58 @@ declare class Config {
296
249
  static resolveConfigFilePath(filePath?: string): string;
297
250
  }
298
251
 
252
+ declare enum DiagnosticCategory {
253
+ Error = "error",
254
+ Warning = "warning"
255
+ }
256
+
257
+ declare class SourceFile {
258
+ #private;
259
+ fileName: string;
260
+ text: string;
261
+ constructor(fileName: string, text: string);
262
+ getLineStarts(): Array<number>;
263
+ getLineAndCharacterOfPosition(position: number): {
264
+ line: number;
265
+ character: number;
266
+ };
267
+ }
268
+
269
+ declare class DiagnosticOrigin {
270
+ assertion: AssertionNode | undefined;
271
+ end: number;
272
+ sourceFile: SourceFile | ts.SourceFile;
273
+ start: number;
274
+ constructor(start: number, end: number, sourceFile: SourceFile | ts.SourceFile, assertion?: AssertionNode);
275
+ static fromAssertion(assertion: AssertionNode): DiagnosticOrigin;
276
+ static fromNode(node: ts.Node, assertion?: AssertionNode): DiagnosticOrigin;
277
+ static fromNodes(nodes: ts.NodeArray<ts.Node>, assertion?: AssertionNode): DiagnosticOrigin;
278
+ }
279
+
280
+ declare class Diagnostic {
281
+ category: DiagnosticCategory;
282
+ code: string | undefined;
283
+ origin: DiagnosticOrigin | undefined;
284
+ related: Array<Diagnostic> | undefined;
285
+ text: string | Array<string>;
286
+ constructor(text: string | Array<string>, category: DiagnosticCategory, origin?: DiagnosticOrigin);
287
+ add(options: {
288
+ code?: string | undefined;
289
+ related?: Array<Diagnostic> | undefined;
290
+ }): this;
291
+ static error(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
292
+ extendWith(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
293
+ static fromDiagnostics(diagnostics: Array<ts.Diagnostic>): Array<Diagnostic>;
294
+ static warning(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
295
+ }
296
+
297
+ declare function diagnosticBelongsToNode(diagnostic: ts.Diagnostic, node: ts.NodeArray<ts.Node> | ts.Node): boolean;
298
+ declare function getDiagnosticMessageText(diagnostic: ts.Diagnostic): string | Array<string>;
299
+ declare function getTextSpanEnd(span: ts.TextSpan): number;
300
+ declare function isDiagnosticWithLocation(diagnostic: ts.Diagnostic): diagnostic is ts.DiagnosticWithLocation;
301
+
302
+ type DiagnosticsHandler<T extends Diagnostic | Array<Diagnostic> = Diagnostic> = (this: void, diagnostics: T) => void;
303
+
299
304
  declare enum OptionGroup {
300
305
  CommandLine = 2,
301
306
  ConfigFile = 4,
@@ -346,13 +351,9 @@ declare class CollectService {
346
351
 
347
352
  declare function nodeBelongsToArgumentList(compiler: typeof ts, node: ts.Node): boolean;
348
353
 
349
- declare class WhenNode extends TestTreeNode {
350
- actionNode: ts.CallExpression;
351
- actionNameNode: ts.PropertyAccessExpression;
352
- abilityDiagnostics: Set<ts.Diagnostic> | undefined;
353
- target: ts.NodeArray<ts.Expression> | ts.NodeArray<ts.TypeNode>;
354
- constructor(compiler: typeof ts, brand: TestTreeNodeBrand, node: ts.CallExpression, parent: TestTree | TestTreeNode, flags: TestTreeNodeFlags, actionNode: ts.CallExpression, actionNameNode: ts.PropertyAccessExpression);
355
- }
354
+ declare function argumentIsProvided<T>(argumentNameText: string, node: T, enclosingNode: ts.Node, onDiagnostics: DiagnosticsHandler<Array<Diagnostic>>): node is NonNullable<T>;
355
+
356
+ declare function argumentOrTypeArgumentIsProvided<T>(argumentNameText: string, typeArgumentNameText: string, node: T, enclosingNode: ts.Node, onDiagnostics: DiagnosticsHandler<Array<Diagnostic>>): node is NonNullable<T>;
356
357
 
357
358
  interface EnvironmentOptions {
358
359
  /**
@@ -599,18 +600,19 @@ declare class EventEmitter {
599
600
  removeReporters(): void;
600
601
  }
601
602
 
603
+ declare class Reject {
604
+ #private;
605
+ constructor(compiler: typeof ts, typeChecker: ts.TypeChecker, resolvedConfig: ResolvedConfig);
606
+ argumentType(target: Array<[name: string, node: ts.Expression | ts.TypeNode | undefined]>, onDiagnostics: DiagnosticsHandler<Array<Diagnostic>>): boolean;
607
+ }
608
+
602
609
  interface MatchResult {
603
610
  explain: () => Array<Diagnostic>;
604
611
  isMatch: boolean;
605
612
  }
606
- type Relation = Map<string, unknown>;
607
613
  interface TypeChecker extends ts.TypeChecker {
608
614
  isApplicableIndexType: (source: ts.Type, target: ts.Type) => boolean;
609
- isTypeRelatedTo: (source: ts.Type, target: ts.Type, relation: Relation) => boolean;
610
- relation: {
611
- assignable: Relation;
612
- identity: Relation;
613
- };
615
+ isTypeIdenticalTo: (source: ts.Type, target: ts.Type) => boolean;
614
616
  }
615
617
 
616
618
  declare class ExpectService {
@@ -624,7 +626,7 @@ declare class ExpectService {
624
626
  private toBeConstructableWith;
625
627
  private toHaveProperty;
626
628
  private toRaiseError;
627
- constructor(compiler: typeof ts, typeChecker: TypeChecker, resolvedConfig: ResolvedConfig);
629
+ constructor(compiler: typeof ts, typeChecker: TypeChecker, reject: Reject);
628
630
  match(assertion: AssertionNode, onDiagnostics: DiagnosticsHandler<Diagnostic | Array<Diagnostic>>): MatchResult | undefined;
629
631
  }
630
632
 
@@ -878,5 +880,11 @@ declare class WatchService {
878
880
  watch(cancellationToken: CancellationToken): AsyncIterable<Array<Task>>;
879
881
  }
880
882
 
881
- export { AssertionNode, BaseReporter, CancellationHandler, CancellationReason, CancellationToken, Cli, CollectService, Color, Config, ConfigDiagnosticText, DescribeResult, Diagnostic, DiagnosticCategory, DiagnosticOrigin, EventEmitter, ExitCodeHandler, ExpectResult, ExpectService, FileWatcher, InputService, Line, ListReporter, OptionBrand, OptionGroup, Options, OutputService, Path, PluginService, ProjectResult, ProjectService, Result, ResultCount, ResultHandler, ResultStatus, ResultTiming, Runner, Scribbler, ScribblerJsx, Select, SelectDiagnosticText, SetupReporter, SourceFile, Store, SummaryReporter, TargetResult, Task, TaskResult, TestResult, TestTree, TestTreeNode, TestTreeNodeBrand, TestTreeNodeFlags, Text, Version, WatchReporter, WatchService, Watcher, WhenNode, addsPackageText, defaultOptions, describeNameText, diagnosticBelongsToNode, diagnosticText, environmentOptions, fileViewText, formattedText, getDiagnosticMessageText, getTextSpanEnd, helpText, isDiagnosticWithLocation, nodeBelongsToArgumentList, summaryText, taskStatusText, testNameText, usesCompilerText, waitingForFileChangesText, watchUsageText };
883
+ declare class WhenService {
884
+ #private;
885
+ constructor(reject: Reject, onDiagnostics: DiagnosticsHandler<Array<Diagnostic>>);
886
+ action(when: WhenNode): void;
887
+ }
888
+
889
+ export { AssertionNode, BaseReporter, CancellationHandler, CancellationReason, CancellationToken, Cli, CollectService, Color, Config, ConfigDiagnosticText, DescribeResult, Diagnostic, DiagnosticCategory, DiagnosticOrigin, EventEmitter, ExitCodeHandler, ExpectResult, ExpectService, FileWatcher, InputService, Line, ListReporter, OptionBrand, OptionGroup, Options, OutputService, Path, PluginService, ProjectResult, ProjectService, Reject, Result, ResultCount, ResultHandler, ResultStatus, ResultTiming, Runner, Scribbler, ScribblerJsx, Select, SelectDiagnosticText, SetupReporter, SourceFile, Store, SummaryReporter, TargetResult, Task, TaskResult, TestResult, TestTree, TestTreeNode, TestTreeNodeBrand, TestTreeNodeFlags, Text, Version, WatchReporter, WatchService, Watcher, WhenNode, WhenService, addsPackageText, argumentIsProvided, argumentOrTypeArgumentIsProvided, defaultOptions, describeNameText, diagnosticBelongsToNode, diagnosticText, environmentOptions, fileViewText, formattedText, getDiagnosticMessageText, getTextSpanEnd, helpText, isDiagnosticWithLocation, nodeBelongsToArgumentList, summaryText, taskStatusText, testNameText, usesCompilerText, waitingForFileChangesText, watchUsageText };
882
890
  export type { CodeFrameOptions, CommandLineOptions, ConfigFileOptions, DiagnosticsHandler, EnvironmentOptions, Event, EventHandler, FileWatchHandler, InputHandler, ItemDefinition, MatchResult, OptionDefinition, Plugin, Reporter, ReporterEvent, ResolvedConfig, ScribblerOptions, SelectHookContext, TargetResultStatus, TaskResultStatus, TypeChecker, WatchHandler, WatcherOptions };