tstyche 6.0.0-beta.2 → 6.0.0-beta.4
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/{build → dist}/tstyche.d.ts +2 -21
- package/{build → dist}/tstyche.js +23 -50
- package/package.json +9 -9
- /package/{build → dist}/bin.js +0 -0
- /package/{build → dist}/index.cjs +0 -0
- /package/{build → dist}/index.d.cts +0 -0
- /package/{build → dist}/index.d.ts +0 -0
- /package/{build → dist}/index.js +0 -0
|
@@ -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,
|
|
737
|
-
export type { AssertionCounts, AssertionResultStatus, CodeFrameOptions, CommandLineOptions, ConfigFileOptions, DiagnosticsHandler, DirectiveRange, EnvironmentOptions, Event, EventHandler, FileCounts, FileResultStatus, InlineConfig, ItemDefinition, OptionDefinition,
|
|
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) {
|
|
@@ -4788,6 +4756,12 @@ class Structure {
|
|
|
4788
4756
|
}
|
|
4789
4757
|
return false;
|
|
4790
4758
|
}
|
|
4759
|
+
if ((a.flags | b.flags) & this.#compiler.TypeFlags.TemplateLiteral) {
|
|
4760
|
+
if (a.flags & b.flags & this.#compiler.TypeFlags.TemplateLiteral) {
|
|
4761
|
+
return this.compareTemplateLiteralTypes(a, b);
|
|
4762
|
+
}
|
|
4763
|
+
return false;
|
|
4764
|
+
}
|
|
4791
4765
|
return false;
|
|
4792
4766
|
}
|
|
4793
4767
|
compareIntersections(a, b) {
|
|
@@ -5032,14 +5006,24 @@ class Structure {
|
|
|
5032
5006
|
}
|
|
5033
5007
|
return true;
|
|
5034
5008
|
}
|
|
5009
|
+
compareTemplateLiteralTypes(a, b) {
|
|
5010
|
+
if (a.texts.length !== b.texts.length) {
|
|
5011
|
+
return false;
|
|
5012
|
+
}
|
|
5013
|
+
for (let i = 0; i < a.texts.length; i++) {
|
|
5014
|
+
if (a.texts[i] !== b.texts[i]) {
|
|
5015
|
+
return false;
|
|
5016
|
+
}
|
|
5017
|
+
if (!this.#compareMaybeNullish(a.types[i], b.types[i])) {
|
|
5018
|
+
return false;
|
|
5019
|
+
}
|
|
5020
|
+
}
|
|
5021
|
+
return true;
|
|
5022
|
+
}
|
|
5035
5023
|
#normalize(type) {
|
|
5036
5024
|
if (type.flags & this.#compiler.TypeFlags.Freshable && type.freshType === type) {
|
|
5037
5025
|
return type.regularType;
|
|
5038
5026
|
}
|
|
5039
|
-
if (type.flags & this.#compiler.TypeFlags.Substitution &&
|
|
5040
|
-
type.constraint.flags & this.#compiler.TypeFlags.Unknown) {
|
|
5041
|
-
return type.baseType;
|
|
5042
|
-
}
|
|
5043
5027
|
if (type.flags & this.#compiler.TypeFlags.UnionOrIntersection) {
|
|
5044
5028
|
const candidateType = this.#normalize(type.types[0]);
|
|
5045
5029
|
if (type.types.every((t) => this.compare(this.#normalize(t), candidateType))) {
|
|
@@ -5881,10 +5865,6 @@ class FileRunner {
|
|
|
5881
5865
|
return { runModeFlags, testTree, program };
|
|
5882
5866
|
}
|
|
5883
5867
|
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
5868
|
const facts = await this.#resolveFileFacts(file, fileResult, 0);
|
|
5889
5869
|
if (!facts) {
|
|
5890
5870
|
return;
|
|
@@ -5908,7 +5888,7 @@ class FileRunner {
|
|
|
5908
5888
|
class Runner {
|
|
5909
5889
|
#eventEmitter = new EventEmitter();
|
|
5910
5890
|
#resolvedConfig;
|
|
5911
|
-
static version = "6.0.0-beta.
|
|
5891
|
+
static version = "6.0.0-beta.4";
|
|
5912
5892
|
constructor(resolvedConfig) {
|
|
5913
5893
|
this.#resolvedConfig = resolvedConfig;
|
|
5914
5894
|
}
|
|
@@ -6033,7 +6013,7 @@ class Cli {
|
|
|
6033
6013
|
this.#eventEmitter.addReporter(setupReporter);
|
|
6034
6014
|
}
|
|
6035
6015
|
const { configFileOptions, configFilePath } = await Config.parseConfigFile(commandLineOptions.config);
|
|
6036
|
-
|
|
6016
|
+
const resolvedConfig = Config.resolve({
|
|
6037
6017
|
configFileOptions,
|
|
6038
6018
|
configFilePath,
|
|
6039
6019
|
commandLineOptions,
|
|
@@ -6045,11 +6025,6 @@ class Cli {
|
|
|
6045
6025
|
}
|
|
6046
6026
|
continue;
|
|
6047
6027
|
}
|
|
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
6028
|
if (commandLine.includes("--showConfig")) {
|
|
6054
6029
|
OutputService.writeMessage(formattedText({ ...resolvedConfig, ...environmentOptions }));
|
|
6055
6030
|
continue;
|
|
@@ -6070,7 +6045,6 @@ class Cli {
|
|
|
6070
6045
|
continue;
|
|
6071
6046
|
}
|
|
6072
6047
|
}
|
|
6073
|
-
testFiles = await PluginService.call("select", testFiles, { resolvedConfig });
|
|
6074
6048
|
if (commandLine.includes("--listFiles")) {
|
|
6075
6049
|
OutputService.writeMessage(formattedText(testFiles.map((testFile) => testFile.toString())));
|
|
6076
6050
|
continue;
|
|
@@ -6079,7 +6053,6 @@ class Cli {
|
|
|
6079
6053
|
this.#eventEmitter.removeReporter(setupReporter);
|
|
6080
6054
|
const runner = new Runner(resolvedConfig);
|
|
6081
6055
|
await runner.run(testFiles, cancellationToken);
|
|
6082
|
-
PluginService.removeHandlers();
|
|
6083
6056
|
} while (cancellationToken.getReason() === "configChange");
|
|
6084
6057
|
this.#eventEmitter.removeHandlers();
|
|
6085
6058
|
}
|
|
@@ -6111,4 +6084,4 @@ class Cli {
|
|
|
6111
6084
|
}
|
|
6112
6085
|
}
|
|
6113
6086
|
|
|
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,
|
|
6087
|
+
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.
|
|
3
|
+
"version": "6.0.0-beta.4",
|
|
4
4
|
"description": "Everything You Need for Type Testing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
"type": "module",
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
25
|
-
"import": "./
|
|
26
|
-
"require": "./
|
|
25
|
+
"import": "./dist/index.js",
|
|
26
|
+
"require": "./dist/index.cjs"
|
|
27
27
|
},
|
|
28
|
-
"./
|
|
29
|
-
"./
|
|
28
|
+
"./tstyche": "./dist/tstyche.js",
|
|
29
|
+
"./package.json": "./package.json"
|
|
30
30
|
},
|
|
31
|
-
"main": "./
|
|
32
|
-
"types": "./
|
|
33
|
-
"bin": "./
|
|
31
|
+
"main": "./dist/index.js",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"bin": "./dist/bin.js",
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"typescript": ">=5.4"
|
|
36
36
|
},
|
|
@@ -40,6 +40,6 @@
|
|
|
40
40
|
}
|
|
41
41
|
},
|
|
42
42
|
"engines": {
|
|
43
|
-
"node": ">=
|
|
43
|
+
"node": ">=22.12"
|
|
44
44
|
}
|
|
45
45
|
}
|
/package/{build → dist}/bin.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{build → dist}/index.js
RENAMED
|
File without changes
|