tstyche 1.0.0-beta.0 → 1.0.0-beta.2
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 +10 -2
- package/build/index-cjs.d.ts +276 -0
- package/build/index-cjs.js +18 -0
- package/package.json +6 -7
package/README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
# TSTyche
|
|
2
2
|
|
|
3
|
+
[![version][version-src]][version-href]
|
|
3
4
|
[![license][license-src]][license-href]
|
|
5
|
+
[![checks][checks-src]][checks-href]
|
|
6
|
+
[![coverage][coverage-src]][coverage-href]
|
|
4
7
|
|
|
5
8
|
The Essential Type Testing Tool.
|
|
6
9
|
|
|
@@ -69,12 +72,17 @@ This simple!
|
|
|
69
72
|
|
|
70
73
|
## Documentation
|
|
71
74
|
|
|
72
|
-
Visit [https://tstyche.org]
|
|
75
|
+
Visit [https://tstyche.org](https://tstyche.org) to view the full documentation.
|
|
73
76
|
|
|
74
77
|
## License
|
|
75
78
|
|
|
76
79
|
[MIT][license-href] © TSTyche
|
|
77
80
|
|
|
78
|
-
[
|
|
81
|
+
[version-src]: https://badgen.net/npm/v/tstyche
|
|
82
|
+
[version-href]: https://npmjs.com/package/tstyche
|
|
79
83
|
[license-src]: https://badgen.net/github/license/tstyche/tstyche
|
|
80
84
|
[license-href]: https://github.com/tstyche/tstyche/blob/main/LICENSE.md
|
|
85
|
+
[checks-src]: https://badgen.net/github/checks/tstyche/tstyche
|
|
86
|
+
[checks-href]: https://github.com/tstyche/tstyche/actions/workflows/checks.yml
|
|
87
|
+
[coverage-src]: https://badgen.net/codecov/c/github/tstyche/tstyche
|
|
88
|
+
[coverage-href]: https://app.codecov.io/gh/tstyche/tstyche
|
|
@@ -0,0 +1,276 @@
|
|
|
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 source type is `any`.
|
|
64
|
+
*/
|
|
65
|
+
toBeAny: () => void;
|
|
66
|
+
/**
|
|
67
|
+
* Checks if the target type is assignable to the source type.
|
|
68
|
+
*/
|
|
69
|
+
toBeAssignable: {
|
|
70
|
+
/**
|
|
71
|
+
* Checks if the target type is assignable to the source type.
|
|
72
|
+
*/
|
|
73
|
+
<Target>(): void;
|
|
74
|
+
/**
|
|
75
|
+
* Checks if type of the target expression is assignable to the source type.
|
|
76
|
+
*/
|
|
77
|
+
(target: unknown): void;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Checks if the source type is `bigint`.
|
|
81
|
+
*/
|
|
82
|
+
toBeBigInt: () => void;
|
|
83
|
+
/**
|
|
84
|
+
* Checks if the source type is `boolean`.
|
|
85
|
+
*/
|
|
86
|
+
toBeBoolean: () => void;
|
|
87
|
+
/**
|
|
88
|
+
* Checks if the source type is `never`.
|
|
89
|
+
*/
|
|
90
|
+
toBeNever: () => void;
|
|
91
|
+
/**
|
|
92
|
+
* Checks if the source type is `null`.
|
|
93
|
+
*/
|
|
94
|
+
toBeNull: () => void;
|
|
95
|
+
/**
|
|
96
|
+
* Checks if the source type is `number`.
|
|
97
|
+
*/
|
|
98
|
+
toBeNumber: () => void;
|
|
99
|
+
/**
|
|
100
|
+
* Checks if the source type is `string`.
|
|
101
|
+
*/
|
|
102
|
+
toBeString: () => void;
|
|
103
|
+
/**
|
|
104
|
+
* Checks if the source type is `symbol`.
|
|
105
|
+
*/
|
|
106
|
+
toBeSymbol: () => void;
|
|
107
|
+
/**
|
|
108
|
+
* Checks if the source type is `undefined`.
|
|
109
|
+
*/
|
|
110
|
+
toBeUndefined: () => void;
|
|
111
|
+
/**
|
|
112
|
+
* Checks if the source type is `unique symbol`.
|
|
113
|
+
*/
|
|
114
|
+
toBeUniqueSymbol: () => void;
|
|
115
|
+
/**
|
|
116
|
+
* Checks if the source type is `unknown`.
|
|
117
|
+
*/
|
|
118
|
+
toBeUnknown: () => void;
|
|
119
|
+
/**
|
|
120
|
+
* Checks if the source type is `void`.
|
|
121
|
+
*/
|
|
122
|
+
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 the target type is a subtype the source type.
|
|
138
|
+
*/
|
|
139
|
+
toMatch: {
|
|
140
|
+
/**
|
|
141
|
+
* Checks if the target type is a subtype the source type.
|
|
142
|
+
*/
|
|
143
|
+
<Target>(): void;
|
|
144
|
+
/**
|
|
145
|
+
* Checks if type of the target expression is a subtype the source type.
|
|
146
|
+
*/
|
|
147
|
+
(target: unknown): void;
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Checks if the source type raises an error.
|
|
151
|
+
*/
|
|
152
|
+
toRaiseError: (...target: Array<string | number>) => void;
|
|
153
|
+
}
|
|
154
|
+
interface Modifier {
|
|
155
|
+
/**
|
|
156
|
+
* Passes the source type to the matcher.
|
|
157
|
+
*/
|
|
158
|
+
type: Matchers & {
|
|
159
|
+
/**
|
|
160
|
+
* Negates the assertion.
|
|
161
|
+
*/
|
|
162
|
+
not: Matchers;
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
interface Expect {
|
|
166
|
+
/**
|
|
167
|
+
* Builds an assertion.
|
|
168
|
+
*
|
|
169
|
+
* @typeParam Source - The type against which the assertion will be made.
|
|
170
|
+
*/
|
|
171
|
+
<Source>(): Modifier;
|
|
172
|
+
/**
|
|
173
|
+
* Builds an assertion.
|
|
174
|
+
*
|
|
175
|
+
* @param source - The expression against which type the assertion will be made.
|
|
176
|
+
*/
|
|
177
|
+
(source: unknown): Modifier;
|
|
178
|
+
fail: {
|
|
179
|
+
/**
|
|
180
|
+
* Mark an assertion as supposed to fail.
|
|
181
|
+
*
|
|
182
|
+
* @typeParam Source - The type against which the assertion will be made.
|
|
183
|
+
*/
|
|
184
|
+
<Source>(): Modifier;
|
|
185
|
+
/**
|
|
186
|
+
* Mark an assertion as supposed to fail.
|
|
187
|
+
*
|
|
188
|
+
* @param source - The expression against which type the assertion will be made.
|
|
189
|
+
*/
|
|
190
|
+
(source: unknown): Modifier;
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Marks an assertion as focused.
|
|
194
|
+
*/
|
|
195
|
+
only: {
|
|
196
|
+
/**
|
|
197
|
+
* Marks an assertion as focused.
|
|
198
|
+
*
|
|
199
|
+
* @typeParam Source - The type against which the assertion will be made.
|
|
200
|
+
*/
|
|
201
|
+
<Source>(): Modifier;
|
|
202
|
+
/**
|
|
203
|
+
* Marks an assertion as focused.
|
|
204
|
+
*
|
|
205
|
+
* @param source - The expression against which type the assertion will be made.
|
|
206
|
+
*/
|
|
207
|
+
(source: unknown): Modifier;
|
|
208
|
+
fail: {
|
|
209
|
+
/**
|
|
210
|
+
* Mark an assertion as supposed to fail.
|
|
211
|
+
*
|
|
212
|
+
* @typeParam Source - The type against which the assertion will be made.
|
|
213
|
+
*/
|
|
214
|
+
<Source>(): Modifier;
|
|
215
|
+
/**
|
|
216
|
+
* Mark an assertion as supposed to fail.
|
|
217
|
+
*
|
|
218
|
+
* @param source - The expression against which type the assertion will be made.
|
|
219
|
+
*/
|
|
220
|
+
(source: unknown): Modifier;
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* Marks an assertion as skipped.
|
|
225
|
+
*/
|
|
226
|
+
skip: {
|
|
227
|
+
/**
|
|
228
|
+
* Marks an assertion as skipped.
|
|
229
|
+
*
|
|
230
|
+
* @typeParam Source - The type against which the assertion will be made.
|
|
231
|
+
*/
|
|
232
|
+
<Source>(): Modifier;
|
|
233
|
+
/**
|
|
234
|
+
* Marks an assertion as skipped.
|
|
235
|
+
*
|
|
236
|
+
* @param source - The expression against which type the assertion will be made.
|
|
237
|
+
*/
|
|
238
|
+
(source: unknown): Modifier;
|
|
239
|
+
fail: {
|
|
240
|
+
/**
|
|
241
|
+
* Marks an assertion as supposed to fail.
|
|
242
|
+
*
|
|
243
|
+
* @typeParam Source - The type against which the assertion will be made.
|
|
244
|
+
*/
|
|
245
|
+
<Source>(): Modifier;
|
|
246
|
+
/**
|
|
247
|
+
* Marks an assertion as supposed to fail.
|
|
248
|
+
*
|
|
249
|
+
* @param source - The expression against which type the assertion will be made.
|
|
250
|
+
*/
|
|
251
|
+
(source: unknown): Modifier;
|
|
252
|
+
};
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Defines a test group.
|
|
257
|
+
*/
|
|
258
|
+
declare const describe: Describe;
|
|
259
|
+
/**
|
|
260
|
+
* Defines a test group.
|
|
261
|
+
*/
|
|
262
|
+
declare const context: Describe;
|
|
263
|
+
/**
|
|
264
|
+
* Defines a single test.
|
|
265
|
+
*/
|
|
266
|
+
declare const test: Test;
|
|
267
|
+
/**
|
|
268
|
+
* Defines a single test.
|
|
269
|
+
*/
|
|
270
|
+
declare const it: Test;
|
|
271
|
+
/**
|
|
272
|
+
* Builds an assertion.
|
|
273
|
+
*/
|
|
274
|
+
declare const expect: Expect;
|
|
275
|
+
|
|
276
|
+
export { context, describe, expect, it, test };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
function doNothing() {
|
|
4
|
+
}
|
|
5
|
+
const noopChain = new Proxy(doNothing, {
|
|
6
|
+
apply() {
|
|
7
|
+
return noopChain;
|
|
8
|
+
},
|
|
9
|
+
get() {
|
|
10
|
+
return noopChain;
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
exports.context = noopChain;
|
|
15
|
+
exports.describe = noopChain;
|
|
16
|
+
exports.expect = noopChain;
|
|
17
|
+
exports.it = noopChain;
|
|
18
|
+
exports.test = noopChain;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tstyche",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
4
4
|
"description": "The Essential Type Testing Tool.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -21,17 +21,16 @@
|
|
|
21
21
|
"exports": {
|
|
22
22
|
".": {
|
|
23
23
|
"import": "./build/index.js",
|
|
24
|
-
"require": "./build/index.
|
|
24
|
+
"require": "./build/index-cjs.js"
|
|
25
25
|
},
|
|
26
26
|
"./package.json": "./package.json",
|
|
27
27
|
"./tstyche": "./build/tstyche.js"
|
|
28
28
|
},
|
|
29
|
-
"main": "./build/index.
|
|
30
|
-
"types": "./build/index.d.
|
|
29
|
+
"main": "./build/index-cjs.js",
|
|
30
|
+
"types": "./build/index-cjs.d.ts",
|
|
31
31
|
"bin": "build/bin.js",
|
|
32
32
|
"files": [
|
|
33
|
-
"build
|
|
34
|
-
"build/**/*.js",
|
|
33
|
+
"build/*",
|
|
35
34
|
"lib/*.json"
|
|
36
35
|
],
|
|
37
36
|
"scripts": {
|
|
@@ -76,7 +75,7 @@
|
|
|
76
75
|
"jest-serializer-ansi-escapes": "2.0.1",
|
|
77
76
|
"magic-string": "0.30.5",
|
|
78
77
|
"prettier": "3.0.3",
|
|
79
|
-
"rollup": "4.3.
|
|
78
|
+
"rollup": "4.3.1",
|
|
80
79
|
"rollup-plugin-dts": "6.1.0",
|
|
81
80
|
"rollup-plugin-tsconfig-paths": "1.5.2",
|
|
82
81
|
"ts-node": "10.9.1",
|