tstyche 4.0.0-beta.0 → 4.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -7
- package/build/index.cjs +1 -0
- package/build/index.d.cts +40 -4
- package/build/index.d.ts +40 -4
- package/build/index.js +1 -1
- package/build/tstyche.d.ts +116 -97
- package/build/tstyche.js +1173 -651
- package/package.json +13 -11
package/README.md
CHANGED
|
@@ -18,14 +18,15 @@ If you are used to test JavaScript, a simple type test file should look familiar
|
|
|
18
18
|
```ts
|
|
19
19
|
import { expect, test } from "tstyche";
|
|
20
20
|
|
|
21
|
-
function
|
|
22
|
-
return
|
|
21
|
+
function isSameLength<T extends { length: number }>(a: T, b: T) {
|
|
22
|
+
return a.length === b.length;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
test("
|
|
26
|
-
expect(
|
|
25
|
+
test("isSameLength", () => {
|
|
26
|
+
expect(isSameLength([1, 2], [1, 2, 3])).type.toBe<boolean>();
|
|
27
|
+
expect(isSameLength("one", "two")).type.toBe<boolean>();
|
|
27
28
|
|
|
28
|
-
expect(
|
|
29
|
+
expect(isSameLength).type.not.toBeCallableWith(1, 2);
|
|
29
30
|
});
|
|
30
31
|
```
|
|
31
32
|
|
|
@@ -57,9 +58,12 @@ test("handles numbers", () => {
|
|
|
57
58
|
Here is the list of all matchers:
|
|
58
59
|
|
|
59
60
|
- `.toBe()`, `.toBeAssignableTo()`, `.toBeAssignableWith()` compare types or types of expression,
|
|
60
|
-
- `.toAcceptProps()` checks JSX component props
|
|
61
|
+
- `.toAcceptProps()` checks the type of JSX component props,
|
|
62
|
+
- `.toBeApplicable` ensures that the decorator function can be applied,
|
|
63
|
+
- `.toBeCallableWith()` checks whether a function is callable with the given arguments,
|
|
64
|
+
- `.toBeConstructableWith()` checks whether a class is constructable with the given arguments,
|
|
61
65
|
- `.toHaveProperty()` looks up keys on an object type,
|
|
62
|
-
- `.toRaiseError()` captures the
|
|
66
|
+
- `.toRaiseError()` captures the message or code of a type error.
|
|
63
67
|
|
|
64
68
|
## Runner
|
|
65
69
|
|
package/build/index.cjs
CHANGED
package/build/index.d.cts
CHANGED
|
@@ -85,18 +85,22 @@ interface Matchers {
|
|
|
85
85
|
(target: unknown): void;
|
|
86
86
|
};
|
|
87
87
|
/**
|
|
88
|
-
* Checks if the source type is
|
|
88
|
+
* Checks if the source type is the same as the target type.
|
|
89
89
|
*/
|
|
90
90
|
toBe: {
|
|
91
91
|
/**
|
|
92
|
-
* Checks if the source type is
|
|
92
|
+
* Checks if the source type is the same as the target type.
|
|
93
93
|
*/
|
|
94
94
|
<Target>(): void;
|
|
95
95
|
/**
|
|
96
|
-
* Checks if the source type is
|
|
96
|
+
* Checks if the source type is the same as type of the target expression.
|
|
97
97
|
*/
|
|
98
98
|
(target: unknown): void;
|
|
99
99
|
};
|
|
100
|
+
/**
|
|
101
|
+
* Checks if the decorator function can be applied.
|
|
102
|
+
*/
|
|
103
|
+
toBeApplicable: (target: unknown, context: DecoratorContext) => void;
|
|
100
104
|
/**
|
|
101
105
|
* Checks if the source type is assignable to the target type.
|
|
102
106
|
*/
|
|
@@ -123,6 +127,14 @@ interface Matchers {
|
|
|
123
127
|
*/
|
|
124
128
|
(target: unknown): void;
|
|
125
129
|
};
|
|
130
|
+
/**
|
|
131
|
+
* Checks if the source type is callable with the given arguments.
|
|
132
|
+
*/
|
|
133
|
+
toBeCallableWith: (...target: Array<unknown>) => void;
|
|
134
|
+
/**
|
|
135
|
+
* Checks if the source type is constructable with the given arguments.
|
|
136
|
+
*/
|
|
137
|
+
toBeConstructableWith: (...target: Array<unknown>) => void;
|
|
126
138
|
/**
|
|
127
139
|
* Checks if a property key exists on the source type.
|
|
128
140
|
*/
|
|
@@ -257,5 +269,29 @@ declare const test: Test;
|
|
|
257
269
|
* Defines a single test.
|
|
258
270
|
*/
|
|
259
271
|
declare const it: Test;
|
|
272
|
+
interface Actions {
|
|
273
|
+
/**
|
|
274
|
+
* Calls the given function with the provided arguments.
|
|
275
|
+
*/
|
|
276
|
+
isCalledWith: (...args: Array<unknown>) => void;
|
|
277
|
+
}
|
|
278
|
+
interface When {
|
|
279
|
+
/**
|
|
280
|
+
* Creates a test plan.
|
|
281
|
+
*
|
|
282
|
+
* @template Target - The type upon which an action is performed.
|
|
283
|
+
*/
|
|
284
|
+
<Target>(): Actions;
|
|
285
|
+
/**
|
|
286
|
+
* Creates a test plan.
|
|
287
|
+
*
|
|
288
|
+
* @param target - The expression upon which an action is performed.
|
|
289
|
+
*/
|
|
290
|
+
(target: unknown): Actions;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Creates a test plan.
|
|
294
|
+
*/
|
|
295
|
+
declare const when: When;
|
|
260
296
|
|
|
261
|
-
export { describe, expect, it, omit, pick, test };
|
|
297
|
+
export { describe, expect, it, omit, pick, test, when };
|
package/build/index.d.ts
CHANGED
|
@@ -85,18 +85,22 @@ interface Matchers {
|
|
|
85
85
|
(target: unknown): void;
|
|
86
86
|
};
|
|
87
87
|
/**
|
|
88
|
-
* Checks if the source type is
|
|
88
|
+
* Checks if the source type is the same as the target type.
|
|
89
89
|
*/
|
|
90
90
|
toBe: {
|
|
91
91
|
/**
|
|
92
|
-
* Checks if the source type is
|
|
92
|
+
* Checks if the source type is the same as the target type.
|
|
93
93
|
*/
|
|
94
94
|
<Target>(): void;
|
|
95
95
|
/**
|
|
96
|
-
* Checks if the source type is
|
|
96
|
+
* Checks if the source type is the same as type of the target expression.
|
|
97
97
|
*/
|
|
98
98
|
(target: unknown): void;
|
|
99
99
|
};
|
|
100
|
+
/**
|
|
101
|
+
* Checks if the decorator function can be applied.
|
|
102
|
+
*/
|
|
103
|
+
toBeApplicable: (target: unknown, context: DecoratorContext) => void;
|
|
100
104
|
/**
|
|
101
105
|
* Checks if the source type is assignable to the target type.
|
|
102
106
|
*/
|
|
@@ -123,6 +127,14 @@ interface Matchers {
|
|
|
123
127
|
*/
|
|
124
128
|
(target: unknown): void;
|
|
125
129
|
};
|
|
130
|
+
/**
|
|
131
|
+
* Checks if the source type is callable with the given arguments.
|
|
132
|
+
*/
|
|
133
|
+
toBeCallableWith: (...target: Array<unknown>) => void;
|
|
134
|
+
/**
|
|
135
|
+
* Checks if the source type is constructable with the given arguments.
|
|
136
|
+
*/
|
|
137
|
+
toBeConstructableWith: (...target: Array<unknown>) => void;
|
|
126
138
|
/**
|
|
127
139
|
* Checks if a property key exists on the source type.
|
|
128
140
|
*/
|
|
@@ -257,5 +269,29 @@ declare const test: Test;
|
|
|
257
269
|
* Defines a single test.
|
|
258
270
|
*/
|
|
259
271
|
declare const it: Test;
|
|
272
|
+
interface Actions {
|
|
273
|
+
/**
|
|
274
|
+
* Calls the given function with the provided arguments.
|
|
275
|
+
*/
|
|
276
|
+
isCalledWith: (...args: Array<unknown>) => void;
|
|
277
|
+
}
|
|
278
|
+
interface When {
|
|
279
|
+
/**
|
|
280
|
+
* Creates a test plan.
|
|
281
|
+
*
|
|
282
|
+
* @template Target - The type upon which an action is performed.
|
|
283
|
+
*/
|
|
284
|
+
<Target>(): Actions;
|
|
285
|
+
/**
|
|
286
|
+
* Creates a test plan.
|
|
287
|
+
*
|
|
288
|
+
* @param target - The expression upon which an action is performed.
|
|
289
|
+
*/
|
|
290
|
+
(target: unknown): Actions;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Creates a test plan.
|
|
294
|
+
*/
|
|
295
|
+
declare const when: When;
|
|
260
296
|
|
|
261
|
-
export { describe, expect, it, omit, pick, test };
|
|
297
|
+
export { describe, expect, it, omit, pick, test, when };
|
package/build/index.js
CHANGED
|
@@ -9,4 +9,4 @@ const noopChain = new Proxy(doNothing, {
|
|
|
9
9
|
},
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
export { noopChain as describe, noopChain as expect, noopChain as it, doNothing as omit, doNothing as pick, noopChain as test };
|
|
12
|
+
export { noopChain as describe, noopChain as expect, noopChain as it, doNothing as omit, doNothing as pick, noopChain as test, noopChain as when };
|
package/build/tstyche.d.ts
CHANGED
|
@@ -20,57 +20,11 @@ declare class Cli {
|
|
|
20
20
|
run(commandLine: Array<string>, cancellationToken?: CancellationToken): Promise<void>;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
declare enum DiagnosticCategory {
|
|
24
|
-
Error = "error",
|
|
25
|
-
Warning = "warning"
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
declare class SourceFile {
|
|
29
|
-
#private;
|
|
30
|
-
fileName: string;
|
|
31
|
-
text: string;
|
|
32
|
-
constructor(fileName: string, text: string);
|
|
33
|
-
getLineStarts(): Array<number>;
|
|
34
|
-
getLineAndCharacterOfPosition(position: number): {
|
|
35
|
-
line: number;
|
|
36
|
-
character: number;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
declare class DiagnosticOrigin {
|
|
41
|
-
assertion: AssertionNode | undefined;
|
|
42
|
-
end: number;
|
|
43
|
-
sourceFile: SourceFile | ts.SourceFile;
|
|
44
|
-
start: number;
|
|
45
|
-
constructor(start: number, end: number, sourceFile: SourceFile | ts.SourceFile, assertion?: AssertionNode);
|
|
46
|
-
static fromAssertion(assertion: AssertionNode): DiagnosticOrigin;
|
|
47
|
-
static fromNode(node: ts.Node, assertion?: AssertionNode): DiagnosticOrigin;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
declare class Diagnostic {
|
|
51
|
-
category: DiagnosticCategory;
|
|
52
|
-
code: string | undefined;
|
|
53
|
-
origin: DiagnosticOrigin | undefined;
|
|
54
|
-
related: Array<Diagnostic> | undefined;
|
|
55
|
-
text: string | Array<string>;
|
|
56
|
-
constructor(text: string | Array<string>, category: DiagnosticCategory, origin?: DiagnosticOrigin);
|
|
57
|
-
add(options: {
|
|
58
|
-
code?: string | undefined;
|
|
59
|
-
related?: Array<Diagnostic> | undefined;
|
|
60
|
-
}): this;
|
|
61
|
-
static error(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
|
|
62
|
-
extendWith(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
|
|
63
|
-
static fromDiagnostics(diagnostics: Array<ts.Diagnostic>): Array<Diagnostic>;
|
|
64
|
-
static toMessageText(chain: ts.DiagnosticMessageChain): Array<string>;
|
|
65
|
-
static warning(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
type DiagnosticsHandler<T extends Diagnostic | Array<Diagnostic> = Diagnostic> = (this: void, diagnostics: T) => void;
|
|
69
|
-
|
|
70
23
|
declare enum TestTreeNodeBrand {
|
|
71
24
|
Describe = "describe",
|
|
72
25
|
Test = "test",
|
|
73
|
-
Expect = "expect"
|
|
26
|
+
Expect = "expect",
|
|
27
|
+
When = "when"
|
|
74
28
|
}
|
|
75
29
|
|
|
76
30
|
declare enum TestTreeNodeFlags {
|
|
@@ -81,45 +35,43 @@ declare enum TestTreeNodeFlags {
|
|
|
81
35
|
Todo = 8
|
|
82
36
|
}
|
|
83
37
|
|
|
38
|
+
declare class WhenNode extends TestTreeNode {
|
|
39
|
+
actionNode: ts.CallExpression;
|
|
40
|
+
actionNameNode: ts.PropertyAccessExpression;
|
|
41
|
+
abilityDiagnostics: Set<ts.Diagnostic> | undefined;
|
|
42
|
+
target: ts.NodeArray<ts.Expression> | ts.NodeArray<ts.TypeNode>;
|
|
43
|
+
constructor(compiler: typeof ts, brand: TestTreeNodeBrand, node: ts.CallExpression, parent: TestTree | TestTreeNode, flags: TestTreeNodeFlags, actionNode: ts.CallExpression, actionNameNode: ts.PropertyAccessExpression);
|
|
44
|
+
}
|
|
45
|
+
|
|
84
46
|
declare class TestTreeNode {
|
|
85
|
-
#private;
|
|
86
47
|
brand: TestTreeNodeBrand;
|
|
87
|
-
children: Array<TestTreeNode | AssertionNode>;
|
|
48
|
+
children: Array<TestTreeNode | AssertionNode | WhenNode>;
|
|
88
49
|
diagnostics: Set<ts.Diagnostic>;
|
|
89
50
|
flags: TestTreeNodeFlags;
|
|
90
51
|
name: string;
|
|
91
52
|
node: ts.CallExpression;
|
|
92
53
|
parent: TestTree | TestTreeNode;
|
|
93
54
|
constructor(compiler: typeof ts, brand: TestTreeNodeBrand, node: ts.CallExpression, parent: TestTree | TestTreeNode, flags: TestTreeNodeFlags);
|
|
94
|
-
validate(): Array<Diagnostic>;
|
|
95
55
|
}
|
|
96
56
|
|
|
97
57
|
declare class TestTree {
|
|
98
|
-
children: Array<TestTreeNode | AssertionNode>;
|
|
58
|
+
children: Array<TestTreeNode | AssertionNode | WhenNode>;
|
|
99
59
|
diagnostics: Set<ts.Diagnostic>;
|
|
100
60
|
hasOnly: boolean;
|
|
101
61
|
sourceFile: ts.SourceFile;
|
|
102
62
|
constructor(diagnostics: Set<ts.Diagnostic>, sourceFile: ts.SourceFile);
|
|
103
63
|
}
|
|
104
64
|
|
|
105
|
-
interface MatcherNode extends ts.CallExpression {
|
|
106
|
-
expression: ts.PropertyAccessExpression;
|
|
107
|
-
}
|
|
108
65
|
declare class AssertionNode extends TestTreeNode {
|
|
66
|
+
abilityDiagnostics: Set<ts.Diagnostic> | undefined;
|
|
109
67
|
isNot: boolean;
|
|
110
|
-
|
|
111
|
-
|
|
68
|
+
matcherNode: ts.CallExpression | ts.Decorator;
|
|
69
|
+
matcherNameNode: ts.PropertyAccessExpression;
|
|
112
70
|
modifierNode: ts.PropertyAccessExpression;
|
|
113
71
|
notNode: ts.PropertyAccessExpression | undefined;
|
|
114
72
|
source: ts.NodeArray<ts.Expression> | ts.NodeArray<ts.TypeNode>;
|
|
115
|
-
target: ts.NodeArray<ts.Expression> | ts.NodeArray<ts.TypeNode
|
|
116
|
-
constructor(compiler: typeof ts, brand: TestTreeNodeBrand, node: ts.CallExpression, parent: TestTree | TestTreeNode, flags: TestTreeNodeFlags, matcherNode:
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
declare class CollectService {
|
|
120
|
-
#private;
|
|
121
|
-
constructor(compiler: typeof ts);
|
|
122
|
-
createTestTree(sourceFile: ts.SourceFile, semanticDiagnostics?: Array<ts.Diagnostic>): TestTree;
|
|
73
|
+
target: ts.NodeArray<ts.Expression> | ts.NodeArray<ts.TypeNode> | undefined;
|
|
74
|
+
constructor(compiler: typeof ts, brand: TestTreeNodeBrand, node: ts.CallExpression, parent: TestTree | TestTreeNode, flags: TestTreeNodeFlags, matcherNode: ts.CallExpression | ts.Decorator, matcherNameNode: ts.PropertyAccessExpression, modifierNode: ts.PropertyAccessExpression, notNode?: ts.PropertyAccessExpression);
|
|
123
75
|
}
|
|
124
76
|
|
|
125
77
|
declare enum OptionBrand {
|
|
@@ -207,7 +159,7 @@ interface CommandLineOptions {
|
|
|
207
159
|
*/
|
|
208
160
|
failFast?: boolean;
|
|
209
161
|
/**
|
|
210
|
-
* Fetch specified versions of the 'typescript' package and exit.
|
|
162
|
+
* Fetch the specified versions of the 'typescript' package and exit.
|
|
211
163
|
*/
|
|
212
164
|
fetch?: boolean;
|
|
213
165
|
/**
|
|
@@ -297,6 +249,58 @@ declare class Config {
|
|
|
297
249
|
static resolveConfigFilePath(filePath?: string): string;
|
|
298
250
|
}
|
|
299
251
|
|
|
252
|
+
declare enum DiagnosticCategory {
|
|
253
|
+
Error = "error",
|
|
254
|
+
Warning = "warning"
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
declare class SourceFile {
|
|
258
|
+
#private;
|
|
259
|
+
fileName: string;
|
|
260
|
+
text: string;
|
|
261
|
+
constructor(fileName: string, text: string);
|
|
262
|
+
getLineStarts(): Array<number>;
|
|
263
|
+
getLineAndCharacterOfPosition(position: number): {
|
|
264
|
+
line: number;
|
|
265
|
+
character: number;
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
declare class DiagnosticOrigin {
|
|
270
|
+
assertion: AssertionNode | undefined;
|
|
271
|
+
end: number;
|
|
272
|
+
sourceFile: SourceFile | ts.SourceFile;
|
|
273
|
+
start: number;
|
|
274
|
+
constructor(start: number, end: number, sourceFile: SourceFile | ts.SourceFile, assertion?: AssertionNode);
|
|
275
|
+
static fromAssertion(assertion: AssertionNode): DiagnosticOrigin;
|
|
276
|
+
static fromNode(node: ts.Node, assertion?: AssertionNode): DiagnosticOrigin;
|
|
277
|
+
static fromNodes(nodes: ts.NodeArray<ts.Node>, assertion?: AssertionNode): DiagnosticOrigin;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
declare class Diagnostic {
|
|
281
|
+
category: DiagnosticCategory;
|
|
282
|
+
code: string | undefined;
|
|
283
|
+
origin: DiagnosticOrigin | undefined;
|
|
284
|
+
related: Array<Diagnostic> | undefined;
|
|
285
|
+
text: string | Array<string>;
|
|
286
|
+
constructor(text: string | Array<string>, category: DiagnosticCategory, origin?: DiagnosticOrigin);
|
|
287
|
+
add(options: {
|
|
288
|
+
code?: string | undefined;
|
|
289
|
+
related?: Array<Diagnostic> | undefined;
|
|
290
|
+
}): this;
|
|
291
|
+
static error(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
|
|
292
|
+
extendWith(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
|
|
293
|
+
static fromDiagnostics(diagnostics: Array<ts.Diagnostic>): Array<Diagnostic>;
|
|
294
|
+
static warning(text: string | Array<string>, origin?: DiagnosticOrigin): Diagnostic;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
declare function diagnosticBelongsToNode(diagnostic: ts.Diagnostic, node: ts.NodeArray<ts.Node> | ts.Node): boolean;
|
|
298
|
+
declare function getDiagnosticMessageText(diagnostic: ts.Diagnostic): string | Array<string>;
|
|
299
|
+
declare function getTextSpanEnd(span: ts.TextSpan): number;
|
|
300
|
+
declare function isDiagnosticWithLocation(diagnostic: ts.Diagnostic): diagnostic is ts.DiagnosticWithLocation;
|
|
301
|
+
|
|
302
|
+
type DiagnosticsHandler<T extends Diagnostic | Array<Diagnostic> = Diagnostic> = (this: void, diagnostics: T) => void;
|
|
303
|
+
|
|
300
304
|
declare enum OptionGroup {
|
|
301
305
|
CommandLine = 2,
|
|
302
306
|
ConfigFile = 4,
|
|
@@ -330,6 +334,27 @@ declare class Options {
|
|
|
330
334
|
|
|
331
335
|
declare const defaultOptions: Required<ConfigFileOptions>;
|
|
332
336
|
|
|
337
|
+
declare class ProjectService {
|
|
338
|
+
#private;
|
|
339
|
+
constructor(compiler: typeof ts, resolvedConfig: ResolvedConfig);
|
|
340
|
+
closeFile(filePath: string): void;
|
|
341
|
+
getDefaultProject(filePath: string): ts.server.Project | undefined;
|
|
342
|
+
getLanguageService(filePath: string): ts.LanguageService | undefined;
|
|
343
|
+
openFile(filePath: string, sourceText?: string | undefined, projectRootPath?: string | undefined): void;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
declare class CollectService {
|
|
347
|
+
#private;
|
|
348
|
+
constructor(compiler: typeof ts, projectService: ProjectService, resolvedConfig: ResolvedConfig);
|
|
349
|
+
createTestTree(sourceFile: ts.SourceFile, semanticDiagnostics?: Array<ts.Diagnostic>): TestTree;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
declare function nodeBelongsToArgumentList(compiler: typeof ts, node: ts.Node): boolean;
|
|
353
|
+
|
|
354
|
+
declare function argumentIsProvided<T>(argumentNameText: string, node: T, enclosingNode: ts.Node, onDiagnostics: DiagnosticsHandler<Array<Diagnostic>>): node is NonNullable<T>;
|
|
355
|
+
|
|
356
|
+
declare function argumentOrTypeArgumentIsProvided<T>(argumentNameText: string, typeArgumentNameText: string, node: T, enclosingNode: ts.Node, onDiagnostics: DiagnosticsHandler<Array<Diagnostic>>): node is NonNullable<T>;
|
|
357
|
+
|
|
333
358
|
interface EnvironmentOptions {
|
|
334
359
|
/**
|
|
335
360
|
* Is `true` if the process is running in continuous integration environment.
|
|
@@ -481,13 +506,12 @@ declare class TargetResult {
|
|
|
481
506
|
declare class Result {
|
|
482
507
|
expectCount: ResultCount;
|
|
483
508
|
fileCount: ResultCount;
|
|
484
|
-
resolvedConfig: ResolvedConfig;
|
|
485
509
|
results: Array<TargetResult>;
|
|
486
510
|
targetCount: ResultCount;
|
|
487
511
|
tasks: Array<Task>;
|
|
488
512
|
testCount: ResultCount;
|
|
489
513
|
timing: ResultTiming;
|
|
490
|
-
constructor(
|
|
514
|
+
constructor(tasks: Array<Task>);
|
|
491
515
|
}
|
|
492
516
|
|
|
493
517
|
interface EventHandler {
|
|
@@ -523,11 +547,13 @@ type Event = ["config:error", {
|
|
|
523
547
|
}] | ["task:end", {
|
|
524
548
|
result: TaskResult;
|
|
525
549
|
}] | ["collect:start", {
|
|
526
|
-
|
|
550
|
+
tree: TestTree;
|
|
551
|
+
}] | ["collect:error", {
|
|
552
|
+
diagnostics: Array<Diagnostic>;
|
|
527
553
|
}] | ["collect:node", {
|
|
528
|
-
|
|
554
|
+
node: TestTreeNode | AssertionNode | WhenNode;
|
|
529
555
|
}] | ["collect:end", {
|
|
530
|
-
|
|
556
|
+
tree: TestTree;
|
|
531
557
|
}] | ["describe:start", {
|
|
532
558
|
result: DescribeResult;
|
|
533
559
|
}] | ["describe:end", {
|
|
@@ -574,29 +600,33 @@ declare class EventEmitter {
|
|
|
574
600
|
removeReporters(): void;
|
|
575
601
|
}
|
|
576
602
|
|
|
603
|
+
declare class Reject {
|
|
604
|
+
#private;
|
|
605
|
+
constructor(compiler: typeof ts, typeChecker: ts.TypeChecker, resolvedConfig: ResolvedConfig);
|
|
606
|
+
argumentType(target: Array<[name: string, node: ts.Expression | ts.TypeNode | undefined]>, onDiagnostics: DiagnosticsHandler<Array<Diagnostic>>): boolean;
|
|
607
|
+
}
|
|
608
|
+
|
|
577
609
|
interface MatchResult {
|
|
578
610
|
explain: () => Array<Diagnostic>;
|
|
579
611
|
isMatch: boolean;
|
|
580
612
|
}
|
|
581
|
-
type Relation = Map<string, unknown>;
|
|
582
613
|
interface TypeChecker extends ts.TypeChecker {
|
|
583
614
|
isApplicableIndexType: (source: ts.Type, target: ts.Type) => boolean;
|
|
584
|
-
|
|
585
|
-
relation: {
|
|
586
|
-
assignable: Relation;
|
|
587
|
-
identity: Relation;
|
|
588
|
-
};
|
|
615
|
+
isTypeIdenticalTo: (source: ts.Type, target: ts.Type) => boolean;
|
|
589
616
|
}
|
|
590
617
|
|
|
591
618
|
declare class ExpectService {
|
|
592
619
|
#private;
|
|
593
620
|
private toAcceptProps;
|
|
594
621
|
private toBe;
|
|
622
|
+
private toBeApplicable;
|
|
595
623
|
private toBeAssignableTo;
|
|
596
624
|
private toBeAssignableWith;
|
|
625
|
+
private toBeCallableWith;
|
|
626
|
+
private toBeConstructableWith;
|
|
597
627
|
private toHaveProperty;
|
|
598
628
|
private toRaiseError;
|
|
599
|
-
constructor(compiler: typeof ts, typeChecker: TypeChecker,
|
|
629
|
+
constructor(compiler: typeof ts, typeChecker: TypeChecker, reject: Reject);
|
|
600
630
|
match(assertion: AssertionNode, onDiagnostics: DiagnosticsHandler<Diagnostic | Array<Diagnostic>>): MatchResult | undefined;
|
|
601
631
|
}
|
|
602
632
|
|
|
@@ -617,11 +647,6 @@ declare class ResultHandler implements EventHandler {
|
|
|
617
647
|
on([event, payload]: Event): void;
|
|
618
648
|
}
|
|
619
649
|
|
|
620
|
-
declare class TestTreeHandler implements EventHandler {
|
|
621
|
-
testTree: TestTree | undefined;
|
|
622
|
-
on([event, payload]: Event): void;
|
|
623
|
-
}
|
|
624
|
-
|
|
625
650
|
type InputHandler = (chunk: string) => void;
|
|
626
651
|
declare class InputService {
|
|
627
652
|
#private;
|
|
@@ -712,13 +737,10 @@ declare class OutputService {
|
|
|
712
737
|
static writeWarning(element: ScribblerJsx.Element | Array<ScribblerJsx.Element>): void;
|
|
713
738
|
}
|
|
714
739
|
|
|
715
|
-
declare function summaryText({ duration, expectCount, fileCount,
|
|
740
|
+
declare function summaryText({ duration, expectCount, fileCount, targetCount, testCount, }: {
|
|
716
741
|
duration: number;
|
|
717
742
|
expectCount: ResultCount;
|
|
718
743
|
fileCount: ResultCount;
|
|
719
|
-
onlyMatch: string | undefined;
|
|
720
|
-
pathMatch: Array<string>;
|
|
721
|
-
skipMatch: string | undefined;
|
|
722
744
|
targetCount: ResultCount;
|
|
723
745
|
testCount: ResultCount;
|
|
724
746
|
}): ScribblerJsx.Element;
|
|
@@ -767,15 +789,6 @@ declare class PluginService {
|
|
|
767
789
|
static removeHandlers(): void;
|
|
768
790
|
}
|
|
769
791
|
|
|
770
|
-
declare class ProjectService {
|
|
771
|
-
#private;
|
|
772
|
-
constructor(resolvedConfig: ResolvedConfig, compiler: typeof ts);
|
|
773
|
-
closeFile(filePath: string): void;
|
|
774
|
-
getDefaultProject(filePath: string): ts.server.Project | undefined;
|
|
775
|
-
getLanguageService(filePath: string): ts.LanguageService | undefined;
|
|
776
|
-
openFile(filePath: string, sourceText?: string | undefined, projectRootPath?: string | undefined): void;
|
|
777
|
-
}
|
|
778
|
-
|
|
779
792
|
declare class Runner {
|
|
780
793
|
#private;
|
|
781
794
|
static version: string;
|
|
@@ -867,5 +880,11 @@ declare class WatchService {
|
|
|
867
880
|
watch(cancellationToken: CancellationToken): AsyncIterable<Array<Task>>;
|
|
868
881
|
}
|
|
869
882
|
|
|
870
|
-
|
|
883
|
+
declare class WhenService {
|
|
884
|
+
#private;
|
|
885
|
+
constructor(reject: Reject, onDiagnostics: DiagnosticsHandler<Array<Diagnostic>>);
|
|
886
|
+
action(when: WhenNode): void;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
export { AssertionNode, BaseReporter, CancellationHandler, CancellationReason, CancellationToken, Cli, CollectService, Color, Config, ConfigDiagnosticText, DescribeResult, Diagnostic, DiagnosticCategory, DiagnosticOrigin, EventEmitter, ExitCodeHandler, ExpectResult, ExpectService, FileWatcher, InputService, Line, ListReporter, OptionBrand, OptionGroup, Options, OutputService, Path, PluginService, ProjectResult, ProjectService, Reject, Result, ResultCount, ResultHandler, ResultStatus, ResultTiming, Runner, Scribbler, ScribblerJsx, Select, SelectDiagnosticText, SetupReporter, SourceFile, Store, SummaryReporter, TargetResult, Task, TaskResult, TestResult, TestTree, TestTreeNode, TestTreeNodeBrand, TestTreeNodeFlags, Text, Version, WatchReporter, WatchService, Watcher, WhenNode, WhenService, addsPackageText, argumentIsProvided, argumentOrTypeArgumentIsProvided, defaultOptions, describeNameText, diagnosticBelongsToNode, diagnosticText, environmentOptions, fileViewText, formattedText, getDiagnosticMessageText, getTextSpanEnd, helpText, isDiagnosticWithLocation, nodeBelongsToArgumentList, summaryText, taskStatusText, testNameText, usesCompilerText, waitingForFileChangesText, watchUsageText };
|
|
871
890
|
export type { CodeFrameOptions, CommandLineOptions, ConfigFileOptions, DiagnosticsHandler, EnvironmentOptions, Event, EventHandler, FileWatchHandler, InputHandler, ItemDefinition, MatchResult, OptionDefinition, Plugin, Reporter, ReporterEvent, ResolvedConfig, ScribblerOptions, SelectHookContext, TargetResultStatus, TaskResultStatus, TypeChecker, WatchHandler, WatcherOptions };
|