tstyche 1.1.0 → 2.0.0-beta.0
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 +5 -5
- package/build/index.d.cts +98 -39
- package/build/index.d.ts +98 -39
- package/build/tstyche.d.ts +87 -74
- package/build/tstyche.js +598 -267
- package/package.json +15 -16
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ function firstItem<T>(target: Array<T>): T | undefined {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
test("firstItem", () => {
|
|
28
|
-
expect(firstItem(["a", "b", "c"])).type.
|
|
28
|
+
expect(firstItem(["a", "b", "c"])).type.toBe<string | undefined>();
|
|
29
29
|
|
|
30
30
|
expect(firstItem()).type.toRaiseError("Expected 1 argument");
|
|
31
31
|
});
|
|
@@ -52,13 +52,13 @@ function secondItem<T>(target: Array<T>): T | undefined {
|
|
|
52
52
|
test("handles numbers", () => {
|
|
53
53
|
assert.strictEqual(secondItem([1, 2, 3]), 2);
|
|
54
54
|
|
|
55
|
-
tstyche.expect(secondItem([1, 2, 3])).type.
|
|
55
|
+
tstyche.expect(secondItem([1, 2, 3])).type.toBe<number | undefined>();
|
|
56
56
|
});
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
Here is the list of all matchers:
|
|
60
60
|
|
|
61
|
-
- `.
|
|
61
|
+
- `.toBe()`, `.toBeAssignableTo()`, `.toBeAssignableWith()`, `.toMatch()` compare types or types of expression,
|
|
62
62
|
- `.toHaveProperty()` looks up keys on an object type,
|
|
63
63
|
- `.toRaiseError()` captures the type error message or code,
|
|
64
64
|
- `.toBeString()`, `.toBeNumber()`, `.toBeVoid()` and 9 more shorthand checks for primitive types.
|
|
@@ -91,8 +91,8 @@ If you have any questions or suggestions, [start a discussion](https://github.co
|
|
|
91
91
|
[license-url]: https://github.com/tstyche/tstyche/blob/main/LICENSE.md
|
|
92
92
|
[requirements-badge]: https://badgen.net/npm/node/tstyche
|
|
93
93
|
[requirements-url]: https://tstyche.org/reference/requirements
|
|
94
|
-
[install-size-badge]: https://badgen.net/
|
|
95
|
-
[install-size-url]: https://
|
|
94
|
+
[install-size-badge]: https://badgen.net/packagephobia/install/tstyche
|
|
95
|
+
[install-size-url]: https://packagephobia.com/result?p=tstyche
|
|
96
96
|
[coverage-badge]: https://badgen.net/codacy/coverage/a581ca5c323a455886b7bdd9623c4ec8
|
|
97
97
|
[coverage-url]: https://app.codacy.com/gh/tstyche/tstyche/coverage/dashboard
|
|
98
98
|
[discord-badge]: https://badgen.net/static/chat/on%20Discord
|
package/build/index.d.cts
CHANGED
|
@@ -60,22 +60,115 @@ interface Test {
|
|
|
60
60
|
}
|
|
61
61
|
interface Matchers {
|
|
62
62
|
/**
|
|
63
|
-
* Checks if the
|
|
63
|
+
* Checks if the source type is identical to the target type.
|
|
64
64
|
*/
|
|
65
|
-
|
|
65
|
+
toBe: {
|
|
66
|
+
/**
|
|
67
|
+
* Checks if the source type is identical to the target type.
|
|
68
|
+
*/
|
|
69
|
+
<Target>(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Checks if the source type is identical to type of the target expression.
|
|
72
|
+
*/
|
|
73
|
+
(target: unknown): void;
|
|
74
|
+
};
|
|
66
75
|
/**
|
|
67
|
-
* Checks if the
|
|
76
|
+
* Checks if the source type is assignable with the target type.
|
|
77
|
+
*
|
|
78
|
+
* @deprecated Use `.toBeAssignableWith()` or `.toBeAssignableTo()` instead. This matcher will be removed in TSTyche 3.
|
|
79
|
+
* To learn more, visit https://tstyche.org/release-notes/tstyche-2.
|
|
68
80
|
*/
|
|
69
81
|
toBeAssignable: {
|
|
70
82
|
/**
|
|
71
|
-
* Checks if the
|
|
83
|
+
* Checks if the source type is assignable with the target type.
|
|
84
|
+
*
|
|
85
|
+
* @deprecated Use `.toBeAssignableWith()` or `.toBeAssignableTo()` instead. This matcher will be removed in TSTyche 3.
|
|
86
|
+
* To learn more, visit https://tstyche.org/release-notes/tstyche-2.
|
|
87
|
+
*/
|
|
88
|
+
<Target>(): void;
|
|
89
|
+
/**
|
|
90
|
+
* Checks if the source type is assignable with type of the target expression.
|
|
91
|
+
*
|
|
92
|
+
* @deprecated Use `.toBeAssignableWith()` or `.toBeAssignableTo()` instead. This matcher will be removed in TSTyche 3.
|
|
93
|
+
* To learn more, visit https://tstyche.org/release-notes/tstyche-2.
|
|
94
|
+
*/
|
|
95
|
+
(target: unknown): void;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Checks if the source type is assignable to the target type.
|
|
99
|
+
*/
|
|
100
|
+
toBeAssignableTo: {
|
|
101
|
+
/**
|
|
102
|
+
* Checks if the source type is assignable to the target type.
|
|
72
103
|
*/
|
|
73
104
|
<Target>(): void;
|
|
74
105
|
/**
|
|
75
|
-
* Checks if
|
|
106
|
+
* Checks if the source type is assignable to type of the target expression.
|
|
76
107
|
*/
|
|
77
108
|
(target: unknown): void;
|
|
78
109
|
};
|
|
110
|
+
/**
|
|
111
|
+
* Checks if the source type is assignable with the target type.
|
|
112
|
+
*/
|
|
113
|
+
toBeAssignableWith: {
|
|
114
|
+
/**
|
|
115
|
+
* Checks if the source type is assignable with the target type.
|
|
116
|
+
*/
|
|
117
|
+
<Target>(): void;
|
|
118
|
+
/**
|
|
119
|
+
* Checks if the source type is assignable with type of the target expression.
|
|
120
|
+
*/
|
|
121
|
+
(target: unknown): void;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Checks if the source type is identical to the target type.
|
|
125
|
+
*
|
|
126
|
+
* @deprecated Use `.toBe()` instead. This matcher will be removed in TSTyche 3.
|
|
127
|
+
* To learn more, visit https://tstyche.org/release-notes/tstyche-2.
|
|
128
|
+
*/
|
|
129
|
+
toEqual: {
|
|
130
|
+
/**
|
|
131
|
+
* Checks if the source type is identical to the target type.
|
|
132
|
+
*
|
|
133
|
+
* @deprecated Use `.toBe()` instead. This matcher will be removed in TSTyche 3.
|
|
134
|
+
* To learn more, visit https://tstyche.org/release-notes/tstyche-2.
|
|
135
|
+
*/
|
|
136
|
+
<Target>(): void;
|
|
137
|
+
/**
|
|
138
|
+
* Checks if the source type is identical to type of the target expression.
|
|
139
|
+
*
|
|
140
|
+
* @deprecated This matcher will be removed in TSTyche 3.
|
|
141
|
+
* To learn more, visit https://tstyche.org/release-notes/tstyche-2.
|
|
142
|
+
*/
|
|
143
|
+
(target: unknown): void;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Checks if a property key exists on the source type.
|
|
147
|
+
*/
|
|
148
|
+
toHaveProperty: (key: string | number | symbol) => void;
|
|
149
|
+
/**
|
|
150
|
+
* Checks if the source type matches the target type.
|
|
151
|
+
*/
|
|
152
|
+
toMatch: {
|
|
153
|
+
/**
|
|
154
|
+
* Checks if the source type matches the target type.
|
|
155
|
+
*/
|
|
156
|
+
<Target>(): void;
|
|
157
|
+
/**
|
|
158
|
+
* Checks if the source type matches type of the target expression.
|
|
159
|
+
*/
|
|
160
|
+
(target: unknown): void;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Checks if the source type raises an error.
|
|
164
|
+
*/
|
|
165
|
+
toRaiseError: (...target: Array<string | number>) => void;
|
|
166
|
+
}
|
|
167
|
+
interface Matchers {
|
|
168
|
+
/**
|
|
169
|
+
* Checks if the source type is `any`.
|
|
170
|
+
*/
|
|
171
|
+
toBeAny: () => void;
|
|
79
172
|
/**
|
|
80
173
|
* Checks if the source type is `bigint`.
|
|
81
174
|
*/
|
|
@@ -120,40 +213,6 @@ interface Matchers {
|
|
|
120
213
|
* Checks if the source type is `void`.
|
|
121
214
|
*/
|
|
122
215
|
toBeVoid: () => void;
|
|
123
|
-
/**
|
|
124
|
-
* Check if the target type is identical to the source type.
|
|
125
|
-
*/
|
|
126
|
-
toEqual: {
|
|
127
|
-
/**
|
|
128
|
-
* Checks if the target type is identical to the source type.
|
|
129
|
-
*/
|
|
130
|
-
<Target>(): void;
|
|
131
|
-
/**
|
|
132
|
-
* Checks if type of the target expression is identical to the source type.
|
|
133
|
-
*/
|
|
134
|
-
(target: unknown): void;
|
|
135
|
-
};
|
|
136
|
-
/**
|
|
137
|
-
* Checks if a property key exists on the source type.
|
|
138
|
-
*/
|
|
139
|
-
toHaveProperty: (key: string | number | symbol) => void;
|
|
140
|
-
/**
|
|
141
|
-
* Checks if the target type is a subtype the source type.
|
|
142
|
-
*/
|
|
143
|
-
toMatch: {
|
|
144
|
-
/**
|
|
145
|
-
* Checks if the target type is a subtype the source type.
|
|
146
|
-
*/
|
|
147
|
-
<Target>(): void;
|
|
148
|
-
/**
|
|
149
|
-
* Checks if type of the target expression is a subtype the source type.
|
|
150
|
-
*/
|
|
151
|
-
(target: unknown): void;
|
|
152
|
-
};
|
|
153
|
-
/**
|
|
154
|
-
* Checks if the source type raises an error.
|
|
155
|
-
*/
|
|
156
|
-
toRaiseError: (...target: Array<string | number>) => void;
|
|
157
216
|
}
|
|
158
217
|
interface Modifier {
|
|
159
218
|
/**
|
package/build/index.d.ts
CHANGED
|
@@ -60,22 +60,115 @@ interface Test {
|
|
|
60
60
|
}
|
|
61
61
|
interface Matchers {
|
|
62
62
|
/**
|
|
63
|
-
* Checks if the
|
|
63
|
+
* Checks if the source type is identical to the target type.
|
|
64
64
|
*/
|
|
65
|
-
|
|
65
|
+
toBe: {
|
|
66
|
+
/**
|
|
67
|
+
* Checks if the source type is identical to the target type.
|
|
68
|
+
*/
|
|
69
|
+
<Target>(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Checks if the source type is identical to type of the target expression.
|
|
72
|
+
*/
|
|
73
|
+
(target: unknown): void;
|
|
74
|
+
};
|
|
66
75
|
/**
|
|
67
|
-
* Checks if the
|
|
76
|
+
* Checks if the source type is assignable with the target type.
|
|
77
|
+
*
|
|
78
|
+
* @deprecated Use `.toBeAssignableWith()` or `.toBeAssignableTo()` instead. This matcher will be removed in TSTyche 3.
|
|
79
|
+
* To learn more, visit https://tstyche.org/release-notes/tstyche-2.
|
|
68
80
|
*/
|
|
69
81
|
toBeAssignable: {
|
|
70
82
|
/**
|
|
71
|
-
* Checks if the
|
|
83
|
+
* Checks if the source type is assignable with the target type.
|
|
84
|
+
*
|
|
85
|
+
* @deprecated Use `.toBeAssignableWith()` or `.toBeAssignableTo()` instead. This matcher will be removed in TSTyche 3.
|
|
86
|
+
* To learn more, visit https://tstyche.org/release-notes/tstyche-2.
|
|
87
|
+
*/
|
|
88
|
+
<Target>(): void;
|
|
89
|
+
/**
|
|
90
|
+
* Checks if the source type is assignable with type of the target expression.
|
|
91
|
+
*
|
|
92
|
+
* @deprecated Use `.toBeAssignableWith()` or `.toBeAssignableTo()` instead. This matcher will be removed in TSTyche 3.
|
|
93
|
+
* To learn more, visit https://tstyche.org/release-notes/tstyche-2.
|
|
94
|
+
*/
|
|
95
|
+
(target: unknown): void;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Checks if the source type is assignable to the target type.
|
|
99
|
+
*/
|
|
100
|
+
toBeAssignableTo: {
|
|
101
|
+
/**
|
|
102
|
+
* Checks if the source type is assignable to the target type.
|
|
72
103
|
*/
|
|
73
104
|
<Target>(): void;
|
|
74
105
|
/**
|
|
75
|
-
* Checks if
|
|
106
|
+
* Checks if the source type is assignable to type of the target expression.
|
|
76
107
|
*/
|
|
77
108
|
(target: unknown): void;
|
|
78
109
|
};
|
|
110
|
+
/**
|
|
111
|
+
* Checks if the source type is assignable with the target type.
|
|
112
|
+
*/
|
|
113
|
+
toBeAssignableWith: {
|
|
114
|
+
/**
|
|
115
|
+
* Checks if the source type is assignable with the target type.
|
|
116
|
+
*/
|
|
117
|
+
<Target>(): void;
|
|
118
|
+
/**
|
|
119
|
+
* Checks if the source type is assignable with type of the target expression.
|
|
120
|
+
*/
|
|
121
|
+
(target: unknown): void;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* Checks if the source type is identical to the target type.
|
|
125
|
+
*
|
|
126
|
+
* @deprecated Use `.toBe()` instead. This matcher will be removed in TSTyche 3.
|
|
127
|
+
* To learn more, visit https://tstyche.org/release-notes/tstyche-2.
|
|
128
|
+
*/
|
|
129
|
+
toEqual: {
|
|
130
|
+
/**
|
|
131
|
+
* Checks if the source type is identical to the target type.
|
|
132
|
+
*
|
|
133
|
+
* @deprecated Use `.toBe()` instead. This matcher will be removed in TSTyche 3.
|
|
134
|
+
* To learn more, visit https://tstyche.org/release-notes/tstyche-2.
|
|
135
|
+
*/
|
|
136
|
+
<Target>(): void;
|
|
137
|
+
/**
|
|
138
|
+
* Checks if the source type is identical to type of the target expression.
|
|
139
|
+
*
|
|
140
|
+
* @deprecated This matcher will be removed in TSTyche 3.
|
|
141
|
+
* To learn more, visit https://tstyche.org/release-notes/tstyche-2.
|
|
142
|
+
*/
|
|
143
|
+
(target: unknown): void;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Checks if a property key exists on the source type.
|
|
147
|
+
*/
|
|
148
|
+
toHaveProperty: (key: string | number | symbol) => void;
|
|
149
|
+
/**
|
|
150
|
+
* Checks if the source type matches the target type.
|
|
151
|
+
*/
|
|
152
|
+
toMatch: {
|
|
153
|
+
/**
|
|
154
|
+
* Checks if the source type matches the target type.
|
|
155
|
+
*/
|
|
156
|
+
<Target>(): void;
|
|
157
|
+
/**
|
|
158
|
+
* Checks if the source type matches type of the target expression.
|
|
159
|
+
*/
|
|
160
|
+
(target: unknown): void;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Checks if the source type raises an error.
|
|
164
|
+
*/
|
|
165
|
+
toRaiseError: (...target: Array<string | number>) => void;
|
|
166
|
+
}
|
|
167
|
+
interface Matchers {
|
|
168
|
+
/**
|
|
169
|
+
* Checks if the source type is `any`.
|
|
170
|
+
*/
|
|
171
|
+
toBeAny: () => void;
|
|
79
172
|
/**
|
|
80
173
|
* Checks if the source type is `bigint`.
|
|
81
174
|
*/
|
|
@@ -120,40 +213,6 @@ interface Matchers {
|
|
|
120
213
|
* Checks if the source type is `void`.
|
|
121
214
|
*/
|
|
122
215
|
toBeVoid: () => void;
|
|
123
|
-
/**
|
|
124
|
-
* Check if the target type is identical to the source type.
|
|
125
|
-
*/
|
|
126
|
-
toEqual: {
|
|
127
|
-
/**
|
|
128
|
-
* Checks if the target type is identical to the source type.
|
|
129
|
-
*/
|
|
130
|
-
<Target>(): void;
|
|
131
|
-
/**
|
|
132
|
-
* Checks if type of the target expression is identical to the source type.
|
|
133
|
-
*/
|
|
134
|
-
(target: unknown): void;
|
|
135
|
-
};
|
|
136
|
-
/**
|
|
137
|
-
* Checks if a property key exists on the source type.
|
|
138
|
-
*/
|
|
139
|
-
toHaveProperty: (key: string | number | symbol) => void;
|
|
140
|
-
/**
|
|
141
|
-
* Checks if the target type is a subtype the source type.
|
|
142
|
-
*/
|
|
143
|
-
toMatch: {
|
|
144
|
-
/**
|
|
145
|
-
* Checks if the target type is a subtype the source type.
|
|
146
|
-
*/
|
|
147
|
-
<Target>(): void;
|
|
148
|
-
/**
|
|
149
|
-
* Checks if type of the target expression is a subtype the source type.
|
|
150
|
-
*/
|
|
151
|
-
(target: unknown): void;
|
|
152
|
-
};
|
|
153
|
-
/**
|
|
154
|
-
* Checks if the source type raises an error.
|
|
155
|
-
*/
|
|
156
|
-
toRaiseError: (...target: Array<string | number>) => void;
|
|
157
216
|
}
|
|
158
217
|
interface Modifier {
|
|
159
218
|
/**
|
package/build/tstyche.d.ts
CHANGED
|
@@ -43,7 +43,6 @@ declare class StoreService {
|
|
|
43
43
|
install(tag: string, cancellationToken?: CancellationToken): Promise<string | undefined>;
|
|
44
44
|
load(tag: string, cancellationToken?: CancellationToken): Promise<typeof ts | undefined>;
|
|
45
45
|
open(): Promise<void>;
|
|
46
|
-
prune: () => Promise<void>;
|
|
47
46
|
resolveTag(tag: string): Promise<string | undefined>;
|
|
48
47
|
update(): Promise<void>;
|
|
49
48
|
validateTag(tag: string): Promise<boolean | undefined>;
|
|
@@ -137,6 +136,10 @@ interface CommandLineOptions {
|
|
|
137
136
|
* Print the version number and exit.
|
|
138
137
|
*/
|
|
139
138
|
version?: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Watch for changes and rerun related tests files.
|
|
141
|
+
*/
|
|
142
|
+
watch?: boolean;
|
|
140
143
|
}
|
|
141
144
|
|
|
142
145
|
/**
|
|
@@ -177,15 +180,23 @@ declare class ConfigService {
|
|
|
177
180
|
parseCommandLine(commandLineArgs: Array<string>): Promise<void>;
|
|
178
181
|
readConfigFile(): Promise<void>;
|
|
179
182
|
resolveConfig(): ResolvedConfig;
|
|
180
|
-
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
declare class SelectService {
|
|
186
|
+
#private;
|
|
187
|
+
readonly resolvedConfig: ResolvedConfig;
|
|
188
|
+
constructor(resolvedConfig: ResolvedConfig);
|
|
189
|
+
isTestFile(filePath: string): boolean;
|
|
190
|
+
selectFiles(): Promise<Array<string>>;
|
|
181
191
|
}
|
|
182
192
|
|
|
183
193
|
declare class TSTyche {
|
|
184
194
|
#private;
|
|
185
195
|
readonly resolvedConfig: ResolvedConfig;
|
|
186
|
-
static readonly version = "
|
|
196
|
+
static readonly version = "2.0.0-beta.0";
|
|
187
197
|
constructor(resolvedConfig: ResolvedConfig, storeService: StoreService);
|
|
188
198
|
run(testFiles: Array<string | URL>): Promise<void>;
|
|
199
|
+
watch(testFiles: Array<string>, selectService: SelectService): Promise<void>;
|
|
189
200
|
}
|
|
190
201
|
|
|
191
202
|
declare class Cli {
|
|
@@ -257,6 +268,10 @@ declare class CollectService {
|
|
|
257
268
|
|
|
258
269
|
declare class Environment {
|
|
259
270
|
#private;
|
|
271
|
+
/**
|
|
272
|
+
* Is `true` if the process is running in a continuous integration environment.
|
|
273
|
+
*/
|
|
274
|
+
static get isCi(): boolean;
|
|
260
275
|
/**
|
|
261
276
|
* Specifies whether color should be disabled in the output.
|
|
262
277
|
*/
|
|
@@ -376,12 +391,18 @@ declare class ResultManager {
|
|
|
376
391
|
handleEvent([eventName, payload]: Event): void;
|
|
377
392
|
}
|
|
378
393
|
|
|
379
|
-
type Event = ["
|
|
394
|
+
type Event = ["config:error", {
|
|
395
|
+
diagnostics: Array<Diagnostic>;
|
|
396
|
+
}] | ["deprecation:info", {
|
|
397
|
+
diagnostics: Array<Diagnostic>;
|
|
398
|
+
}] | ["input:info", {
|
|
399
|
+
key: string;
|
|
400
|
+
}] | ["select:error", {
|
|
401
|
+
diagnostics: Array<Diagnostic>;
|
|
402
|
+
}] | ["run:start", {
|
|
380
403
|
result: Result;
|
|
381
|
-
}] | ["end", {
|
|
404
|
+
}] | ["run:end", {
|
|
382
405
|
result: Result;
|
|
383
|
-
}] | ["config:error", {
|
|
384
|
-
diagnostics: Array<Diagnostic>;
|
|
385
406
|
}] | ["store:info", {
|
|
386
407
|
compilerVersion: string;
|
|
387
408
|
installationPath: string;
|
|
@@ -466,20 +487,26 @@ declare abstract class RelationMatcherBase {
|
|
|
466
487
|
typeChecker: TypeChecker;
|
|
467
488
|
abstract relation: Relation;
|
|
468
489
|
abstract relationExplanationText: string;
|
|
490
|
+
relationExplanationVerb: string;
|
|
469
491
|
constructor(typeChecker: TypeChecker);
|
|
470
492
|
protected explain(sourceType: ts.Type, targetType: ts.Type, isNot: boolean): Array<Diagnostic>;
|
|
471
493
|
match(sourceType: ts.Type, targetType: ts.Type, isNot: boolean): MatchResult;
|
|
472
494
|
}
|
|
473
495
|
|
|
474
|
-
declare class
|
|
496
|
+
declare class ToBe extends RelationMatcherBase {
|
|
497
|
+
relation: Relation;
|
|
498
|
+
relationExplanationText: string;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
declare class ToBeAssignableTo extends RelationMatcherBase {
|
|
475
502
|
relation: Relation;
|
|
476
503
|
relationExplanationText: string;
|
|
477
|
-
match(sourceType: ts.Type, targetType: ts.Type, isNot: boolean): MatchResult;
|
|
478
504
|
}
|
|
479
505
|
|
|
480
|
-
declare class
|
|
506
|
+
declare class ToBeAssignableWith extends RelationMatcherBase {
|
|
481
507
|
relation: Relation;
|
|
482
508
|
relationExplanationText: string;
|
|
509
|
+
match(sourceType: ts.Type, targetType: ts.Type, isNot: boolean): MatchResult;
|
|
483
510
|
}
|
|
484
511
|
|
|
485
512
|
declare class ToHaveProperty {
|
|
@@ -493,6 +520,7 @@ declare class ToHaveProperty {
|
|
|
493
520
|
declare class ToMatch extends RelationMatcherBase {
|
|
494
521
|
relation: Relation;
|
|
495
522
|
relationExplanationText: string;
|
|
523
|
+
relationExplanationVerb: string;
|
|
496
524
|
}
|
|
497
525
|
|
|
498
526
|
declare class ToRaiseError {
|
|
@@ -510,8 +538,11 @@ declare class Expect {
|
|
|
510
538
|
#private;
|
|
511
539
|
compiler: typeof ts;
|
|
512
540
|
typeChecker: TypeChecker;
|
|
541
|
+
toBe: ToBe;
|
|
513
542
|
toBeAny: PrimitiveTypeMatcher;
|
|
514
|
-
toBeAssignable:
|
|
543
|
+
toBeAssignable: ToBeAssignableWith;
|
|
544
|
+
toBeAssignableTo: ToBeAssignableTo;
|
|
545
|
+
toBeAssignableWith: ToBeAssignableWith;
|
|
515
546
|
toBeBigInt: PrimitiveTypeMatcher;
|
|
516
547
|
toBeBoolean: PrimitiveTypeMatcher;
|
|
517
548
|
toBeNever: PrimitiveTypeMatcher;
|
|
@@ -523,7 +554,7 @@ declare class Expect {
|
|
|
523
554
|
toBeUniqueSymbol: PrimitiveTypeMatcher;
|
|
524
555
|
toBeUnknown: PrimitiveTypeMatcher;
|
|
525
556
|
toBeVoid: PrimitiveTypeMatcher;
|
|
526
|
-
toEqual:
|
|
557
|
+
toEqual: ToBe;
|
|
527
558
|
toHaveProperty: ToHaveProperty;
|
|
528
559
|
toMatch: ToMatch;
|
|
529
560
|
toRaiseError: ToRaiseError;
|
|
@@ -532,48 +563,19 @@ declare class Expect {
|
|
|
532
563
|
match(assertion: Assertion, expectResult: ExpectResult): MatchResult | undefined;
|
|
533
564
|
}
|
|
534
565
|
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
* @param log - Message to write to the stream.
|
|
541
|
-
*/
|
|
542
|
-
write: (log: string) => void;
|
|
566
|
+
interface ReadStream {
|
|
567
|
+
on: (event: "data", listener: (chunk: string) => void) => this;
|
|
568
|
+
setEncoding: (encoding: "utf8") => this;
|
|
569
|
+
setRawMode?: (mode: boolean) => this;
|
|
570
|
+
unref: () => this;
|
|
543
571
|
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
*/
|
|
547
|
-
interface LoggerOptions {
|
|
548
|
-
/**
|
|
549
|
-
* Specifies whether color should be disabled in the output. Default: `Environment.noColor`.
|
|
550
|
-
*/
|
|
551
|
-
noColor?: boolean;
|
|
552
|
-
/**
|
|
553
|
-
* A stream to write warnings and errors. Default: `process.stderr`.
|
|
554
|
-
*/
|
|
555
|
-
stderr?: WriteStream;
|
|
556
|
-
/**
|
|
557
|
-
* A stream to write informational messages. Default: `process.stdout`.
|
|
558
|
-
*/
|
|
559
|
-
stdout?: WriteStream;
|
|
572
|
+
interface InputServiceOptions {
|
|
573
|
+
stdin?: ReadStream;
|
|
560
574
|
}
|
|
561
|
-
|
|
562
|
-
* Wraps the provided streams with a set of convenience methods.
|
|
563
|
-
*/
|
|
564
|
-
declare class Logger {
|
|
575
|
+
declare class InputService {
|
|
565
576
|
#private;
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
*/
|
|
569
|
-
constructor(options?: LoggerOptions);
|
|
570
|
-
/**
|
|
571
|
-
* Moves the cursor one line up in the `stdout` stream and erases that line.
|
|
572
|
-
*/
|
|
573
|
-
eraseLastLine(): void;
|
|
574
|
-
writeError(body: JSX.Element | Array<JSX.Element>): void;
|
|
575
|
-
writeMessage(body: JSX.Element | Array<JSX.Element>): void;
|
|
576
|
-
writeWarning(body: JSX.Element | Array<JSX.Element>): void;
|
|
577
|
+
constructor(options?: InputServiceOptions);
|
|
578
|
+
dispose(): void;
|
|
577
579
|
}
|
|
578
580
|
|
|
579
581
|
declare function addsPackageStepText(compilerVersion: string, installationPath: string): JSX.Element;
|
|
@@ -590,6 +592,24 @@ declare function formattedText(input: string | Array<string> | Record<string, un
|
|
|
590
592
|
|
|
591
593
|
declare function helpText(optionDefinitions: Map<string, OptionDefinition>, tstycheVersion: string): JSX.Element;
|
|
592
594
|
|
|
595
|
+
interface WriteStream {
|
|
596
|
+
write: (log: string) => void;
|
|
597
|
+
}
|
|
598
|
+
interface OutputServiceOptions {
|
|
599
|
+
noColor?: boolean;
|
|
600
|
+
stderr?: WriteStream;
|
|
601
|
+
stdout?: WriteStream;
|
|
602
|
+
}
|
|
603
|
+
declare class OutputService {
|
|
604
|
+
#private;
|
|
605
|
+
constructor(options?: OutputServiceOptions);
|
|
606
|
+
clearTerminal(): void;
|
|
607
|
+
eraseLastLine(): void;
|
|
608
|
+
writeError(body: JSX.Element | Array<JSX.Element>): void;
|
|
609
|
+
writeMessage(body: JSX.Element | Array<JSX.Element>): void;
|
|
610
|
+
writeWarning(body: JSX.Element | Array<JSX.Element>): void;
|
|
611
|
+
}
|
|
612
|
+
|
|
593
613
|
declare function summaryText({ duration, expectCount, fileCount, onlyMatch, pathMatch, skipMatch, targetCount, testCount, }: {
|
|
594
614
|
duration: number;
|
|
595
615
|
expectCount: ResultCount;
|
|
@@ -607,6 +627,8 @@ declare function usesCompilerStepText(compilerVersion: string, tsconfigFilePath:
|
|
|
607
627
|
prependEmptyLine: boolean;
|
|
608
628
|
}): JSX.Element;
|
|
609
629
|
|
|
630
|
+
declare function watchModeUsageText(): JSX.Element;
|
|
631
|
+
|
|
610
632
|
declare class Path {
|
|
611
633
|
static dirname(filePath: string): string;
|
|
612
634
|
static join(...filePaths: Array<string>): string;
|
|
@@ -627,7 +649,7 @@ declare class ProjectService {
|
|
|
627
649
|
|
|
628
650
|
declare abstract class Reporter {
|
|
629
651
|
readonly resolvedConfig: ResolvedConfig;
|
|
630
|
-
protected
|
|
652
|
+
protected outputService: OutputService;
|
|
631
653
|
constructor(resolvedConfig: ResolvedConfig);
|
|
632
654
|
abstract handleEvent([eventName, payload]: Event): void;
|
|
633
655
|
}
|
|
@@ -641,6 +663,10 @@ declare class ThoroughReporter extends Reporter {
|
|
|
641
663
|
handleEvent([eventName, payload]: Event): void;
|
|
642
664
|
}
|
|
643
665
|
|
|
666
|
+
declare class WatchModeReporter extends Reporter {
|
|
667
|
+
handleEvent([eventName]: Event): void;
|
|
668
|
+
}
|
|
669
|
+
|
|
644
670
|
declare class TaskRunner {
|
|
645
671
|
#private;
|
|
646
672
|
readonly resolvedConfig: ResolvedConfig;
|
|
@@ -704,35 +730,14 @@ declare global {
|
|
|
704
730
|
}
|
|
705
731
|
}
|
|
706
732
|
}
|
|
707
|
-
/**
|
|
708
|
-
* Options to configure an instance of the {@link Scribbler}.
|
|
709
|
-
*/
|
|
710
733
|
interface ScribblerOptions {
|
|
711
|
-
/**
|
|
712
|
-
* The end of line sequence to be used in the output. Default: `"\n"`.
|
|
713
|
-
*/
|
|
714
734
|
newLine?: string;
|
|
715
|
-
/**
|
|
716
|
-
* Do not include ANSI color escape codes in the output. Default: `false`.
|
|
717
|
-
*/
|
|
718
735
|
noColor?: boolean;
|
|
719
736
|
}
|
|
720
|
-
/**
|
|
721
|
-
* Provides the JSX factory function and renderer.
|
|
722
|
-
*/
|
|
723
737
|
declare class Scribbler {
|
|
724
738
|
#private;
|
|
725
|
-
/**
|
|
726
|
-
* @param options - {@link ScribblerOptions | Options} to configure an instance of the Scribbler.
|
|
727
|
-
*/
|
|
728
739
|
constructor(options?: ScribblerOptions);
|
|
729
|
-
/**
|
|
730
|
-
* Creates a new text element of the given `type`.
|
|
731
|
-
*/
|
|
732
740
|
static createElement(type: ComponentConstructor | string, props: Record<string, unknown> | null, ...children: Array<ElementChildren>): JSX.Element;
|
|
733
|
-
/**
|
|
734
|
-
* Renders the provided JSX `element` and returns the resulting string.
|
|
735
|
-
*/
|
|
736
741
|
render(element: JSX.Element | null): string;
|
|
737
742
|
}
|
|
738
743
|
|
|
@@ -754,4 +759,12 @@ declare class Version {
|
|
|
754
759
|
static isVersionTag(target: string): boolean;
|
|
755
760
|
}
|
|
756
761
|
|
|
757
|
-
|
|
762
|
+
type RunCallback = (testFiles: Array<string>) => Promise<void>;
|
|
763
|
+
declare class Watcher {
|
|
764
|
+
#private;
|
|
765
|
+
readonly resolvedConfig: ResolvedConfig;
|
|
766
|
+
constructor(resolvedConfig: ResolvedConfig, runCallback: RunCallback, selectService: SelectService, testFiles: Array<string>);
|
|
767
|
+
watch(): Promise<void>;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
export { Assertion, CancellationToken, Cli, CollectService, Color, type CommandLineOptions, type ConfigFileOptions, ConfigService, DescribeResult, Diagnostic, DiagnosticCategory, type DiagnosticOrigin, Environment, type Event, EventEmitter, type EventHandler, Expect, ExpectResult, FileResult, type FileResultStatus, InputService, type InputServiceOptions, type ItemDefinition, Line, type MatchResult, OptionBrand, type OptionDefinition, OptionDefinitionsMap, OptionGroup, OutputService, type OutputServiceOptions, Path, ProjectResult, ProjectService, type ReadStream, Reporter, type ResolvedConfig, Result, ResultCount, ResultManager, ResultStatus, ResultTiming, Scribbler, type ScribblerOptions, SelectService, StoreService, SummaryReporter, TSTyche, TargetResult, type TargetResultStatus, TaskRunner, TestMember, TestMemberBrand, TestMemberFlags, TestResult, TestTree, Text, ThoroughReporter, type TypeChecker, Version, WatchModeReporter, Watcher, type WriteStream, addsPackageStepText, describeNameText, diagnosticText, fileStatusText, fileViewText, formattedText, helpText, summaryText, testNameText, usesCompilerStepText, watchModeUsageText };
|