tstyche 4.0.0 → 4.0.1

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.
@@ -20,153 +20,37 @@ declare class Cli {
20
20
  run(commandLine: Array<string>, cancellationToken?: CancellationToken): Promise<void>;
21
21
  }
22
22
 
23
- declare enum OptionBrand {
24
- String = "string",
25
- Number = "number",
26
- Boolean = "boolean",
27
- BareTrue = "bareTrue",// a boolean option that does not take a value and when specified is interpreted as 'true'
28
- List = "list"
29
- }
30
-
31
- declare class ConfigDiagnosticText {
32
- static expected(element: string): string;
33
- static expectsListItemType(optionName: string, optionBrand: OptionBrand): string;
34
- static expectsValue(optionName: string): string;
35
- static fileDoesNotExist(filePath: string): string;
36
- static inspectSupportedVersions(): string;
37
- static moduleWasNotFound(specifier: string): string;
38
- static rangeIsNotValid(value: string): string;
39
- static rangeUsage(): Array<string>;
40
- static requiresValueType(optionName: string, optionBrand: OptionBrand): string;
41
- static seen(element: string): string;
42
- static testFileMatchCannotStartWith(segment: string): Array<string>;
43
- static unexpected(element: string): string;
44
- static unknownOption(optionName: string): string;
45
- static usage(optionName: string, optionBrand: OptionBrand): Array<string>;
46
- static versionIsNotSupported(value: string): string;
47
- static watchCannotBeEnabled(): string;
48
- }
49
-
50
- /**
51
- * Options passed through the command line.
52
- */
53
23
  interface CommandLineOptions {
54
- /**
55
- * The path to a TSTyche configuration file.
56
- */
57
24
  config?: string;
58
- /**
59
- * Stop running tests after the first failed assertion.
60
- */
61
25
  failFast?: boolean;
62
- /**
63
- * Fetch the specified versions of the 'typescript' package and exit.
64
- */
65
26
  fetch?: boolean;
66
- /**
67
- * Print the list of command line options with brief descriptions and exit.
68
- */
69
27
  help?: boolean;
70
- /**
71
- * Print the list of supported versions of the 'typescript' package and exit.
72
- */
73
28
  list?: boolean;
74
- /**
75
- * Print the list of the selected test files and exit.
76
- */
77
29
  listFiles?: boolean;
78
- /**
79
- * Only run tests with matching name.
80
- */
81
30
  only?: string;
82
- /**
83
- * The list of plugins to use.
84
- */
85
31
  plugins?: Array<string>;
86
- /**
87
- * Remove all installed versions of the 'typescript' package and exit.
88
- */
89
32
  prune?: boolean;
90
- /**
91
- * The list of reporters to use.
92
- */
93
33
  reporters?: Array<string>;
94
- /**
95
- * Print the resolved configuration and exit.
96
- */
97
34
  showConfig?: boolean;
98
- /**
99
- * Skip tests with matching name.
100
- */
101
35
  skip?: string;
102
- /**
103
- * The list of TypeScript versions to be tested on.
104
- */
105
36
  target?: Array<string>;
106
- /**
107
- * The look up strategy to be used to find the TSConfig file.
108
- */
109
37
  tsconfig?: string;
110
- /**
111
- * Fetch the 'typescript' package metadata from the registry and exit.
112
- */
113
38
  update?: boolean;
114
- /**
115
- * Print the version number and exit.
116
- */
117
39
  version?: boolean;
118
- /**
119
- * Watch for changes and rerun related test files.
120
- */
121
40
  watch?: boolean;
122
41
  }
123
-
124
- /**
125
- * Options loaded from the configuration file.
126
- */
127
42
  interface ConfigFileOptions {
128
- /**
129
- * Enable type error reporting for source files.
130
- */
131
43
  checkSourceFiles?: boolean;
132
- /**
133
- * Stop running tests after the first failed assertion.
134
- */
135
44
  failFast?: boolean;
136
- /**
137
- * The list of plugins to use.
138
- */
139
45
  plugins?: Array<string>;
140
- /**
141
- * Reject the 'any' type passed as an argument to the 'expect()' function or a matcher.
142
- */
143
46
  rejectAnyType?: boolean;
144
- /**
145
- * Reject the 'never' type passed as an argument to the 'expect()' function or a matcher.
146
- */
147
47
  rejectNeverType?: boolean;
148
- /**
149
- * The list of reporters to use.
150
- */
151
48
  reporters?: Array<string>;
152
- /**
153
- * The path to a directory containing files of a test project.
154
- */
155
49
  rootPath?: string;
156
- /**
157
- * The list of TypeScript versions to be tested on.
158
- */
159
50
  target?: Array<string>;
160
- /**
161
- * The list of glob patterns matching the test files.
162
- */
163
51
  testFileMatch?: Array<string>;
164
- /**
165
- * The look up strategy to be used to find the TSConfig file.
166
- */
167
52
  tsconfig?: string;
168
53
  }
169
-
170
54
  interface InlineConfig {
171
55
  if?: {
172
56
  target?: Array<string>;
@@ -174,13 +58,7 @@ interface InlineConfig {
174
58
  template?: boolean;
175
59
  }
176
60
  interface ResolvedConfig extends Omit<CommandLineOptions, "config" | keyof ConfigFileOptions>, Required<ConfigFileOptions> {
177
- /**
178
- * The path to a TSTyche configuration file.
179
- */
180
61
  configFilePath: string;
181
- /**
182
- * Only run test files with matching path.
183
- */
184
62
  pathMatch: Array<string>;
185
63
  }
186
64
 
@@ -203,6 +81,33 @@ declare class Config {
203
81
  static resolveConfigFilePath(filePath?: string): string;
204
82
  }
205
83
 
84
+ declare enum OptionBrand {
85
+ String = "string",
86
+ Number = "number",
87
+ Boolean = "boolean",
88
+ BareTrue = "bareTrue",
89
+ List = "list"
90
+ }
91
+
92
+ declare class ConfigDiagnosticText {
93
+ static expected(element: string): string;
94
+ static expectsListItemType(optionName: string, optionBrand: OptionBrand): string;
95
+ static expectsValue(optionName: string): string;
96
+ static fileDoesNotExist(filePath: string): string;
97
+ static inspectSupportedVersions(): string;
98
+ static moduleWasNotFound(specifier: string): string;
99
+ static rangeIsNotValid(value: string): string;
100
+ static rangeUsage(): Array<string>;
101
+ static requiresValueType(optionName: string, optionBrand: OptionBrand): string;
102
+ static seen(element: string): string;
103
+ static testFileMatchCannotStartWith(segment: string): Array<string>;
104
+ static unexpected(element: string): string;
105
+ static unknownOption(optionName: string): string;
106
+ static usage(optionName: string, optionBrand: OptionBrand): Array<string>;
107
+ static versionIsNotSupported(value: string): string;
108
+ static watchCannotBeEnabled(): string;
109
+ }
110
+
206
111
  interface TextRange {
207
112
  start: number;
208
113
  end: number;
@@ -222,6 +127,15 @@ declare class Directive {
222
127
  static getInlineConfig(ranges: DirectiveRanges | undefined): Promise<InlineConfig | undefined>;
223
128
  }
224
129
 
130
+ declare const defaultOptions: Required<ConfigFileOptions>;
131
+
132
+ declare enum OptionGroup {
133
+ CommandLine = 2,
134
+ ConfigFile = 4,
135
+ InlineConditions = 8,
136
+ ResolvedConfig = 6
137
+ }
138
+
225
139
  declare enum DiagnosticCategory {
226
140
  Error = "error",
227
141
  Warning = "warning"
@@ -274,13 +188,6 @@ declare function isDiagnosticWithLocation(diagnostic: ts.Diagnostic): diagnostic
274
188
 
275
189
  type DiagnosticsHandler<T extends Diagnostic | Array<Diagnostic> = Diagnostic> = (this: void, diagnostics: T) => void;
276
190
 
277
- declare enum OptionGroup {
278
- CommandLine = 2,
279
- ConfigFile = 4,
280
- InlineConditions = 8,
281
- ResolvedConfig = 6
282
- }
283
-
284
191
  interface BaseOptionDefinition {
285
192
  brand: OptionBrand;
286
193
  description: string;
@@ -306,8 +213,6 @@ declare class Options {
306
213
  static validate(optionName: string, optionValue: string, optionBrand: OptionBrand, onDiagnostics: DiagnosticsHandler, origin?: DiagnosticOrigin): Promise<void>;
307
214
  }
308
215
 
309
- declare const defaultOptions: Required<ConfigFileOptions>;
310
-
311
216
  declare enum TestTreeNodeBrand {
312
217
  Describe = "describe",
313
218
  Test = "test",
@@ -386,33 +291,12 @@ declare function argumentIsProvided<T>(argumentNameText: string, node: T, enclos
386
291
  declare function argumentOrTypeArgumentIsProvided<T>(argumentNameText: string, typeArgumentNameText: string, node: T, enclosingNode: ts.Node, onDiagnostics: DiagnosticsHandler<Array<Diagnostic>>): node is NonNullable<T>;
387
292
 
388
293
  interface EnvironmentOptions {
389
- /**
390
- * Is `true` if the process is running in continuous integration environment.
391
- */
392
294
  isCi: boolean;
393
- /**
394
- * Specifies whether color should be disabled in the output.
395
- */
396
295
  noColor: boolean;
397
- /**
398
- * Specifies whether interactive elements should be disabled in the output.
399
- */
400
296
  noInteractive: boolean;
401
- /**
402
- * The base URL of the 'npm' registry to use.
403
- */
404
297
  npmRegistry: string;
405
- /**
406
- * The directory where to store the 'typescript' packages.
407
- */
408
298
  storePath: string;
409
- /**
410
- * The number of seconds to wait before giving up stale operations.
411
- */
412
299
  timeout: number;
413
- /**
414
- * The specifier of the TypeScript module.
415
- */
416
300
  typescriptModule: string | undefined;
417
301
  }
418
302
 
@@ -752,8 +636,6 @@ interface CodeFrameOptions {
752
636
 
753
637
  declare function diagnosticText(diagnostic: Diagnostic, codeFrameOptions?: CodeFrameOptions): ScribblerJsx.Element;
754
638
 
755
- declare function taskStatusText(status: TaskResultStatus, task: Task): ScribblerJsx.Element;
756
-
757
639
  declare function fileViewText(lines: Array<ScribblerJsx.Element>, addEmptyFinalLine: boolean): ScribblerJsx.Element;
758
640
 
759
641
  declare function formattedText(input: string | Array<string> | Record<string, unknown>): ScribblerJsx.Element;
@@ -777,6 +659,8 @@ declare function summaryText({ duration, expectCount, fileCount, targetCount, te
777
659
  testCount: ResultCount;
778
660
  }): ScribblerJsx.Element;
779
661
 
662
+ declare function taskStatusText(status: TaskResultStatus, task: Task): ScribblerJsx.Element;
663
+
780
664
  declare function testNameText(status: "fail" | "pass" | "skip" | "todo", name: string, indent?: number): ScribblerJsx.Element;
781
665
 
782
666
  declare function usesCompilerText(compilerVersion: string, projectConfigFilePath: string | undefined, options?: {
@@ -799,17 +683,8 @@ interface SelectHookContext {
799
683
  resolvedConfig: ResolvedConfig;
800
684
  }
801
685
  interface Plugin {
802
- /**
803
- * The name of this plugin.
804
- */
805
686
  name: string;
806
- /**
807
- * Is called after configuration is resolved and allows to modify it.
808
- */
809
687
  config?: (resolvedConfig: ResolvedConfig) => ResolvedConfig | Promise<ResolvedConfig>;
810
- /**
811
- * Is called after test files are selected and allows to modify the list.
812
- */
813
688
  select?: (this: SelectHookContext, testFiles: Array<string>) => Array<string | URL> | Promise<Array<string | URL>>;
814
689
  }
815
690
 
package/build/tstyche.js CHANGED
@@ -8,76 +8,6 @@ import { createRequire } from 'node:module';
8
8
  import vm from 'node:vm';
9
9
  import streamConsumers from 'node:stream/consumers';
10
10
 
11
- class ConfigDiagnosticText {
12
- static expected(element) {
13
- return `Expected ${element}.`;
14
- }
15
- static expectsListItemType(optionName, optionBrand) {
16
- return `Item of the '${optionName}' list must be of type ${optionBrand}.`;
17
- }
18
- static expectsValue(optionName) {
19
- return `Option '${optionName}' expects a value.`;
20
- }
21
- static fileDoesNotExist(filePath) {
22
- return `The specified path '${filePath}' does not exist.`;
23
- }
24
- static inspectSupportedVersions() {
25
- return "Use the '--list' command line option to inspect the list of supported versions.";
26
- }
27
- static moduleWasNotFound(specifier) {
28
- return `The specified module '${specifier}' was not found.`;
29
- }
30
- static rangeIsNotValid(value) {
31
- return `The specified range '${value}' is not valid.`;
32
- }
33
- static rangeUsage() {
34
- return [
35
- "A range must be specified using an operator and a minor version.",
36
- "To set an upper bound, the intersection of two ranges can be used.",
37
- "Examples: '>=5.5', '>=5.0 <5.3'.",
38
- ];
39
- }
40
- static requiresValueType(optionName, optionBrand) {
41
- return `Option '${optionName}' requires a value of type ${optionBrand}.`;
42
- }
43
- static seen(element) {
44
- return `The ${element} was seen here.`;
45
- }
46
- static testFileMatchCannotStartWith(segment) {
47
- return [
48
- `A test file match pattern cannot start with '${segment}'.`,
49
- "The test files are only collected within the 'rootPath' directory.",
50
- ];
51
- }
52
- static unexpected(element) {
53
- return `Unexpected ${element}.`;
54
- }
55
- static unknownOption(optionName) {
56
- return `Unknown option '${optionName}'.`;
57
- }
58
- static usage(optionName, optionBrand) {
59
- switch (optionName.startsWith("--") ? optionName.slice(2) : optionName) {
60
- case "target": {
61
- const text = [];
62
- if (optionName.startsWith("--")) {
63
- text.push("Value for the '--target' option must be a string or a comma separated list.", "Examples: '--target 5.2', '--target next', '--target '>=5.0 <5.3, 5.4.2, >=5.5''.");
64
- }
65
- return text;
66
- }
67
- }
68
- return [ConfigDiagnosticText.requiresValueType(optionName, optionBrand)];
69
- }
70
- static versionIsNotSupported(value) {
71
- if (value === "current") {
72
- return "Cannot use 'current' as a target. Failed to resolve the installed TypeScript module.";
73
- }
74
- return `TypeScript version '${value}' is not supported.`;
75
- }
76
- static watchCannotBeEnabled() {
77
- return "Watch mode cannot be enabled in continuous integration environment.";
78
- }
79
- }
80
-
81
11
  var DiagnosticCategory;
82
12
  (function (DiagnosticCategory) {
83
13
  DiagnosticCategory["Error"] = "error";
@@ -282,6 +212,76 @@ class Path {
282
212
  }
283
213
  }
284
214
 
215
+ class ConfigDiagnosticText {
216
+ static expected(element) {
217
+ return `Expected ${element}.`;
218
+ }
219
+ static expectsListItemType(optionName, optionBrand) {
220
+ return `Item of the '${optionName}' list must be of type ${optionBrand}.`;
221
+ }
222
+ static expectsValue(optionName) {
223
+ return `Option '${optionName}' expects a value.`;
224
+ }
225
+ static fileDoesNotExist(filePath) {
226
+ return `The specified path '${filePath}' does not exist.`;
227
+ }
228
+ static inspectSupportedVersions() {
229
+ return "Use the '--list' command line option to inspect the list of supported versions.";
230
+ }
231
+ static moduleWasNotFound(specifier) {
232
+ return `The specified module '${specifier}' was not found.`;
233
+ }
234
+ static rangeIsNotValid(value) {
235
+ return `The specified range '${value}' is not valid.`;
236
+ }
237
+ static rangeUsage() {
238
+ return [
239
+ "A range must be specified using an operator and a minor version.",
240
+ "To set an upper bound, the intersection of two ranges can be used.",
241
+ "Examples: '>=5.5', '>=5.0 <5.3'.",
242
+ ];
243
+ }
244
+ static requiresValueType(optionName, optionBrand) {
245
+ return `Option '${optionName}' requires a value of type ${optionBrand}.`;
246
+ }
247
+ static seen(element) {
248
+ return `The ${element} was seen here.`;
249
+ }
250
+ static testFileMatchCannotStartWith(segment) {
251
+ return [
252
+ `A test file match pattern cannot start with '${segment}'.`,
253
+ "The test files are only collected within the 'rootPath' directory.",
254
+ ];
255
+ }
256
+ static unexpected(element) {
257
+ return `Unexpected ${element}.`;
258
+ }
259
+ static unknownOption(optionName) {
260
+ return `Unknown option '${optionName}'.`;
261
+ }
262
+ static usage(optionName, optionBrand) {
263
+ switch (optionName.startsWith("--") ? optionName.slice(2) : optionName) {
264
+ case "target": {
265
+ const text = [];
266
+ if (optionName.startsWith("--")) {
267
+ text.push("Value for the '--target' option must be a string or a comma separated list.", "Examples: '--target 5.2', '--target next', '--target '>=5.0 <5.3, 5.4.2, >=5.5''.");
268
+ }
269
+ return text;
270
+ }
271
+ }
272
+ return [ConfigDiagnosticText.requiresValueType(optionName, optionBrand)];
273
+ }
274
+ static versionIsNotSupported(value) {
275
+ if (value === "current") {
276
+ return "Cannot use 'current' as a target. Failed to resolve the installed TypeScript module.";
277
+ }
278
+ return `TypeScript version '${value}' is not supported.`;
279
+ }
280
+ static watchCannotBeEnabled() {
281
+ return "Watch mode cannot be enabled in continuous integration environment.";
282
+ }
283
+ }
284
+
285
285
  var OptionBrand;
286
286
  (function (OptionBrand) {
287
287
  OptionBrand["String"] = "string";
@@ -513,7 +513,7 @@ class LockService {
513
513
  }
514
514
  return isLocked;
515
515
  }
516
- async #sleep(delay) {
516
+ #sleep(delay) {
517
517
  return new Promise((resolve) => setTimeout(resolve, delay));
518
518
  }
519
519
  }
@@ -1392,6 +1392,19 @@ class ConfigParser {
1392
1392
  }
1393
1393
  }
1394
1394
 
1395
+ const defaultOptions = {
1396
+ checkSourceFiles: true,
1397
+ failFast: false,
1398
+ plugins: [],
1399
+ rejectAnyType: true,
1400
+ rejectNeverType: true,
1401
+ reporters: ["list", "summary"],
1402
+ rootPath: Path.resolve("./"),
1403
+ target: environmentOptions.typescriptModule != null ? ["current"] : ["latest"],
1404
+ testFileMatch: ["**/*.tst.*", "**/__typetests__/*.test.*", "**/typetests/*.test.*"],
1405
+ tsconfig: "findup",
1406
+ };
1407
+
1395
1408
  class JsonNode {
1396
1409
  origin;
1397
1410
  text;
@@ -1525,19 +1538,6 @@ class JsonScanner {
1525
1538
  }
1526
1539
  }
1527
1540
 
1528
- const defaultOptions = {
1529
- checkSourceFiles: true,
1530
- failFast: false,
1531
- plugins: [],
1532
- rejectAnyType: true,
1533
- rejectNeverType: true,
1534
- reporters: ["list", "summary"],
1535
- rootPath: Path.resolve("./"),
1536
- target: environmentOptions.typescriptModule != null ? ["current"] : ["latest"],
1537
- testFileMatch: ["**/*.tst.*", "**/__typetests__/*.test.*", "**/typetests/*.test.*"],
1538
- tsconfig: "findup",
1539
- };
1540
-
1541
1541
  class Config {
1542
1542
  static #onDiagnostics(diagnostic) {
1543
1543
  EventEmitter.dispatch(["config:error", { diagnostics: [diagnostic] }]);
@@ -1589,20 +1589,19 @@ class Config {
1589
1589
  }
1590
1590
 
1591
1591
  class DirectiveDiagnosticText {
1592
- static doesNotTakeArgument(directiveName) {
1593
- return `Directive '${directiveName}' does not take an argument.`;
1592
+ static doesNotTakeArgument() {
1593
+ return "Directive does not take an argument.";
1594
1594
  }
1595
1595
  static isNotSupported(directive) {
1596
1596
  return `The '${directive}' directive is not supported.`;
1597
1597
  }
1598
- static requiresArgument(directiveName) {
1599
- return `Directive '${directiveName}' requires an argument.`;
1598
+ static requiresArgument() {
1599
+ return "Directive requires an argument.";
1600
1600
  }
1601
1601
  }
1602
1602
 
1603
1603
  class Directive {
1604
- static #commentSeparatorRegex = /--+/;
1605
- static #directiveRegex = /^(\/\/\s*@tstyche)(\s*|-)?(\S*)?(\s*)?(.*)?/i;
1604
+ static #directiveRegex = /^(\/\/ *@tstyche)( *|-)?(\S*)?( *)?(.*)?/i;
1606
1605
  static getDirectiveRanges(compiler, sourceFile, position = 0) {
1607
1606
  const comments = compiler.getLeadingCommentRanges(sourceFile.text, position);
1608
1607
  if (!comments || comments.length === 0) {
@@ -1631,28 +1630,28 @@ class Directive {
1631
1630
  return inlineConfig;
1632
1631
  }
1633
1632
  static #getRange(sourceFile, comment) {
1634
- const [text] = sourceFile.text.substring(comment.pos, comment.end).split(Directive.#commentSeparatorRegex);
1635
- const found = text?.match(Directive.#directiveRegex);
1636
- const namespaceText = found?.[1];
1633
+ const [text] = sourceFile.text.substring(comment.pos, comment.end).split(/--+/);
1634
+ const match = text?.match(Directive.#directiveRegex);
1635
+ const namespaceText = match?.[1];
1637
1636
  if (!namespaceText) {
1638
1637
  return;
1639
1638
  }
1640
- const ranges = {
1639
+ const range = {
1641
1640
  namespace: { start: comment.pos, end: comment.pos + namespaceText.length, text: namespaceText },
1642
1641
  };
1643
- const directiveSeparatorText = found?.[2];
1644
- const directiveText = found?.[3];
1645
- if (directiveText != null && directiveText.length > 0) {
1646
- const start = ranges.namespace.end + (directiveSeparatorText?.length ?? 0);
1647
- ranges.directive = { start, end: start + directiveText.length, text: directiveText };
1648
- }
1649
- const argumentSeparatorText = found?.[4];
1650
- const argumentText = found?.[5]?.trimEnd();
1651
- if (ranges.directive != null && argumentText != null && argumentText.length > 0) {
1652
- const start = ranges.directive.end + (argumentSeparatorText?.length ?? 0);
1653
- ranges.argument = { start, end: start + argumentText.length, text: argumentText };
1642
+ const directiveSeparatorText = match?.[2];
1643
+ const directiveText = match?.[3];
1644
+ if (typeof directiveText === "string" && typeof directiveSeparatorText === "string") {
1645
+ const start = range.namespace.end + directiveSeparatorText.length;
1646
+ range.directive = { start, end: start + directiveText.length, text: directiveText };
1647
+ const argumentSeparatorText = match?.[4];
1648
+ const argumentText = match?.[5]?.trimEnd();
1649
+ if (typeof argumentSeparatorText === "string" && typeof argumentText === "string") {
1650
+ const start = range.directive.end + argumentSeparatorText.length;
1651
+ range.argument = { start, end: start + argumentText.length, text: argumentText };
1652
+ }
1654
1653
  }
1655
- return ranges;
1654
+ return range;
1656
1655
  }
1657
1656
  static #onDiagnostics(diagnostic) {
1658
1657
  EventEmitter.dispatch(["directive:error", { diagnostics: [diagnostic] }]);
@@ -1662,8 +1661,8 @@ class Directive {
1662
1661
  case "if":
1663
1662
  {
1664
1663
  if (!ranges.argument?.text) {
1665
- const text = DirectiveDiagnosticText.requiresArgument(ranges.directive.text);
1666
- const origin = new DiagnosticOrigin(ranges.directive.start, ranges.directive.end, sourceFile);
1664
+ const text = DirectiveDiagnosticText.requiresArgument();
1665
+ const origin = new DiagnosticOrigin(ranges.namespace.start, ranges.directive.end, sourceFile);
1667
1666
  Directive.#onDiagnostics(Diagnostic.error(text, origin));
1668
1667
  return;
1669
1668
  }
@@ -1673,8 +1672,8 @@ class Directive {
1673
1672
  return;
1674
1673
  case "template":
1675
1674
  if (ranges.argument?.text != null) {
1676
- const text = DirectiveDiagnosticText.doesNotTakeArgument(ranges.directive.text);
1677
- const origin = new DiagnosticOrigin(ranges.directive.start, ranges.directive.end, sourceFile);
1675
+ const text = DirectiveDiagnosticText.doesNotTakeArgument();
1676
+ const origin = new DiagnosticOrigin(ranges.argument.start, ranges.argument.end, sourceFile);
1678
1677
  Directive.#onDiagnostics(Diagnostic.error(text, origin));
1679
1678
  }
1680
1679
  inlineConfig.template = true;
@@ -2215,33 +2214,6 @@ function diagnosticText(diagnostic, codeFrameOptions = {}) {
2215
2214
  return (jsx(Text, { children: [prefix, jsx(DiagnosticText, { codeFrameOptions: codeFrameOptions, diagnostic: diagnostic })] }));
2216
2215
  }
2217
2216
 
2218
- function FileNameText({ filePath }) {
2219
- const relativePath = Path.relative("", filePath);
2220
- const lastPathSeparator = relativePath.lastIndexOf("/");
2221
- const directoryNameText = relativePath.slice(0, lastPathSeparator + 1);
2222
- const fileNameText = relativePath.slice(lastPathSeparator + 1);
2223
- return (jsx(Text, { children: [jsx(Text, { color: Color.Gray, children: directoryNameText }), fileNameText] }));
2224
- }
2225
- function taskStatusText(status, task) {
2226
- let statusColor;
2227
- let statusText;
2228
- switch (status) {
2229
- case ResultStatus.Runs:
2230
- statusColor = Color.Yellow;
2231
- statusText = "runs";
2232
- break;
2233
- case ResultStatus.Passed:
2234
- statusColor = Color.Green;
2235
- statusText = "pass";
2236
- break;
2237
- case ResultStatus.Failed:
2238
- statusColor = Color.Red;
2239
- statusText = "fail";
2240
- break;
2241
- }
2242
- return (jsx(Line, { children: [jsx(Text, { color: statusColor, children: statusText }), " ", jsx(FileNameText, { filePath: task.filePath })] }));
2243
- }
2244
-
2245
2217
  function fileViewText(lines, addEmptyFinalLine) {
2246
2218
  return (jsx(Text, { children: [[...lines], addEmptyFinalLine ? jsx(Line, {}) : undefined] }));
2247
2219
  }
@@ -2361,6 +2333,33 @@ function summaryText({ duration, expectCount, fileCount, targetCount, testCount,
2361
2333
  return (jsx(Text, { children: [targetCountText, fileCountText, testCount.total > 0 ? testCountText : undefined, expectCount.total > 0 ? assertionCountText : undefined, jsx(RowText, { label: "Duration", text: jsx(DurationText, { seconds: duration / 1000 }) })] }));
2362
2334
  }
2363
2335
 
2336
+ function FileNameText({ filePath }) {
2337
+ const relativePath = Path.relative("", filePath);
2338
+ const lastPathSeparator = relativePath.lastIndexOf("/");
2339
+ const directoryNameText = relativePath.slice(0, lastPathSeparator + 1);
2340
+ const fileNameText = relativePath.slice(lastPathSeparator + 1);
2341
+ return (jsx(Text, { children: [jsx(Text, { color: Color.Gray, children: directoryNameText }), fileNameText] }));
2342
+ }
2343
+ function taskStatusText(status, task) {
2344
+ let statusColor;
2345
+ let statusText;
2346
+ switch (status) {
2347
+ case ResultStatus.Runs:
2348
+ statusColor = Color.Yellow;
2349
+ statusText = "runs";
2350
+ break;
2351
+ case ResultStatus.Passed:
2352
+ statusColor = Color.Green;
2353
+ statusText = "pass";
2354
+ break;
2355
+ case ResultStatus.Failed:
2356
+ statusColor = Color.Red;
2357
+ statusText = "fail";
2358
+ break;
2359
+ }
2360
+ return (jsx(Line, { children: [jsx(Text, { color: statusColor, children: statusText }), " ", jsx(FileNameText, { filePath: task.filePath })] }));
2361
+ }
2362
+
2364
2363
  function StatusText({ status }) {
2365
2364
  switch (status) {
2366
2365
  case "fail":
@@ -2646,6 +2645,14 @@ class Task {
2646
2645
  }
2647
2646
  }
2648
2647
 
2648
+ var CancellationReason;
2649
+ (function (CancellationReason) {
2650
+ CancellationReason["ConfigChange"] = "configChange";
2651
+ CancellationReason["ConfigError"] = "configError";
2652
+ CancellationReason["FailFast"] = "failFast";
2653
+ CancellationReason["WatchClose"] = "watchClose";
2654
+ })(CancellationReason || (CancellationReason = {}));
2655
+
2649
2656
  class CancellationToken {
2650
2657
  #isCancelled = false;
2651
2658
  #reason;
@@ -2669,14 +2676,6 @@ class CancellationToken {
2669
2676
  }
2670
2677
  }
2671
2678
 
2672
- var CancellationReason;
2673
- (function (CancellationReason) {
2674
- CancellationReason["ConfigChange"] = "configChange";
2675
- CancellationReason["ConfigError"] = "configError";
2676
- CancellationReason["FailFast"] = "failFast";
2677
- CancellationReason["WatchClose"] = "watchClose";
2678
- })(CancellationReason || (CancellationReason = {}));
2679
-
2680
2679
  class Watcher {
2681
2680
  #onChanged;
2682
2681
  #onRemoved;
@@ -3641,6 +3640,7 @@ var RunMode;
3641
3640
  RunMode[RunMode["Only"] = 2] = "Only";
3642
3641
  RunMode[RunMode["Skip"] = 4] = "Skip";
3643
3642
  RunMode[RunMode["Todo"] = 8] = "Todo";
3643
+ RunMode[RunMode["Void"] = 16] = "Void";
3644
3644
  })(RunMode || (RunMode = {}));
3645
3645
 
3646
3646
  class EnsureDiagnosticText {
@@ -4686,7 +4686,7 @@ class TestTreeWalker {
4686
4686
  const directiveRanges = node.getDirectiveRanges(this.#compiler);
4687
4687
  const inlineConfig = await Directive.getInlineConfig(directiveRanges);
4688
4688
  if (inlineConfig?.if?.target != null && !Version.isIncluded(this.#compiler.version, inlineConfig.if.target)) {
4689
- mode |= RunMode.Skip;
4689
+ mode |= RunMode.Void;
4690
4690
  }
4691
4691
  if (node.flags & TestTreeNodeFlags.Fail) {
4692
4692
  mode |= RunMode.Fail;
@@ -4731,9 +4731,12 @@ class TestTreeWalker {
4731
4731
  }
4732
4732
  async #visitAssertion(assertion, runMode, parentResult) {
4733
4733
  await this.visit(assertion.children, runMode, parentResult);
4734
+ runMode = await this.#resolveRunMode(runMode, assertion);
4735
+ if (runMode & RunMode.Void) {
4736
+ return;
4737
+ }
4734
4738
  const expectResult = new ExpectResult(assertion, parentResult);
4735
4739
  EventEmitter.dispatch(["expect:start", { result: expectResult }]);
4736
- runMode = await this.#resolveRunMode(runMode, assertion);
4737
4740
  if (runMode & RunMode.Skip || (this.#hasOnly && !(runMode & RunMode.Only))) {
4738
4741
  EventEmitter.dispatch(["expect:skip", { result: expectResult }]);
4739
4742
  return;
@@ -4770,9 +4773,12 @@ class TestTreeWalker {
4770
4773
  }
4771
4774
  }
4772
4775
  async #visitDescribe(describe, runMode, parentResult) {
4776
+ runMode = await this.#resolveRunMode(runMode, describe);
4777
+ if (runMode & RunMode.Void) {
4778
+ return;
4779
+ }
4773
4780
  const describeResult = new DescribeResult(describe, parentResult);
4774
4781
  EventEmitter.dispatch(["describe:start", { result: describeResult }]);
4775
- runMode = await this.#resolveRunMode(runMode, describe);
4776
4782
  if (!(runMode & RunMode.Skip || (this.#hasOnly && !(runMode & RunMode.Only)) || runMode & RunMode.Todo) &&
4777
4783
  describe.diagnostics.size > 0) {
4778
4784
  this.#onTaskDiagnostics(Diagnostic.fromDiagnostics([...describe.diagnostics]));
@@ -4783,9 +4789,12 @@ class TestTreeWalker {
4783
4789
  EventEmitter.dispatch(["describe:end", { result: describeResult }]);
4784
4790
  }
4785
4791
  async #visitTest(test, runMode, parentResult) {
4792
+ runMode = await this.#resolveRunMode(runMode, test);
4793
+ if (runMode & RunMode.Void) {
4794
+ return;
4795
+ }
4786
4796
  const testResult = new TestResult(test, parentResult);
4787
4797
  EventEmitter.dispatch(["test:start", { result: testResult }]);
4788
- runMode = await this.#resolveRunMode(runMode, test);
4789
4798
  if (runMode & RunMode.Todo) {
4790
4799
  EventEmitter.dispatch(["test:todo", { result: testResult }]);
4791
4800
  return;
@@ -4906,7 +4915,7 @@ class TaskRunner {
4906
4915
  class Runner {
4907
4916
  #eventEmitter = new EventEmitter();
4908
4917
  #resolvedConfig;
4909
- static version = "4.0.0";
4918
+ static version = "4.0.1";
4910
4919
  constructor(resolvedConfig) {
4911
4920
  this.#resolvedConfig = resolvedConfig;
4912
4921
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tstyche",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "Everything You Need for Type Testing.",
5
5
  "keywords": [
6
6
  "typescript",