tstyche 5.0.0-beta.2 → 5.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/index.d.cts +1 -1
- package/build/index.d.ts +1 -1
- package/build/tstyche.d.ts +3 -1
- package/build/tstyche.js +83 -57
- package/package.json +2 -13
- package/build/4.x/index.d.cts +0 -251
- package/build/4.x/index.d.ts +0 -251
package/build/index.d.cts
CHANGED
package/build/index.d.ts
CHANGED
package/build/tstyche.d.ts
CHANGED
|
@@ -615,6 +615,8 @@ declare class OutputService {
|
|
|
615
615
|
static writeWarning(element: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
|
|
616
616
|
}
|
|
617
617
|
|
|
618
|
+
declare function prologueText(runnerVersion: string, rootPath: string): ScribblerJsx.Element;
|
|
619
|
+
|
|
618
620
|
interface SummaryTextOptions {
|
|
619
621
|
targetCounts: ResultCounts;
|
|
620
622
|
fileCounts: ResultCounts;
|
|
@@ -731,5 +733,5 @@ declare class Version {
|
|
|
731
733
|
static isSatisfiedWith(source: string, target: string): boolean;
|
|
732
734
|
}
|
|
733
735
|
|
|
734
|
-
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, summaryText, testNameText, usesCompilerText, waitingForFileChangesText, watchUsageText };
|
|
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 };
|
|
735
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 };
|
package/build/tstyche.js
CHANGED
|
@@ -731,7 +731,7 @@ class ManifestService {
|
|
|
731
731
|
const versions = [];
|
|
732
732
|
const packageMetadata = (await response.json());
|
|
733
733
|
for (const [tag, meta] of Object.entries(packageMetadata.versions)) {
|
|
734
|
-
if (!tag.includes("-") && Version.isSatisfiedWith(tag, "
|
|
734
|
+
if (!tag.includes("-") && Version.isSatisfiedWith(tag, "5.0.2")) {
|
|
735
735
|
versions.push(tag);
|
|
736
736
|
packages[tag] = { integrity: meta.dist.integrity, tarball: meta.dist.tarball };
|
|
737
737
|
}
|
|
@@ -858,9 +858,6 @@ class PackageService {
|
|
|
858
858
|
const stream = response.body.pipeThrough(new DecompressionStream("gzip"));
|
|
859
859
|
const tarReader = new TarReader(stream);
|
|
860
860
|
for await (const file of tarReader.extract()) {
|
|
861
|
-
if (!file.name.startsWith("package/")) {
|
|
862
|
-
continue;
|
|
863
|
-
}
|
|
864
861
|
const filePath = Path.join(targetPath, file.name.replace(/^package\//, ""));
|
|
865
862
|
const directoryPath = Path.dirname(filePath);
|
|
866
863
|
if (!existsSync(directoryPath)) {
|
|
@@ -968,7 +965,7 @@ class Store {
|
|
|
968
965
|
modulePath = Path.resolve(modulePath, "../tsserverlibrary.js");
|
|
969
966
|
}
|
|
970
967
|
const sourceText = await fs.readFile(modulePath, { encoding: "utf8" });
|
|
971
|
-
const toExpose = ["
|
|
968
|
+
const toExpose = ["isTypeIdenticalTo"];
|
|
972
969
|
const modifiedSourceText = sourceText.replace("return checker;", `return { ...checker, ${toExpose.join(", ")} };`);
|
|
973
970
|
const compiledWrapper = vm.compileFunction(modifiedSourceText, ["exports", "require", "module", "__filename", "__dirname"], { filename: modulePath });
|
|
974
971
|
compiledWrapper(exports, createRequire(modulePath), module, modulePath, Path.dirname(modulePath));
|
|
@@ -2491,6 +2488,10 @@ class OutputService {
|
|
|
2491
2488
|
}
|
|
2492
2489
|
}
|
|
2493
2490
|
|
|
2491
|
+
function prologueText(runnerVersion, rootPath) {
|
|
2492
|
+
return (jsx(Text, { children: [jsx(Line, { children: [jsx(Text, { color: "90", children: "····" }), " TSTyche ", runnerVersion, jsx(Text, { color: "90", children: [" at ", rootPath] })] }), jsx(Line, {})] }));
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2494
2495
|
function RowText({ label, text }) {
|
|
2495
2496
|
return (jsx(Line, { children: [`${label}:`.padEnd(12), text] }));
|
|
2496
2497
|
}
|
|
@@ -3305,6 +3306,7 @@ class AbilityLayer {
|
|
|
3305
3306
|
const expectExpressionEnd = expect.node.expression.getEnd();
|
|
3306
3307
|
const expectEnd = expect.node.getEnd();
|
|
3307
3308
|
const matcherNameEnd = expect.matcherNameNode.getEnd();
|
|
3309
|
+
const matcherNodeEnd = expect.matcherNode.getEnd();
|
|
3308
3310
|
switch (expect.matcherNameNode.name.text) {
|
|
3309
3311
|
case "toBeApplicable":
|
|
3310
3312
|
this.#nodes.push(expect);
|
|
@@ -3344,18 +3346,71 @@ class AbilityLayer {
|
|
|
3344
3346
|
}
|
|
3345
3347
|
break;
|
|
3346
3348
|
}
|
|
3347
|
-
case "toBeConstructableWith":
|
|
3349
|
+
case "toBeConstructableWith": {
|
|
3348
3350
|
this.#nodes.push(expect);
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3351
|
+
const sourceNode = expect.source[0];
|
|
3352
|
+
if (!sourceNode) {
|
|
3353
|
+
return;
|
|
3354
|
+
}
|
|
3355
|
+
if (nodeBelongsToArgumentList(this.#compiler, sourceNode)) {
|
|
3356
|
+
this.#editor.eraseTrailingComma(expect.source);
|
|
3357
|
+
this.#editor.replaceRanges([
|
|
3358
|
+
[
|
|
3359
|
+
expectStart,
|
|
3360
|
+
expectExpressionEnd,
|
|
3361
|
+
nodeIsChildOfExpressionStatement(this.#compiler, expect.matcherNode) ? "; new" : "new",
|
|
3362
|
+
],
|
|
3363
|
+
[expectEnd, matcherNameEnd],
|
|
3364
|
+
]);
|
|
3365
|
+
}
|
|
3366
|
+
else {
|
|
3367
|
+
const sourceText = sourceNode.getFullText();
|
|
3368
|
+
this.#editor.replaceRanges([
|
|
3369
|
+
[
|
|
3370
|
+
expectStart,
|
|
3371
|
+
matcherNameEnd,
|
|
3372
|
+
nodeIsChildOfExpressionStatement(this.#compiler, expect.matcherNode)
|
|
3373
|
+
? `;new (undefined as any as ${sourceText})`
|
|
3374
|
+
: `new (undefined as any as ${sourceText})`,
|
|
3375
|
+
],
|
|
3376
|
+
]);
|
|
3377
|
+
}
|
|
3378
|
+
break;
|
|
3379
|
+
}
|
|
3380
|
+
case "toHaveProperty": {
|
|
3381
|
+
this.#nodes.push(expect);
|
|
3382
|
+
const sourceNode = expect.source[0];
|
|
3383
|
+
const targetNode = expect.target?.[0];
|
|
3384
|
+
if (!sourceNode || !targetNode) {
|
|
3385
|
+
return;
|
|
3386
|
+
}
|
|
3387
|
+
const sourceText = sourceNode.getFullText();
|
|
3388
|
+
const targetText = targetNode.getFullText();
|
|
3389
|
+
if (nodeBelongsToArgumentList(this.#compiler, sourceNode)) {
|
|
3390
|
+
this.#editor.eraseTrailingComma(expect.source);
|
|
3391
|
+
this.#editor.replaceRanges([
|
|
3392
|
+
[
|
|
3393
|
+
expectStart,
|
|
3394
|
+
matcherNodeEnd,
|
|
3395
|
+
nodeIsChildOfExpressionStatement(this.#compiler, expect.matcherNode)
|
|
3396
|
+
? `;(${sourceText})[${targetText}]`
|
|
3397
|
+
: `(${sourceText})[${targetText}]`,
|
|
3398
|
+
],
|
|
3399
|
+
]);
|
|
3400
|
+
}
|
|
3401
|
+
else {
|
|
3402
|
+
this.#editor.replaceRanges([
|
|
3403
|
+
[
|
|
3404
|
+
expectStart,
|
|
3405
|
+
matcherNodeEnd,
|
|
3406
|
+
nodeIsChildOfExpressionStatement(this.#compiler, expect.matcherNode)
|
|
3407
|
+
? `;(undefined as any as ${sourceText})[${targetText}]`
|
|
3408
|
+
: `(undefined as any as ${sourceText})[${targetText}]`,
|
|
3409
|
+
],
|
|
3410
|
+
]);
|
|
3411
|
+
}
|
|
3358
3412
|
break;
|
|
3413
|
+
}
|
|
3359
3414
|
}
|
|
3360
3415
|
}
|
|
3361
3416
|
visitWhen(when) {
|
|
@@ -3987,6 +4042,7 @@ class ProjectService {
|
|
|
3987
4042
|
}
|
|
3988
4043
|
#getDefaultCompilerOptions() {
|
|
3989
4044
|
const defaultCompilerOptions = {
|
|
4045
|
+
allowImportingTsExtensions: true,
|
|
3990
4046
|
exactOptionalPropertyTypes: true,
|
|
3991
4047
|
jsx: this.#compiler.JsxEmit.Preserve,
|
|
3992
4048
|
module: this.#compiler.ModuleKind.NodeNext,
|
|
@@ -3994,12 +4050,9 @@ class ProjectService {
|
|
|
3994
4050
|
noUncheckedIndexedAccess: true,
|
|
3995
4051
|
resolveJsonModule: true,
|
|
3996
4052
|
strict: true,
|
|
4053
|
+
verbatimModuleSyntax: true,
|
|
3997
4054
|
target: this.#compiler.ScriptTarget.ESNext,
|
|
3998
4055
|
};
|
|
3999
|
-
if (Version.isSatisfiedWith(this.#compiler.version, "5.0")) {
|
|
4000
|
-
defaultCompilerOptions.allowImportingTsExtensions = true;
|
|
4001
|
-
defaultCompilerOptions.verbatimModuleSyntax = true;
|
|
4002
|
-
}
|
|
4003
4056
|
if (Version.isSatisfiedWith(this.#compiler.version, "5.6")) {
|
|
4004
4057
|
defaultCompilerOptions.noUncheckedSideEffectImports = true;
|
|
4005
4058
|
}
|
|
@@ -4303,19 +4356,6 @@ class MatchWorker {
|
|
|
4303
4356
|
this.typeChecker = typeChecker;
|
|
4304
4357
|
this.assertionNode = assertionNode;
|
|
4305
4358
|
}
|
|
4306
|
-
checkHasApplicableIndexType(sourceNode, targetNode) {
|
|
4307
|
-
const sourceType = this.getType(sourceNode);
|
|
4308
|
-
const targetType = this.getType(targetNode);
|
|
4309
|
-
return this.typeChecker
|
|
4310
|
-
.getIndexInfosOfType(sourceType)
|
|
4311
|
-
.some(({ keyType }) => this.typeChecker.isApplicableIndexType(targetType, keyType));
|
|
4312
|
-
}
|
|
4313
|
-
checkHasProperty(sourceNode, propertyNameText) {
|
|
4314
|
-
const sourceType = this.getType(sourceNode);
|
|
4315
|
-
return sourceType
|
|
4316
|
-
.getProperties()
|
|
4317
|
-
.some((property) => this.#compiler.unescapeLeadingUnderscores(property.escapedName) === propertyNameText);
|
|
4318
|
-
}
|
|
4319
4359
|
checkIsAssignableTo(sourceNode, targetNode) {
|
|
4320
4360
|
return this.#checkIsRelatedTo(sourceNode, targetNode, "assignable");
|
|
4321
4361
|
}
|
|
@@ -4771,16 +4811,8 @@ class ToBeConstructableWith extends AbilityMatcherBase {
|
|
|
4771
4811
|
explainText = ExpectDiagnosticText.isConstructable;
|
|
4772
4812
|
explainNotText = ExpectDiagnosticText.isNotConstructable;
|
|
4773
4813
|
match(matchWorker, sourceNode, targetNodes, onDiagnostics) {
|
|
4774
|
-
|
|
4775
|
-
if (
|
|
4776
|
-
type = matchWorker.typeChecker.getResolvedSignature(sourceNode)?.getReturnType();
|
|
4777
|
-
}
|
|
4778
|
-
if (this.compiler.isExpressionWithTypeArguments(sourceNode) ||
|
|
4779
|
-
this.compiler.isIdentifier(sourceNode) ||
|
|
4780
|
-
this.compiler.isPropertyAccessExpression(sourceNode)) {
|
|
4781
|
-
type = matchWorker.getType(sourceNode);
|
|
4782
|
-
}
|
|
4783
|
-
if (!type || type.getConstructSignatures().length === 0) {
|
|
4814
|
+
const sourceType = matchWorker.getType(sourceNode);
|
|
4815
|
+
if (sourceType.getConstructSignatures().length === 0) {
|
|
4784
4816
|
const text = [];
|
|
4785
4817
|
if (nodeBelongsToArgumentList(this.compiler, sourceNode)) {
|
|
4786
4818
|
text.push(ExpectDiagnosticText.argumentMustBe("source", "a constructable expression"));
|
|
@@ -4788,7 +4820,7 @@ class ToBeConstructableWith extends AbilityMatcherBase {
|
|
|
4788
4820
|
else {
|
|
4789
4821
|
text.push(ExpectDiagnosticText.typeArgumentMustBe("Source", "a constructable type"));
|
|
4790
4822
|
}
|
|
4791
|
-
if (
|
|
4823
|
+
if (sourceType.getCallSignatures().length > 0) {
|
|
4792
4824
|
text.push(ExpectDiagnosticText.didYouMeanToUse("the '.toBeCallableWith()' matcher"));
|
|
4793
4825
|
}
|
|
4794
4826
|
const origin = DiagnosticOrigin.fromNode(sourceNode);
|
|
@@ -4835,14 +4867,7 @@ class ToHaveProperty {
|
|
|
4835
4867
|
diagnostics.push(Diagnostic.error(text, origin));
|
|
4836
4868
|
}
|
|
4837
4869
|
const targetType = matchWorker.getType(targetNode);
|
|
4838
|
-
|
|
4839
|
-
if (isStringOrNumberLiteralType(this.#compiler, targetType)) {
|
|
4840
|
-
propertyNameText = targetType.value.toString();
|
|
4841
|
-
}
|
|
4842
|
-
else if (isUniqueSymbolType(this.#compiler, targetType)) {
|
|
4843
|
-
propertyNameText = this.#compiler.unescapeLeadingUnderscores(targetType.escapedName);
|
|
4844
|
-
}
|
|
4845
|
-
else {
|
|
4870
|
+
if (!(isStringOrNumberLiteralType(this.#compiler, targetType) || isUniqueSymbolType(this.#compiler, targetType))) {
|
|
4846
4871
|
const expectedText = "of type 'string | number | symbol'";
|
|
4847
4872
|
const text = ExpectDiagnosticText.argumentMustBe("key", expectedText);
|
|
4848
4873
|
const origin = DiagnosticOrigin.fromNode(targetNode);
|
|
@@ -4852,11 +4877,9 @@ class ToHaveProperty {
|
|
|
4852
4877
|
onDiagnostics(diagnostics);
|
|
4853
4878
|
return;
|
|
4854
4879
|
}
|
|
4855
|
-
const isMatch = matchWorker.checkHasProperty(sourceNode, propertyNameText) ||
|
|
4856
|
-
matchWorker.checkHasApplicableIndexType(sourceNode, targetNode);
|
|
4857
4880
|
return {
|
|
4858
4881
|
explain: () => this.#explain(matchWorker, sourceNode, targetNode),
|
|
4859
|
-
isMatch,
|
|
4882
|
+
isMatch: matchWorker.assertionNode.abilityDiagnostics.size === 0,
|
|
4860
4883
|
};
|
|
4861
4884
|
}
|
|
4862
4885
|
}
|
|
@@ -5241,7 +5264,7 @@ class TestTreeWalker {
|
|
|
5241
5264
|
}
|
|
5242
5265
|
const fixmeDirective = Directive.getDirectiveRange(this.#compiler, node, "fixme");
|
|
5243
5266
|
if (fixmeDirective) {
|
|
5244
|
-
FixmeService.start(fixmeDirective, node);
|
|
5267
|
+
await FixmeService.start(fixmeDirective, node);
|
|
5245
5268
|
}
|
|
5246
5269
|
switch (node.brand) {
|
|
5247
5270
|
case "describe":
|
|
@@ -5454,7 +5477,7 @@ class FileRunner {
|
|
|
5454
5477
|
class Runner {
|
|
5455
5478
|
#eventEmitter = new EventEmitter();
|
|
5456
5479
|
#resolvedConfig;
|
|
5457
|
-
static version = "5.0.0-beta.
|
|
5480
|
+
static version = "5.0.0-beta.4";
|
|
5458
5481
|
constructor(resolvedConfig) {
|
|
5459
5482
|
this.#resolvedConfig = resolvedConfig;
|
|
5460
5483
|
}
|
|
@@ -5492,6 +5515,9 @@ class Runner {
|
|
|
5492
5515
|
}
|
|
5493
5516
|
}
|
|
5494
5517
|
async run(files, cancellationToken = new CancellationToken()) {
|
|
5518
|
+
if (!this.#resolvedConfig.watch) {
|
|
5519
|
+
OutputService.writeMessage(prologueText(Runner.version, this.#resolvedConfig.rootPath));
|
|
5520
|
+
}
|
|
5495
5521
|
const fileLocations = files.map((file) => (file instanceof FileLocation ? file : new FileLocation(file)));
|
|
5496
5522
|
this.#addHandlers(cancellationToken);
|
|
5497
5523
|
await this.#addReporters();
|
|
@@ -5654,4 +5680,4 @@ class Cli {
|
|
|
5654
5680
|
}
|
|
5655
5681
|
}
|
|
5656
5682
|
|
|
5657
|
-
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, summaryText, testNameText, usesCompilerText, waitingForFileChangesText, watchUsageText };
|
|
5683
|
+
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tstyche",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.4",
|
|
4
4
|
"description": "Everything You Need for Type Testing.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -22,10 +22,6 @@
|
|
|
22
22
|
"type": "module",
|
|
23
23
|
"exports": {
|
|
24
24
|
".": {
|
|
25
|
-
"types@4.x": {
|
|
26
|
-
"import": "./build/4.x/index.d.ts",
|
|
27
|
-
"require": "./build/4.x/index.d.cts"
|
|
28
|
-
},
|
|
29
25
|
"import": "./build/index.js",
|
|
30
26
|
"require": "./build/index.cjs"
|
|
31
27
|
},
|
|
@@ -34,16 +30,9 @@
|
|
|
34
30
|
},
|
|
35
31
|
"main": "./build/index.js",
|
|
36
32
|
"types": "./build/index.d.ts",
|
|
37
|
-
"typesVersions": {
|
|
38
|
-
"4.x": {
|
|
39
|
-
"build/*": [
|
|
40
|
-
"./build/4.x/*"
|
|
41
|
-
]
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
33
|
"bin": "./build/bin.js",
|
|
45
34
|
"peerDependencies": {
|
|
46
|
-
"typescript": ">=
|
|
35
|
+
"typescript": ">=5.0"
|
|
47
36
|
},
|
|
48
37
|
"peerDependenciesMeta": {
|
|
49
38
|
"typescript": {
|
package/build/4.x/index.d.cts
DELETED
|
@@ -1,251 +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 source type is assignable from the target type.
|
|
102
|
-
*/
|
|
103
|
-
toBeAssignableFrom: {
|
|
104
|
-
/**
|
|
105
|
-
* Checks if the source type is assignable from the target type.
|
|
106
|
-
*/
|
|
107
|
-
<Target>(): void;
|
|
108
|
-
/**
|
|
109
|
-
* Checks if the source type is assignable from type of the target expression.
|
|
110
|
-
*/
|
|
111
|
-
(target: unknown): void;
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* Checks if the source type is assignable to the target type.
|
|
115
|
-
*/
|
|
116
|
-
toBeAssignableTo: {
|
|
117
|
-
/**
|
|
118
|
-
* Checks if the source type is assignable to the target type.
|
|
119
|
-
*/
|
|
120
|
-
<Target>(): void;
|
|
121
|
-
/**
|
|
122
|
-
* Checks if the source type is assignable to type of the target expression.
|
|
123
|
-
*/
|
|
124
|
-
(target: unknown): void;
|
|
125
|
-
};
|
|
126
|
-
/**
|
|
127
|
-
* Checks if the source type is callable with the given arguments.
|
|
128
|
-
*/
|
|
129
|
-
toBeCallableWith: (...args: Array<unknown>) => void;
|
|
130
|
-
/**
|
|
131
|
-
* Checks if the source type is constructable with the given arguments.
|
|
132
|
-
*/
|
|
133
|
-
toBeConstructableWith: (...args: Array<unknown>) => void;
|
|
134
|
-
/**
|
|
135
|
-
* Checks if a property key exists on the source type.
|
|
136
|
-
*/
|
|
137
|
-
toHaveProperty: (key: string | number | symbol) => void;
|
|
138
|
-
/**
|
|
139
|
-
* Checks if the source type raises an error.
|
|
140
|
-
*/
|
|
141
|
-
toRaiseError: (...target: Array<string | number | RegExp>) => void;
|
|
142
|
-
}
|
|
143
|
-
interface Modifier {
|
|
144
|
-
/**
|
|
145
|
-
* Passes the source type to the matcher.
|
|
146
|
-
*/
|
|
147
|
-
type: Matchers & {
|
|
148
|
-
/**
|
|
149
|
-
* Negates the assertion.
|
|
150
|
-
*/
|
|
151
|
-
not: Matchers;
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
interface Expect {
|
|
155
|
-
/**
|
|
156
|
-
* Builds an assertion.
|
|
157
|
-
*
|
|
158
|
-
* @template Source - The type which is checked.
|
|
159
|
-
*/
|
|
160
|
-
<Source>(): Modifier;
|
|
161
|
-
/**
|
|
162
|
-
* Builds an assertion.
|
|
163
|
-
*
|
|
164
|
-
* @param source - The expression whose type is checked.
|
|
165
|
-
*/
|
|
166
|
-
(source: unknown): Modifier;
|
|
167
|
-
/**
|
|
168
|
-
* Marks an assertion as focused.
|
|
169
|
-
*/
|
|
170
|
-
only: {
|
|
171
|
-
/**
|
|
172
|
-
* Marks an assertion as focused.
|
|
173
|
-
*
|
|
174
|
-
* @template Source - The type which is checked.
|
|
175
|
-
*/
|
|
176
|
-
<Source>(): Modifier;
|
|
177
|
-
/**
|
|
178
|
-
* Marks an assertion as focused.
|
|
179
|
-
*
|
|
180
|
-
* @param source - The expression whose type is checked.
|
|
181
|
-
*/
|
|
182
|
-
(source: unknown): Modifier;
|
|
183
|
-
};
|
|
184
|
-
/**
|
|
185
|
-
* Marks an assertion as skipped.
|
|
186
|
-
*/
|
|
187
|
-
skip: {
|
|
188
|
-
/**
|
|
189
|
-
* Marks an assertion as skipped.
|
|
190
|
-
*
|
|
191
|
-
* @template Source - The type which is checked.
|
|
192
|
-
*/
|
|
193
|
-
<Source>(): Modifier;
|
|
194
|
-
/**
|
|
195
|
-
* Marks an assertion as skipped.
|
|
196
|
-
*
|
|
197
|
-
* @param source - The expression whose type is checked.
|
|
198
|
-
*/
|
|
199
|
-
(source: unknown): Modifier;
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Builds an assertion.
|
|
204
|
-
*/
|
|
205
|
-
declare const expect: Expect;
|
|
206
|
-
/**
|
|
207
|
-
* Reshapes type of the given object by removing the specified keys.
|
|
208
|
-
*/
|
|
209
|
-
declare function omit<T, K extends PropertyKey>(object: T, ...keys: [K, ...Array<K>]): Omit<T, K>;
|
|
210
|
-
/**
|
|
211
|
-
* Reshapes type of the given object by keeping only the specified keys.
|
|
212
|
-
*/
|
|
213
|
-
declare function pick<T, K extends keyof T>(object: T, ...keys: [K, ...Array<K>]): Pick<T, K>;
|
|
214
|
-
/**
|
|
215
|
-
* Defines a test group.
|
|
216
|
-
*/
|
|
217
|
-
declare const describe: Describe;
|
|
218
|
-
/**
|
|
219
|
-
* Defines a single test.
|
|
220
|
-
*/
|
|
221
|
-
declare const it: Test;
|
|
222
|
-
/**
|
|
223
|
-
* Defines a single test.
|
|
224
|
-
*/
|
|
225
|
-
declare const test: Test;
|
|
226
|
-
interface Actions {
|
|
227
|
-
/**
|
|
228
|
-
* Calls the given function with the provided arguments.
|
|
229
|
-
*/
|
|
230
|
-
isCalledWith: (...args: Array<unknown>) => void;
|
|
231
|
-
}
|
|
232
|
-
interface When {
|
|
233
|
-
/**
|
|
234
|
-
* Creates a test plan.
|
|
235
|
-
*
|
|
236
|
-
* @template Target - The type upon which an action is performed.
|
|
237
|
-
*/
|
|
238
|
-
<Target>(): Actions;
|
|
239
|
-
/**
|
|
240
|
-
* Creates a test plan.
|
|
241
|
-
*
|
|
242
|
-
* @param target - The expression upon which an action is performed.
|
|
243
|
-
*/
|
|
244
|
-
(target: unknown): Actions;
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Creates a test plan.
|
|
248
|
-
*/
|
|
249
|
-
declare const when: When;
|
|
250
|
-
|
|
251
|
-
export { describe, expect, it, omit, pick, test, when };
|
package/build/4.x/index.d.ts
DELETED
|
@@ -1,251 +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 source type is assignable from the target type.
|
|
102
|
-
*/
|
|
103
|
-
toBeAssignableFrom: {
|
|
104
|
-
/**
|
|
105
|
-
* Checks if the source type is assignable from the target type.
|
|
106
|
-
*/
|
|
107
|
-
<Target>(): void;
|
|
108
|
-
/**
|
|
109
|
-
* Checks if the source type is assignable from type of the target expression.
|
|
110
|
-
*/
|
|
111
|
-
(target: unknown): void;
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* Checks if the source type is assignable to the target type.
|
|
115
|
-
*/
|
|
116
|
-
toBeAssignableTo: {
|
|
117
|
-
/**
|
|
118
|
-
* Checks if the source type is assignable to the target type.
|
|
119
|
-
*/
|
|
120
|
-
<Target>(): void;
|
|
121
|
-
/**
|
|
122
|
-
* Checks if the source type is assignable to type of the target expression.
|
|
123
|
-
*/
|
|
124
|
-
(target: unknown): void;
|
|
125
|
-
};
|
|
126
|
-
/**
|
|
127
|
-
* Checks if the source type is callable with the given arguments.
|
|
128
|
-
*/
|
|
129
|
-
toBeCallableWith: (...args: Array<unknown>) => void;
|
|
130
|
-
/**
|
|
131
|
-
* Checks if the source type is constructable with the given arguments.
|
|
132
|
-
*/
|
|
133
|
-
toBeConstructableWith: (...args: Array<unknown>) => void;
|
|
134
|
-
/**
|
|
135
|
-
* Checks if a property key exists on the source type.
|
|
136
|
-
*/
|
|
137
|
-
toHaveProperty: (key: string | number | symbol) => void;
|
|
138
|
-
/**
|
|
139
|
-
* Checks if the source type raises an error.
|
|
140
|
-
*/
|
|
141
|
-
toRaiseError: (...target: Array<string | number | RegExp>) => void;
|
|
142
|
-
}
|
|
143
|
-
interface Modifier {
|
|
144
|
-
/**
|
|
145
|
-
* Passes the source type to the matcher.
|
|
146
|
-
*/
|
|
147
|
-
type: Matchers & {
|
|
148
|
-
/**
|
|
149
|
-
* Negates the assertion.
|
|
150
|
-
*/
|
|
151
|
-
not: Matchers;
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
interface Expect {
|
|
155
|
-
/**
|
|
156
|
-
* Builds an assertion.
|
|
157
|
-
*
|
|
158
|
-
* @template Source - The type which is checked.
|
|
159
|
-
*/
|
|
160
|
-
<Source>(): Modifier;
|
|
161
|
-
/**
|
|
162
|
-
* Builds an assertion.
|
|
163
|
-
*
|
|
164
|
-
* @param source - The expression whose type is checked.
|
|
165
|
-
*/
|
|
166
|
-
(source: unknown): Modifier;
|
|
167
|
-
/**
|
|
168
|
-
* Marks an assertion as focused.
|
|
169
|
-
*/
|
|
170
|
-
only: {
|
|
171
|
-
/**
|
|
172
|
-
* Marks an assertion as focused.
|
|
173
|
-
*
|
|
174
|
-
* @template Source - The type which is checked.
|
|
175
|
-
*/
|
|
176
|
-
<Source>(): Modifier;
|
|
177
|
-
/**
|
|
178
|
-
* Marks an assertion as focused.
|
|
179
|
-
*
|
|
180
|
-
* @param source - The expression whose type is checked.
|
|
181
|
-
*/
|
|
182
|
-
(source: unknown): Modifier;
|
|
183
|
-
};
|
|
184
|
-
/**
|
|
185
|
-
* Marks an assertion as skipped.
|
|
186
|
-
*/
|
|
187
|
-
skip: {
|
|
188
|
-
/**
|
|
189
|
-
* Marks an assertion as skipped.
|
|
190
|
-
*
|
|
191
|
-
* @template Source - The type which is checked.
|
|
192
|
-
*/
|
|
193
|
-
<Source>(): Modifier;
|
|
194
|
-
/**
|
|
195
|
-
* Marks an assertion as skipped.
|
|
196
|
-
*
|
|
197
|
-
* @param source - The expression whose type is checked.
|
|
198
|
-
*/
|
|
199
|
-
(source: unknown): Modifier;
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Builds an assertion.
|
|
204
|
-
*/
|
|
205
|
-
declare const expect: Expect;
|
|
206
|
-
/**
|
|
207
|
-
* Reshapes type of the given object by removing the specified keys.
|
|
208
|
-
*/
|
|
209
|
-
declare function omit<T, K extends PropertyKey>(object: T, ...keys: [K, ...Array<K>]): Omit<T, K>;
|
|
210
|
-
/**
|
|
211
|
-
* Reshapes type of the given object by keeping only the specified keys.
|
|
212
|
-
*/
|
|
213
|
-
declare function pick<T, K extends keyof T>(object: T, ...keys: [K, ...Array<K>]): Pick<T, K>;
|
|
214
|
-
/**
|
|
215
|
-
* Defines a test group.
|
|
216
|
-
*/
|
|
217
|
-
declare const describe: Describe;
|
|
218
|
-
/**
|
|
219
|
-
* Defines a single test.
|
|
220
|
-
*/
|
|
221
|
-
declare const it: Test;
|
|
222
|
-
/**
|
|
223
|
-
* Defines a single test.
|
|
224
|
-
*/
|
|
225
|
-
declare const test: Test;
|
|
226
|
-
interface Actions {
|
|
227
|
-
/**
|
|
228
|
-
* Calls the given function with the provided arguments.
|
|
229
|
-
*/
|
|
230
|
-
isCalledWith: (...args: Array<unknown>) => void;
|
|
231
|
-
}
|
|
232
|
-
interface When {
|
|
233
|
-
/**
|
|
234
|
-
* Creates a test plan.
|
|
235
|
-
*
|
|
236
|
-
* @template Target - The type upon which an action is performed.
|
|
237
|
-
*/
|
|
238
|
-
<Target>(): Actions;
|
|
239
|
-
/**
|
|
240
|
-
* Creates a test plan.
|
|
241
|
-
*
|
|
242
|
-
* @param target - The expression upon which an action is performed.
|
|
243
|
-
*/
|
|
244
|
-
(target: unknown): Actions;
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Creates a test plan.
|
|
248
|
-
*/
|
|
249
|
-
declare const when: When;
|
|
250
|
-
|
|
251
|
-
export { describe, expect, it, omit, pick, test, when };
|