tstyche 6.0.0-beta.2 → 6.0.0-beta.3

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.
@@ -142,7 +142,6 @@ interface CommandLineOptions {
142
142
  list?: boolean;
143
143
  listFiles?: boolean;
144
144
  only?: string;
145
- plugins?: Array<string>;
146
145
  prune?: boolean;
147
146
  reporters?: Array<string>;
148
147
  showConfig?: boolean;
@@ -158,7 +157,6 @@ interface ConfigFileOptions {
158
157
  checkSuppressedErrors?: boolean;
159
158
  failFast?: boolean;
160
159
  fixtureFileMatch?: Array<string>;
161
- plugins?: Array<string>;
162
160
  rejectAnyType?: boolean;
163
161
  rejectNeverType?: boolean;
164
162
  reporters?: Array<string>;
@@ -645,23 +643,6 @@ declare class Path {
645
643
  static resolve(...filePaths: Array<string>): string;
646
644
  }
647
645
 
648
- interface SelectHookContext {
649
- resolvedConfig: ResolvedConfig;
650
- }
651
- interface Plugin {
652
- name: string;
653
- config?: (resolvedConfig: ResolvedConfig) => ResolvedConfig | Promise<ResolvedConfig>;
654
- select?: (this: SelectHookContext, testFiles: Array<string>) => Array<string | URL> | Promise<Array<string | URL>>;
655
- }
656
-
657
- type Hooks = Required<Omit<Plugin, "name">>;
658
- declare class PluginService {
659
- #private;
660
- static addHandler(plugin: Plugin): void;
661
- static call<T extends keyof Hooks>(hook: T, argument: Parameters<Hooks[T]>[0], context: ThisParameterType<Hooks[T]>): Promise<Awaited<ReturnType<Hooks[T]>>>;
662
- static removeHandlers(): void;
663
- }
664
-
665
646
  declare class Runner {
666
647
  #private;
667
648
  static version: string;
@@ -733,5 +714,5 @@ declare class Version {
733
714
  static isSatisfiedWith(source: string, target: string): boolean;
734
715
  }
735
716
 
736
- export { BaseReporter, CancellationReason, CancellationToken, Cli, Color, Config, ConfigDiagnosticText, DescribeResult, Diagnostic, DiagnosticCategory, DiagnosticOrigin, Directive, EventEmitter, ExpectResult, FileLocation, FileResult, Line, ListReporter, OptionBrand, OptionGroup, Options, OutputService, Path, PluginService, ProjectResult, Result, ResultStatus, Runner, Scribbler, ScribblerJsx, Select, SelectDiagnosticText, SetupReporter, Store, SummaryReporter, SuppressedResult, TargetResult, TestResult, Text, Version, WatchReporter, addsPackageText, defaultOptions, describeNameText, diagnosticBelongsToNode, diagnosticText, environmentOptions, fileStatusText, fileViewText, formattedText, getDiagnosticMessageText, getTextSpanEnd, helpText, isDiagnosticWithLocation, prologueText, summaryText, testNameText, usesCompilerText, waitingForFileChangesText, watchUsageText };
737
- export type { AssertionCounts, AssertionResultStatus, CodeFrameOptions, CommandLineOptions, ConfigFileOptions, DiagnosticsHandler, DirectiveRange, EnvironmentOptions, Event, EventHandler, FileCounts, FileResultStatus, InlineConfig, ItemDefinition, OptionDefinition, Plugin, Reporter, ReporterEvent, ResolvedConfig, ResultCounts, ResultTiming, ScribblerOptions, SelectHookContext, SuppressedCounts, SuppressedResultStatus, TargetCounts, TargetResultStatus, TestCounts, TestResultStatus, TextRange };
717
+ export { BaseReporter, CancellationReason, CancellationToken, Cli, Color, Config, ConfigDiagnosticText, DescribeResult, Diagnostic, DiagnosticCategory, DiagnosticOrigin, Directive, EventEmitter, ExpectResult, FileLocation, FileResult, Line, ListReporter, OptionBrand, OptionGroup, Options, OutputService, Path, ProjectResult, Result, ResultStatus, Runner, Scribbler, ScribblerJsx, Select, SelectDiagnosticText, SetupReporter, Store, SummaryReporter, SuppressedResult, TargetResult, TestResult, Text, Version, WatchReporter, addsPackageText, defaultOptions, describeNameText, diagnosticBelongsToNode, diagnosticText, environmentOptions, fileStatusText, fileViewText, formattedText, getDiagnosticMessageText, getTextSpanEnd, helpText, isDiagnosticWithLocation, prologueText, summaryText, testNameText, usesCompilerText, waitingForFileChangesText, watchUsageText };
718
+ export type { AssertionCounts, AssertionResultStatus, CodeFrameOptions, CommandLineOptions, ConfigFileOptions, DiagnosticsHandler, DirectiveRange, EnvironmentOptions, Event, EventHandler, FileCounts, FileResultStatus, InlineConfig, ItemDefinition, OptionDefinition, Reporter, ReporterEvent, ResolvedConfig, ResultCounts, ResultTiming, ScribblerOptions, SuppressedCounts, SuppressedResultStatus, TargetCounts, TargetResultStatus, TestCounts, TestResultStatus, TextRange };
@@ -1093,16 +1093,6 @@ class Options {
1093
1093
  group: 2,
1094
1094
  name: "only",
1095
1095
  },
1096
- {
1097
- brand: "list",
1098
- description: "The list of plugins to use.",
1099
- group: 2 | 4,
1100
- items: {
1101
- brand: "string",
1102
- name: "plugins",
1103
- },
1104
- name: "plugins",
1105
- },
1106
1096
  {
1107
1097
  brand: "true",
1108
1098
  description: "Remove all installed versions of the 'typescript' package and exit.",
@@ -1219,7 +1209,6 @@ class Options {
1219
1209
  }
1220
1210
  optionValue = Path.resolve(rootPath, optionValue);
1221
1211
  break;
1222
- case "plugins":
1223
1212
  case "reporters":
1224
1213
  if (canonicalOptionName === "reporters" && Options.#isBuiltinReporter(optionValue)) {
1225
1214
  break;
@@ -1252,7 +1241,6 @@ class Options {
1252
1241
  }
1253
1242
  onDiagnostics(Diagnostic.error(ConfigDiagnosticText.fileDoesNotExist(optionValue), origin));
1254
1243
  break;
1255
- case "plugins":
1256
1244
  case "reporters":
1257
1245
  if (canonicalOptionName === "reporters" && Options.#isBuiltinReporter(optionValue)) {
1258
1246
  break;
@@ -1565,7 +1553,6 @@ const defaultOptions = {
1565
1553
  checkSuppressedErrors: true,
1566
1554
  failFast: false,
1567
1555
  fixtureFileMatch: ["**/__fixtures__/*.{ts,tsx}", "**/fixtures/*.{ts,tsx}"],
1568
- plugins: [],
1569
1556
  rejectAnyType: true,
1570
1557
  rejectNeverType: true,
1571
1558
  reporters: ["list", "summary"],
@@ -2538,25 +2525,6 @@ function watchUsageText() {
2538
2525
  return jsx(Text, { children: usageText });
2539
2526
  }
2540
2527
 
2541
- class PluginService {
2542
- static #handlers = new Map();
2543
- static addHandler(plugin) {
2544
- PluginService.#handlers.set(plugin.name, plugin);
2545
- }
2546
- static async call(hook, argument, context) {
2547
- let result = argument;
2548
- for (const [, plugin] of PluginService.#handlers) {
2549
- if (hook in plugin) {
2550
- result = await plugin[hook].call(context, result);
2551
- }
2552
- }
2553
- return result;
2554
- }
2555
- static removeHandlers() {
2556
- PluginService.#handlers.clear();
2557
- }
2558
- }
2559
-
2560
2528
  class BaseReporter {
2561
2529
  resolvedConfig;
2562
2530
  constructor(resolvedConfig) {
@@ -5881,10 +5849,6 @@ class FileRunner {
5881
5849
  return { runModeFlags, testTree, program };
5882
5850
  }
5883
5851
  async #run(file, fileResult, cancellationToken) {
5884
- if (!existsSync(file.path)) {
5885
- this.#onDiagnostics([Diagnostic.error(`Test file '${file.path}' does not exist.`)], fileResult);
5886
- return;
5887
- }
5888
5852
  const facts = await this.#resolveFileFacts(file, fileResult, 0);
5889
5853
  if (!facts) {
5890
5854
  return;
@@ -5908,7 +5872,7 @@ class FileRunner {
5908
5872
  class Runner {
5909
5873
  #eventEmitter = new EventEmitter();
5910
5874
  #resolvedConfig;
5911
- static version = "6.0.0-beta.2";
5875
+ static version = "6.0.0-beta.3";
5912
5876
  constructor(resolvedConfig) {
5913
5877
  this.#resolvedConfig = resolvedConfig;
5914
5878
  }
@@ -6033,7 +5997,7 @@ class Cli {
6033
5997
  this.#eventEmitter.addReporter(setupReporter);
6034
5998
  }
6035
5999
  const { configFileOptions, configFilePath } = await Config.parseConfigFile(commandLineOptions.config);
6036
- let resolvedConfig = Config.resolve({
6000
+ const resolvedConfig = Config.resolve({
6037
6001
  configFileOptions,
6038
6002
  configFilePath,
6039
6003
  commandLineOptions,
@@ -6045,11 +6009,6 @@ class Cli {
6045
6009
  }
6046
6010
  continue;
6047
6011
  }
6048
- for (const pluginSpecifier of resolvedConfig.plugins) {
6049
- const plugin = (await import(pluginSpecifier)).default;
6050
- PluginService.addHandler(plugin);
6051
- }
6052
- resolvedConfig = await PluginService.call("config", resolvedConfig, {});
6053
6012
  if (commandLine.includes("--showConfig")) {
6054
6013
  OutputService.writeMessage(formattedText({ ...resolvedConfig, ...environmentOptions }));
6055
6014
  continue;
@@ -6070,7 +6029,6 @@ class Cli {
6070
6029
  continue;
6071
6030
  }
6072
6031
  }
6073
- testFiles = await PluginService.call("select", testFiles, { resolvedConfig });
6074
6032
  if (commandLine.includes("--listFiles")) {
6075
6033
  OutputService.writeMessage(formattedText(testFiles.map((testFile) => testFile.toString())));
6076
6034
  continue;
@@ -6079,7 +6037,6 @@ class Cli {
6079
6037
  this.#eventEmitter.removeReporter(setupReporter);
6080
6038
  const runner = new Runner(resolvedConfig);
6081
6039
  await runner.run(testFiles, cancellationToken);
6082
- PluginService.removeHandlers();
6083
6040
  } while (cancellationToken.getReason() === "configChange");
6084
6041
  this.#eventEmitter.removeHandlers();
6085
6042
  }
@@ -6111,4 +6068,4 @@ class Cli {
6111
6068
  }
6112
6069
  }
6113
6070
 
6114
- export { BaseReporter, CancellationReason, CancellationToken, Cli, Color, Config, ConfigDiagnosticText, DescribeResult, Diagnostic, DiagnosticCategory, DiagnosticOrigin, Directive, EventEmitter, ExpectResult, FileLocation, FileResult, Line, ListReporter, OptionBrand, OptionGroup, Options, OutputService, Path, PluginService, ProjectResult, Result, ResultStatus, Runner, Scribbler, Select, SelectDiagnosticText, SetupReporter, Store, SummaryReporter, SuppressedResult, TargetResult, TestResult, Text, Version, WatchReporter, addsPackageText, defaultOptions, describeNameText, diagnosticBelongsToNode, diagnosticText, environmentOptions, fileStatusText, fileViewText, formattedText, getDiagnosticMessageText, getTextSpanEnd, helpText, isDiagnosticWithLocation, prologueText, summaryText, testNameText, usesCompilerText, waitingForFileChangesText, watchUsageText };
6071
+ export { BaseReporter, CancellationReason, CancellationToken, Cli, Color, Config, ConfigDiagnosticText, DescribeResult, Diagnostic, DiagnosticCategory, DiagnosticOrigin, Directive, EventEmitter, ExpectResult, FileLocation, FileResult, Line, ListReporter, OptionBrand, OptionGroup, Options, OutputService, Path, ProjectResult, Result, ResultStatus, Runner, Scribbler, Select, SelectDiagnosticText, SetupReporter, Store, SummaryReporter, SuppressedResult, TargetResult, TestResult, Text, Version, WatchReporter, addsPackageText, defaultOptions, describeNameText, diagnosticBelongsToNode, diagnosticText, environmentOptions, fileStatusText, fileViewText, formattedText, getDiagnosticMessageText, getTextSpanEnd, helpText, isDiagnosticWithLocation, prologueText, summaryText, testNameText, usesCompilerText, waitingForFileChangesText, watchUsageText };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tstyche",
3
- "version": "6.0.0-beta.2",
3
+ "version": "6.0.0-beta.3",
4
4
  "description": "Everything You Need for Type Testing.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -21,16 +21,12 @@
21
21
  "license": "MIT",
22
22
  "type": "module",
23
23
  "exports": {
24
- ".": {
25
- "import": "./build/index.js",
26
- "require": "./build/index.cjs"
27
- },
28
- "./package.json": "./package.json",
29
- "./tstyche": "./build/tstyche.js"
24
+ ".": "./dist/index.js",
25
+ "./tstyche": "./dist/tstyche.js",
26
+ "./package.json": "./package.json"
30
27
  },
31
- "main": "./build/index.js",
32
- "types": "./build/index.d.ts",
33
- "bin": "./build/bin.js",
28
+ "main": "./dist/index.js",
29
+ "bin": "./dist/bin.js",
34
30
  "peerDependencies": {
35
31
  "typescript": ">=5.4"
36
32
  },
@@ -40,6 +36,6 @@
40
36
  }
41
37
  },
42
38
  "engines": {
43
- "node": ">=20.12"
39
+ "node": ">=22.12"
44
40
  }
45
41
  }
package/build/index.cjs DELETED
@@ -1,20 +0,0 @@
1
- 'use strict';
2
-
3
- function noop() {
4
- }
5
- const noopChain = new Proxy(noop, {
6
- apply() {
7
- return noopChain;
8
- },
9
- get() {
10
- return noopChain;
11
- },
12
- });
13
-
14
- exports.describe = noopChain;
15
- exports.expect = noopChain;
16
- exports.it = noopChain;
17
- exports.omit = noop;
18
- exports.pick = noop;
19
- exports.test = noopChain;
20
- exports.when = noopChain;
package/build/index.d.cts DELETED
@@ -1,255 +0,0 @@
1
- interface Describe {
2
- /**
3
- * Defines a group of tests.
4
- *
5
- * @param name - The name of the group.
6
- * @param callback - The function to create a scope for a group of tests.
7
- */
8
- (name: string, callback: () => void | Promise<void>): void;
9
- /**
10
- * Marks a group of tests as focused.
11
- *
12
- * @param name - The name of the group.
13
- * @param callback - The function to create a scope for a group of tests.
14
- */
15
- only: (name: string, callback: () => void | Promise<void>) => void;
16
- /**
17
- * Marks a group of tests as skipped.
18
- *
19
- * @param name - The name of the group.
20
- * @param callback - The function to create a scope for a group of tests.
21
- */
22
- skip: (name: string, callback: () => void | Promise<void>) => void;
23
- /**
24
- * Marks a group of tests as yet to be implemented.
25
- *
26
- * @param name - The name of the group.
27
- * @param callback - The function to create a scope for a group of tests.
28
- */
29
- todo: (name: string, callback?: () => void | Promise<void>) => void;
30
- }
31
- interface Test {
32
- /**
33
- * Defines a single test.
34
- *
35
- * @param name - The name of the test.
36
- * @param callback - The function with a code snippet and assertions.
37
- */
38
- (name: string, callback: () => void | Promise<void>): void;
39
- /**
40
- * Marks a test as focused.
41
- *
42
- * @param name - The name of the test.
43
- * @param callback - The function with a code snippet and assertions.
44
- */
45
- only: (name: string, callback: () => void | Promise<void>) => void;
46
- /**
47
- * Marks a test as skipped.
48
- *
49
- * @param name - The name of the test.
50
- * @param callback - The function with a code snippet and assertions.
51
- */
52
- skip: (name: string, callback: () => void | Promise<void>) => void;
53
- /**
54
- * Marks a test as yet to be implemented.
55
- *
56
- * @param name - The name of the test.
57
- * @param callback - The function with a code snippet and assertions.
58
- */
59
- todo: (name: string, callback?: () => void | Promise<void>) => void;
60
- }
61
- interface Matchers {
62
- /**
63
- * Checks if the JSX component accepts props of the given type.
64
- *
65
- * @remarks
66
- *
67
- * This is a work in progress feature. Generic components are not yet supported.
68
- */
69
- toAcceptProps: {
70
- /**
71
- * Checks if the JSX component accepts props of the given type.
72
- *
73
- * @remarks
74
- *
75
- * This is a work in progress feature. Generic components are not yet supported.
76
- */
77
- <Target>(): void;
78
- /**
79
- * Checks if the JSX component accepts the given props.
80
- *
81
- * @remarks
82
- *
83
- * This is a work in progress feature. Generic components are not yet supported.
84
- */
85
- (target: unknown): void;
86
- };
87
- /**
88
- * Checks if the source type is the same as the target type.
89
- */
90
- toBe: {
91
- /**
92
- * Checks if the source type is the same as the target type.
93
- */
94
- <Target>(): void;
95
- /**
96
- * Checks if the source type is the same as type of the target expression.
97
- */
98
- (target: unknown): void;
99
- };
100
- /**
101
- * Checks if the decorator function can be applied.
102
- */
103
- toBeApplicable: (target: unknown, context: DecoratorContext) => void;
104
- /**
105
- * Checks if the source type is assignable from the target type.
106
- */
107
- toBeAssignableFrom: {
108
- /**
109
- * Checks if the source type is assignable from the target type.
110
- */
111
- <Target>(): void;
112
- /**
113
- * Checks if the source type is assignable from type of the target expression.
114
- */
115
- (target: unknown): void;
116
- };
117
- /**
118
- * Checks if the source type is assignable to the target type.
119
- */
120
- toBeAssignableTo: {
121
- /**
122
- * Checks if the source type is assignable to the target type.
123
- */
124
- <Target>(): void;
125
- /**
126
- * Checks if the source type is assignable to type of the target expression.
127
- */
128
- (target: unknown): void;
129
- };
130
- /**
131
- * Checks if the source type is callable with the given arguments.
132
- */
133
- toBeCallableWith: (...args: Array<unknown>) => void;
134
- /**
135
- * Checks if the source type is constructable with the given arguments.
136
- */
137
- toBeConstructableWith: (...args: Array<unknown>) => void;
138
- /**
139
- * Checks if a property key exists on the source type.
140
- */
141
- toHaveProperty: (key: string | number | symbol) => void;
142
- /**
143
- * Checks if the source type raises an error.
144
- */
145
- toRaiseError: (...target: Array<string | number | RegExp>) => void;
146
- }
147
- interface Modifier {
148
- /**
149
- * Indicates a type-level assertion.
150
- */
151
- type: Matchers & {
152
- /**
153
- * Negates the assertion.
154
- */
155
- not: Matchers;
156
- };
157
- }
158
- interface Expect {
159
- /**
160
- * Builds an assertion.
161
- *
162
- * @template Source - The type which is checked.
163
- */
164
- <Source>(): Modifier;
165
- /**
166
- * Builds an assertion.
167
- *
168
- * @param source - The expression whose type is checked.
169
- */
170
- (source: unknown): Modifier;
171
- /**
172
- * Marks an assertion as focused.
173
- */
174
- only: {
175
- /**
176
- * Marks an assertion as focused.
177
- *
178
- * @template Source - The type which is checked.
179
- */
180
- <Source>(): Modifier;
181
- /**
182
- * Marks an assertion as focused.
183
- *
184
- * @param source - The expression whose type is checked.
185
- */
186
- (source: unknown): Modifier;
187
- };
188
- /**
189
- * Marks an assertion as skipped.
190
- */
191
- skip: {
192
- /**
193
- * Marks an assertion as skipped.
194
- *
195
- * @template Source - The type which is checked.
196
- */
197
- <Source>(): Modifier;
198
- /**
199
- * Marks an assertion as skipped.
200
- *
201
- * @param source - The expression whose type is checked.
202
- */
203
- (source: unknown): Modifier;
204
- };
205
- }
206
- /**
207
- * Builds an assertion.
208
- */
209
- declare const expect: Expect;
210
- /**
211
- * Reshapes type of the given object by removing the specified keys.
212
- */
213
- declare function omit<T, K extends PropertyKey>(object: T, ...keys: [K, ...Array<K>]): Omit<T, K>;
214
- /**
215
- * Reshapes type of the given object by keeping only the specified keys.
216
- */
217
- declare function pick<T, K extends keyof T>(object: T, ...keys: [K, ...Array<K>]): Pick<T, K>;
218
- /**
219
- * Defines a test group.
220
- */
221
- declare const describe: Describe;
222
- /**
223
- * Defines a single test.
224
- */
225
- declare const it: Test;
226
- /**
227
- * Defines a single test.
228
- */
229
- declare const test: Test;
230
- interface Actions {
231
- /**
232
- * Calls the given function with the provided arguments.
233
- */
234
- isCalledWith: (...args: Array<unknown>) => void;
235
- }
236
- interface When {
237
- /**
238
- * Creates a test plan.
239
- *
240
- * @template Target - The type upon which an action is performed.
241
- */
242
- <Target>(): Actions;
243
- /**
244
- * Creates a test plan.
245
- *
246
- * @param target - The expression upon which an action is performed.
247
- */
248
- (target: unknown): Actions;
249
- }
250
- /**
251
- * Creates a test plan.
252
- */
253
- declare const when: When;
254
-
255
- export { describe, expect, it, omit, pick, test, when };
File without changes
File without changes
File without changes