testeranto 0.90.0 → 0.100.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/bundle.js +4 -7
- package/dist/common/src/Node.js +5 -3
- package/dist/common/src/PM/main.js +254 -126
- package/dist/common/src/PM/node.js +20 -5
- package/dist/common/src/PM/web.js +19 -4
- package/dist/common/src/SubPackages/puppeteer.js +1 -1
- package/dist/common/src/SubPackages/react/jsx/index.js +14 -6
- package/dist/common/src/SubPackages/react/jsx/node.js +2 -2
- package/dist/common/src/SubPackages/react-dom/component/web.js +13 -39
- package/dist/common/src/SubPackages/react-test-renderer/component/interface.js +2 -10
- package/dist/common/src/Web.js +25 -21
- package/dist/common/src/cli.js +439 -0
- package/dist/common/src/cli2.js +144 -0
- package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +18 -8
- package/dist/common/src/esbuildConfigs/node.js +1 -4
- package/dist/common/src/esbuildConfigs/web.js +1 -1
- package/dist/common/src/lib/abstractBase.js +31 -263
- package/dist/common/src/lib/basebuilder.js +1 -11
- package/dist/common/src/lib/classBuilder.js +1 -1
- package/dist/common/src/lib/core.js +8 -28
- package/dist/common/src/lib/types.js +1 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/src/Node.js +5 -3
- package/dist/module/src/PM/main.js +254 -126
- package/dist/module/src/PM/node.js +20 -5
- package/dist/module/src/PM/web.js +19 -4
- package/dist/module/src/SubPackages/puppeteer.js +1 -1
- package/dist/module/src/SubPackages/react/jsx/index.js +14 -6
- package/dist/module/src/SubPackages/react/jsx/node.js +2 -2
- package/dist/module/src/SubPackages/react-dom/component/web.js +13 -39
- package/dist/module/src/SubPackages/react-test-renderer/component/interface.js +2 -10
- package/dist/module/src/Web.js +25 -21
- package/dist/module/src/cli.js +411 -0
- package/dist/module/src/cli2.js +116 -0
- package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +18 -8
- package/dist/module/src/esbuildConfigs/node.js +1 -4
- package/dist/module/src/esbuildConfigs/web.js +1 -1
- package/dist/module/src/lib/abstractBase.js +31 -263
- package/dist/module/src/lib/basebuilder.js +1 -11
- package/dist/module/src/lib/classBuilder.js +1 -1
- package/dist/module/src/lib/core.js +8 -28
- package/dist/module/src/lib/types.js +1 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/cli.mjs +1491 -0
- package/dist/prebuild/{run-tests.mjs → cli2.mjs} +223 -212
- package/dist/types/src/Node.d.ts +6 -3
- package/dist/types/src/PM/index.d.ts +10 -2
- package/dist/types/src/PM/main.d.ts +14 -7
- package/dist/types/src/PM/node.d.ts +9 -2
- package/dist/types/src/PM/web.d.ts +9 -3
- package/dist/types/src/SubPackages/puppeteer.d.ts +1 -1
- package/dist/types/src/SubPackages/react/component/node.d.ts +1 -1
- package/dist/types/src/SubPackages/react/component/web.d.ts +1 -1
- package/dist/types/src/SubPackages/react/jsx/node.d.ts +3 -3
- package/dist/types/src/SubPackages/react/jsx/web.d.ts +2 -2
- package/dist/types/src/SubPackages/react-dom/component/node.d.ts +2 -2
- package/dist/types/src/SubPackages/react-dom/component/web.d.ts +1 -1
- package/dist/types/src/SubPackages/react-dom/jsx/node.d.ts +1 -1
- package/dist/types/src/SubPackages/react-dom/jsx/web.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/component/interface.d.ts +1 -1
- package/dist/types/src/SubPackages/react-test-renderer/component/node.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/component/web.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/fc/node.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/fc/web.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/jsx/node.d.ts +3 -2
- package/dist/types/src/SubPackages/react-test-renderer/jsx/web.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/node.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/web.d.ts +2 -2
- package/dist/types/src/Types.d.ts +60 -21
- package/dist/types/src/Web.d.ts +3 -3
- package/dist/types/src/lib/abstractBase.d.ts +6 -2
- package/dist/types/src/lib/core.d.ts +3 -3
- package/dist/types/src/lib/index.d.ts +1 -1
- package/dist/types/src/lib/types.d.ts +6 -30
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +23 -20
- package/src/Node.ts +6 -3
- package/src/PM/index.ts +12 -8
- package/src/PM/main.ts +331 -165
- package/src/PM/node.ts +42 -7
- package/src/PM/web.ts +33 -5
- package/src/SubPackages/puppeteer.ts +1 -1
- package/src/SubPackages/react/jsx/index.ts +15 -7
- package/src/SubPackages/react/jsx/node.ts +18 -6
- package/src/SubPackages/react-dom/component/web.ts +28 -51
- package/src/SubPackages/react-test-renderer/component/interface.ts +4 -11
- package/src/SubPackages/react-test-renderer/jsx/node.ts +16 -1
- package/src/Types.ts +362 -114
- package/src/Web.ts +45 -23
- package/src/cli.ts +535 -0
- package/src/cli2.ts +157 -0
- package/src/esbuildConfigs/inputFilesPlugin.ts +27 -9
- package/src/esbuildConfigs/node.ts +4 -7
- package/src/esbuildConfigs/web.ts +4 -3
- package/src/lib/abstractBase.ts +84 -291
- package/src/lib/basebuilder.ts +1 -12
- package/src/lib/classBuilder.ts +2 -1
- package/src/lib/core.ts +17 -29
- package/src/lib/types.ts +5 -177
- package/dist/common/src/Aider.js +0 -143
- package/dist/common/src/Project.js +0 -225
- package/dist/common/src/Puppeteer.js +0 -113
- package/dist/common/src/build-tests.js +0 -39
- package/dist/common/src/esbuildConfigs/features.js +0 -14
- package/dist/common/src/esbuildConfigs/report.js +0 -14
- package/dist/common/src/esbuildConfigs/tests.js +0 -13
- package/dist/common/src/run-tests.js +0 -39
- package/dist/module/src/Aider.js +0 -136
- package/dist/module/src/Project.js +0 -218
- package/dist/module/src/Puppeteer.js +0 -108
- package/dist/module/src/build-tests.js +0 -11
- package/dist/module/src/esbuildConfigs/features.js +0 -12
- package/dist/module/src/esbuildConfigs/report.js +0 -14
- package/dist/module/src/esbuildConfigs/tests.js +0 -11
- package/dist/module/src/run-tests.js +0 -11
- package/dist/prebuild/build-tests.mjs +0 -552
- package/dist/types/src/Aider.d.ts +0 -1
- package/dist/types/src/Project.d.ts +0 -12
- package/dist/types/src/Puppeteer.d.ts +0 -2
- package/dist/types/src/esbuildConfigs/features.d.ts +0 -4
- package/dist/types/src/esbuildConfigs/report.d.ts +0 -0
- package/dist/types/src/esbuildConfigs/tests.d.ts +0 -4
- package/src/Aider.ts +0 -168
- package/src/Project.ts +0 -291
- package/src/Puppeteer.ts +0 -145
- package/src/build-tests.ts +0 -12
- package/src/esbuildConfigs/features.ts +0 -17
- package/src/esbuildConfigs/report.ts +0 -15
- package/src/esbuildConfigs/tests.ts +0 -14
- package/src/run-tests.ts +0 -12
- /package/dist/types/src/{build-tests.d.ts → cli.d.ts} +0 -0
- /package/dist/types/src/{run-tests.d.ts → cli2.d.ts} +0 -0
package/src/Types.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ITTestResourceConfiguration,
|
|
3
|
+
ITestArtificer,
|
|
4
|
+
ITestCheckCallback,
|
|
5
|
+
} from "./lib/index.js";
|
|
2
6
|
import {
|
|
3
7
|
IGivens,
|
|
4
8
|
BaseCheck,
|
|
@@ -7,16 +11,10 @@ import {
|
|
|
7
11
|
BaseThen,
|
|
8
12
|
BaseGiven,
|
|
9
13
|
} from "./lib/abstractBase.js";
|
|
10
|
-
import Testeranto from "./lib/core.js";
|
|
11
|
-
import {
|
|
12
|
-
INodeTestInterface,
|
|
13
|
-
ITestInterface,
|
|
14
|
-
IWebTestInterface,
|
|
15
|
-
} from "./lib/types.js";
|
|
16
14
|
import { PM } from "./PM/index.js";
|
|
17
15
|
|
|
18
|
-
export type
|
|
19
|
-
|
|
16
|
+
export type IWebTestInterface<
|
|
17
|
+
ITestShape extends IBaseTest<
|
|
20
18
|
unknown,
|
|
21
19
|
unknown,
|
|
22
20
|
unknown,
|
|
@@ -30,43 +28,166 @@ export type IPartialInterface<
|
|
|
30
28
|
Record<string, any>,
|
|
31
29
|
Record<string, any>
|
|
32
30
|
>
|
|
33
|
-
> =
|
|
31
|
+
> = {
|
|
32
|
+
assertThis: (x: ITestShape["then"]) => void;
|
|
33
|
+
andWhen: (
|
|
34
|
+
store: ITestShape["istore"],
|
|
35
|
+
whenCB: ITestShape["when"],
|
|
36
|
+
testResource: ITTestResourceConfiguration,
|
|
37
|
+
utils: PM
|
|
38
|
+
) => Promise<ITestShape["istore"]>;
|
|
39
|
+
butThen: (
|
|
40
|
+
store: ITestShape["istore"],
|
|
41
|
+
thenCB,
|
|
42
|
+
testResource: ITTestResourceConfiguration,
|
|
43
|
+
utils: PM
|
|
44
|
+
) => Promise<ITestShape["iselection"]>;
|
|
45
|
+
afterAll: (
|
|
46
|
+
store: ITestShape["istore"],
|
|
47
|
+
artificer: ITestArtificer,
|
|
48
|
+
utils: PM
|
|
49
|
+
) => any;
|
|
50
|
+
afterEach: (
|
|
51
|
+
store: ITestShape["istore"],
|
|
52
|
+
key: string,
|
|
53
|
+
artificer: ITestArtificer,
|
|
54
|
+
utils: PM
|
|
55
|
+
) => Promise<unknown>;
|
|
56
|
+
beforeAll: (
|
|
57
|
+
input: ITestShape["iinput"],
|
|
58
|
+
testResource: ITTestResourceConfiguration,
|
|
59
|
+
artificer: ITestArtificer,
|
|
60
|
+
utils: PM
|
|
61
|
+
) => Promise<ITestShape["isubject"]>;
|
|
62
|
+
beforeEach: (
|
|
63
|
+
subject: ITestShape["isubject"],
|
|
64
|
+
initializer: (c?) => ITestShape["given"],
|
|
65
|
+
artificer: ITestArtificer,
|
|
66
|
+
testResource: ITTestResourceConfiguration,
|
|
67
|
+
initialValues,
|
|
68
|
+
utils: PM
|
|
69
|
+
) => Promise<ITestShape["istore"]>;
|
|
70
|
+
};
|
|
34
71
|
|
|
35
|
-
export type
|
|
36
|
-
I extends
|
|
72
|
+
export type INodeTestInterface<
|
|
73
|
+
I extends Ibdd_in<
|
|
37
74
|
unknown,
|
|
38
75
|
unknown,
|
|
39
76
|
unknown,
|
|
40
77
|
unknown,
|
|
41
78
|
unknown,
|
|
42
79
|
unknown,
|
|
43
|
-
unknown
|
|
44
|
-
Record<string, any>,
|
|
45
|
-
Record<string, any>,
|
|
46
|
-
Record<string, any>,
|
|
47
|
-
Record<string, any>,
|
|
48
|
-
Record<string, any>
|
|
80
|
+
unknown
|
|
49
81
|
>
|
|
50
|
-
> =
|
|
51
|
-
|
|
52
|
-
|
|
82
|
+
> = {
|
|
83
|
+
assertThis: (x: I["then"]) => void;
|
|
84
|
+
andWhen: (
|
|
85
|
+
store: I["istore"],
|
|
86
|
+
whenCB: I["when"],
|
|
87
|
+
testResource: ITTestResourceConfiguration,
|
|
88
|
+
utils: PM
|
|
89
|
+
) => Promise<I["istore"]>;
|
|
90
|
+
butThen: (
|
|
91
|
+
store: I["istore"],
|
|
92
|
+
thenCB,
|
|
93
|
+
testResource: ITTestResourceConfiguration,
|
|
94
|
+
utils: PM
|
|
95
|
+
) => Promise<I["iselection"]>;
|
|
96
|
+
afterAll: (store: I["istore"], artificer: ITestArtificer, pm: PM) => any;
|
|
97
|
+
afterEach: (
|
|
98
|
+
store: I["istore"],
|
|
99
|
+
key: string,
|
|
100
|
+
artificer: ITestArtificer,
|
|
101
|
+
pm: PM
|
|
102
|
+
) => Promise<unknown>;
|
|
103
|
+
beforeAll: (
|
|
104
|
+
input: I["iinput"],
|
|
105
|
+
testResource: ITTestResourceConfiguration,
|
|
106
|
+
artificer: ITestArtificer,
|
|
107
|
+
pm: PM
|
|
108
|
+
) => Promise<I["isubject"]>;
|
|
109
|
+
beforeEach: (
|
|
110
|
+
subject: I["isubject"],
|
|
111
|
+
initializer: (c?) => I["given"],
|
|
112
|
+
artificer: ITestArtificer,
|
|
113
|
+
testResource: ITTestResourceConfiguration,
|
|
114
|
+
initialValues,
|
|
115
|
+
pm: PM
|
|
116
|
+
) => Promise<I["istore"]>;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export type ITestInterface<
|
|
120
|
+
I extends Ibdd_in<
|
|
53
121
|
unknown,
|
|
54
122
|
unknown,
|
|
55
123
|
unknown,
|
|
56
124
|
unknown,
|
|
57
125
|
unknown,
|
|
58
126
|
unknown,
|
|
127
|
+
unknown
|
|
128
|
+
>
|
|
129
|
+
> = {
|
|
130
|
+
assertThis: (x: I["then"]) => void;
|
|
131
|
+
andWhen: (
|
|
132
|
+
store: I["istore"],
|
|
133
|
+
whenCB: I["when"],
|
|
134
|
+
testResource: ITTestResourceConfiguration,
|
|
135
|
+
pm: PM
|
|
136
|
+
) => Promise<I["istore"]>;
|
|
137
|
+
butThen: (
|
|
138
|
+
store: I["istore"],
|
|
139
|
+
thenCB: I["then"],
|
|
140
|
+
testResource: ITTestResourceConfiguration,
|
|
141
|
+
pm: PM
|
|
142
|
+
) => Promise<I["iselection"]>;
|
|
143
|
+
afterAll: (store: I["istore"], artificer: ITestArtificer, pm: PM) => any;
|
|
144
|
+
afterEach: (
|
|
145
|
+
store: I["istore"],
|
|
146
|
+
key: string,
|
|
147
|
+
artificer: ITestArtificer,
|
|
148
|
+
pm: PM
|
|
149
|
+
) => Promise<unknown>;
|
|
150
|
+
beforeAll: (
|
|
151
|
+
input: I["iinput"],
|
|
152
|
+
testResource: ITTestResourceConfiguration,
|
|
153
|
+
artificer: ITestArtificer,
|
|
154
|
+
pm: PM
|
|
155
|
+
) => Promise<I["isubject"]>;
|
|
156
|
+
beforeEach: (
|
|
157
|
+
subject: I["isubject"],
|
|
158
|
+
initializer: (c?) => I["given"],
|
|
159
|
+
artificer: ITestArtificer,
|
|
160
|
+
testResource: ITTestResourceConfiguration,
|
|
161
|
+
initialValues,
|
|
162
|
+
pm: PM
|
|
163
|
+
) => Promise<I["istore"]>;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
export type IPartialInterface<
|
|
167
|
+
I extends Ibdd_in<
|
|
59
168
|
unknown,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
169
|
+
unknown,
|
|
170
|
+
unknown,
|
|
171
|
+
unknown,
|
|
172
|
+
unknown,
|
|
173
|
+
unknown,
|
|
174
|
+
unknown
|
|
65
175
|
>
|
|
66
|
-
> = Partial<
|
|
176
|
+
> = Partial<ITestInterface<I>>;
|
|
67
177
|
|
|
68
|
-
export type
|
|
69
|
-
|
|
178
|
+
export type IPartialNodeInterface<
|
|
179
|
+
I extends Ibdd_in<
|
|
180
|
+
unknown,
|
|
181
|
+
unknown,
|
|
182
|
+
unknown,
|
|
183
|
+
unknown,
|
|
184
|
+
unknown,
|
|
185
|
+
unknown,
|
|
186
|
+
unknown
|
|
187
|
+
>
|
|
188
|
+
> = Partial<INodeTestInterface<I>>;
|
|
189
|
+
export type IPartialWebInterface<
|
|
190
|
+
I extends IBaseTest<
|
|
70
191
|
unknown,
|
|
71
192
|
unknown,
|
|
72
193
|
unknown,
|
|
@@ -80,23 +201,10 @@ export type IEntry<
|
|
|
80
201
|
Record<string, any>,
|
|
81
202
|
Record<string, any>
|
|
82
203
|
>
|
|
83
|
-
> =
|
|
84
|
-
input: ITestShape["iinput"],
|
|
85
|
-
testSpecification: ITestSpecification<ITestShape>,
|
|
86
|
-
testImplementation: ITestImplementation<ITestShape, object>,
|
|
87
|
-
testInterface: IPartialInterface<ITestShape>,
|
|
88
|
-
testResourceRequirement: ITTestResourceRequest
|
|
89
|
-
) => Promise<Testeranto<ITestShape>>;
|
|
204
|
+
> = Partial<IWebTestInterface<I>>;
|
|
90
205
|
|
|
91
206
|
export type ITestSpecification<
|
|
92
|
-
|
|
93
|
-
unknown,
|
|
94
|
-
unknown,
|
|
95
|
-
unknown,
|
|
96
|
-
unknown,
|
|
97
|
-
unknown,
|
|
98
|
-
unknown,
|
|
99
|
-
unknown,
|
|
207
|
+
I extends Ibdd_out<
|
|
100
208
|
Record<string, any>,
|
|
101
209
|
Record<string, any>,
|
|
102
210
|
Record<string, any>,
|
|
@@ -105,100 +213,208 @@ export type ITestSpecification<
|
|
|
105
213
|
>
|
|
106
214
|
> = (
|
|
107
215
|
Suite: {
|
|
108
|
-
[K in keyof
|
|
216
|
+
[K in keyof I["suites"]]: (
|
|
109
217
|
name: string,
|
|
110
|
-
givens: IGivens<
|
|
111
|
-
|
|
112
|
-
|
|
218
|
+
givens: IGivens<
|
|
219
|
+
IBaseTest<
|
|
220
|
+
unknown,
|
|
221
|
+
unknown,
|
|
222
|
+
unknown,
|
|
223
|
+
unknown,
|
|
224
|
+
unknown,
|
|
225
|
+
unknown,
|
|
226
|
+
unknown,
|
|
227
|
+
Record<string, any>,
|
|
228
|
+
Record<string, any>,
|
|
229
|
+
Record<string, any>,
|
|
230
|
+
Record<string, any>,
|
|
231
|
+
Record<string, any>
|
|
232
|
+
>
|
|
233
|
+
>,
|
|
234
|
+
checks: BaseCheck<
|
|
235
|
+
IBaseTest<
|
|
236
|
+
unknown,
|
|
237
|
+
unknown,
|
|
238
|
+
unknown,
|
|
239
|
+
unknown,
|
|
240
|
+
unknown,
|
|
241
|
+
unknown,
|
|
242
|
+
unknown,
|
|
243
|
+
Record<string, any>,
|
|
244
|
+
Record<string, any>,
|
|
245
|
+
Record<string, any>,
|
|
246
|
+
Record<string, any>,
|
|
247
|
+
Record<string, any>
|
|
248
|
+
>
|
|
249
|
+
>[]
|
|
250
|
+
) => BaseSuite<
|
|
251
|
+
IBaseTest<
|
|
252
|
+
unknown,
|
|
253
|
+
unknown,
|
|
254
|
+
unknown,
|
|
255
|
+
unknown,
|
|
256
|
+
unknown,
|
|
257
|
+
unknown,
|
|
258
|
+
unknown,
|
|
259
|
+
Record<string, any>,
|
|
260
|
+
Record<string, any>,
|
|
261
|
+
Record<string, any>,
|
|
262
|
+
Record<string, any>,
|
|
263
|
+
Record<string, any>
|
|
264
|
+
>
|
|
265
|
+
>;
|
|
113
266
|
},
|
|
114
267
|
Given: {
|
|
115
|
-
[K in keyof
|
|
268
|
+
[K in keyof I["givens"]]: (
|
|
116
269
|
features: string[],
|
|
117
|
-
whens: BaseWhen<
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
270
|
+
whens: BaseWhen<
|
|
271
|
+
IBaseTest<
|
|
272
|
+
unknown,
|
|
273
|
+
unknown,
|
|
274
|
+
unknown,
|
|
275
|
+
unknown,
|
|
276
|
+
unknown,
|
|
277
|
+
unknown,
|
|
278
|
+
unknown,
|
|
279
|
+
Record<string, any>,
|
|
280
|
+
Record<string, any>,
|
|
281
|
+
Record<string, any>,
|
|
282
|
+
Record<string, any>,
|
|
283
|
+
Record<string, any>
|
|
284
|
+
>
|
|
285
|
+
>[],
|
|
286
|
+
thens: BaseThen<
|
|
287
|
+
IBaseTest<
|
|
288
|
+
unknown,
|
|
289
|
+
unknown,
|
|
290
|
+
unknown,
|
|
291
|
+
unknown,
|
|
292
|
+
unknown,
|
|
293
|
+
unknown,
|
|
294
|
+
unknown,
|
|
295
|
+
Record<string, any>,
|
|
296
|
+
Record<string, any>,
|
|
297
|
+
Record<string, any>,
|
|
298
|
+
Record<string, any>,
|
|
299
|
+
Record<string, any>
|
|
300
|
+
>
|
|
301
|
+
>[],
|
|
302
|
+
...xtrasB: I["givens"][K]
|
|
303
|
+
) => BaseGiven<
|
|
304
|
+
IBaseTest<
|
|
305
|
+
unknown,
|
|
306
|
+
unknown,
|
|
307
|
+
unknown,
|
|
308
|
+
unknown,
|
|
309
|
+
unknown,
|
|
310
|
+
unknown,
|
|
311
|
+
unknown,
|
|
312
|
+
Record<string, any>,
|
|
313
|
+
Record<string, any>,
|
|
314
|
+
Record<string, any>,
|
|
315
|
+
Record<string, any>,
|
|
316
|
+
Record<string, any>
|
|
317
|
+
>
|
|
318
|
+
>;
|
|
121
319
|
},
|
|
122
320
|
When: {
|
|
123
|
-
[K in keyof
|
|
124
|
-
...xtrasC:
|
|
125
|
-
) => BaseWhen<
|
|
321
|
+
[K in keyof I["whens"]]: (
|
|
322
|
+
...xtrasC: I["whens"][K]
|
|
323
|
+
) => BaseWhen<
|
|
324
|
+
IBaseTest<
|
|
325
|
+
unknown,
|
|
326
|
+
unknown,
|
|
327
|
+
unknown,
|
|
328
|
+
unknown,
|
|
329
|
+
unknown,
|
|
330
|
+
unknown,
|
|
331
|
+
unknown,
|
|
332
|
+
Record<string, any>,
|
|
333
|
+
Record<string, any>,
|
|
334
|
+
Record<string, any>,
|
|
335
|
+
Record<string, any>,
|
|
336
|
+
Record<string, any>
|
|
337
|
+
>
|
|
338
|
+
>;
|
|
126
339
|
},
|
|
127
340
|
Then: {
|
|
128
|
-
[K in keyof
|
|
129
|
-
...xtrasD:
|
|
130
|
-
) => BaseThen<
|
|
341
|
+
[K in keyof I["thens"]]: (
|
|
342
|
+
...xtrasD: I["thens"][K]
|
|
343
|
+
) => BaseThen<
|
|
344
|
+
IBaseTest<
|
|
345
|
+
unknown,
|
|
346
|
+
unknown,
|
|
347
|
+
unknown,
|
|
348
|
+
unknown,
|
|
349
|
+
unknown,
|
|
350
|
+
unknown,
|
|
351
|
+
unknown,
|
|
352
|
+
Record<string, any>,
|
|
353
|
+
Record<string, any>,
|
|
354
|
+
Record<string, any>,
|
|
355
|
+
Record<string, any>,
|
|
356
|
+
Record<string, any>
|
|
357
|
+
>
|
|
358
|
+
>;
|
|
131
359
|
},
|
|
132
|
-
Check: ITestCheckCallback<
|
|
360
|
+
Check: ITestCheckCallback<
|
|
361
|
+
IBaseTest<
|
|
362
|
+
unknown,
|
|
363
|
+
unknown,
|
|
364
|
+
unknown,
|
|
365
|
+
unknown,
|
|
366
|
+
unknown,
|
|
367
|
+
unknown,
|
|
368
|
+
unknown,
|
|
369
|
+
Record<string, any>,
|
|
370
|
+
Record<string, any>,
|
|
371
|
+
Record<string, any>,
|
|
372
|
+
Record<string, any>,
|
|
373
|
+
Record<string, any>
|
|
374
|
+
>
|
|
375
|
+
>
|
|
133
376
|
) => any[];
|
|
134
377
|
|
|
135
378
|
export type ITestImplementation<
|
|
136
|
-
|
|
137
|
-
unknown,
|
|
379
|
+
IN extends Ibdd_in<
|
|
138
380
|
unknown,
|
|
139
381
|
unknown,
|
|
140
382
|
unknown,
|
|
141
383
|
unknown,
|
|
142
384
|
unknown,
|
|
143
385
|
unknown,
|
|
386
|
+
unknown
|
|
387
|
+
>,
|
|
388
|
+
OUT extends Ibdd_out<
|
|
144
389
|
Record<string, any>,
|
|
145
390
|
Record<string, any>,
|
|
146
391
|
Record<string, any>,
|
|
147
392
|
Record<string, any>,
|
|
148
393
|
Record<string, any>
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
...It: ITestShape["thens"][K]
|
|
172
|
-
) => (ssel: ITestShape["iselection"], utils: PM) => ITestShape["then"];
|
|
173
|
-
};
|
|
174
|
-
checks: {
|
|
175
|
-
[K in keyof ITestShape["checks"]]: (
|
|
176
|
-
...Ic: ITestShape["checks"][K]
|
|
177
|
-
) => ITestShape["given"];
|
|
178
|
-
};
|
|
179
|
-
},
|
|
180
|
-
IMod
|
|
181
|
-
>;
|
|
182
|
-
|
|
183
|
-
type Modify<T, R> = Omit<T, keyof R> & R;
|
|
184
|
-
|
|
185
|
-
// export type IBaseTest<Shape = any, II = Shape> = {
|
|
186
|
-
// iinput: II;
|
|
187
|
-
// isubject: Shape;
|
|
188
|
-
// istore: Shape;
|
|
189
|
-
// iselection: Shape;
|
|
190
|
-
// // iinitial;
|
|
191
|
-
|
|
192
|
-
// given;
|
|
193
|
-
// when;
|
|
194
|
-
// then;
|
|
394
|
+
>
|
|
395
|
+
> = {
|
|
396
|
+
suites: {
|
|
397
|
+
[K in keyof OUT["suites"]]: string;
|
|
398
|
+
};
|
|
399
|
+
givens: {
|
|
400
|
+
[K in keyof OUT["givens"]]: (...Ig: OUT["givens"][K]) => IN["given"];
|
|
401
|
+
};
|
|
402
|
+
whens: {
|
|
403
|
+
[K in keyof OUT["whens"]]: (
|
|
404
|
+
...Iw: OUT["whens"][K]
|
|
405
|
+
) => (zel: IN["iselection"], utils: PM) => Promise<IN["when"]>;
|
|
406
|
+
};
|
|
407
|
+
thens: {
|
|
408
|
+
[K in keyof OUT["thens"]]: (
|
|
409
|
+
...It: OUT["thens"][K]
|
|
410
|
+
) => (ssel: IN["iselection"], utils: PM) => IN["then"];
|
|
411
|
+
};
|
|
412
|
+
checks: {
|
|
413
|
+
[K in keyof OUT["checks"]]: (...Ic: OUT["checks"][K]) => IN["given"];
|
|
414
|
+
};
|
|
415
|
+
};
|
|
195
416
|
|
|
196
|
-
|
|
197
|
-
// givens: Record<string, any>;
|
|
198
|
-
// whens: Record<string, any>;
|
|
199
|
-
// thens: Record<string, any>;
|
|
200
|
-
// checks: Record<string, any>;
|
|
201
|
-
// };
|
|
417
|
+
export type Modify<T, R> = Omit<T, keyof R> & R;
|
|
202
418
|
|
|
203
419
|
export type IBaseTest<
|
|
204
420
|
IInput,
|
|
@@ -227,3 +443,35 @@ export type IBaseTest<
|
|
|
227
443
|
thens: IThens;
|
|
228
444
|
checks: IChecks;
|
|
229
445
|
};
|
|
446
|
+
|
|
447
|
+
export type Ibdd_out<
|
|
448
|
+
ISuites extends Record<string, any>,
|
|
449
|
+
IGivens extends Record<string, any>,
|
|
450
|
+
IWhens extends Record<string, any>,
|
|
451
|
+
IThens extends Record<string, any>,
|
|
452
|
+
IChecks extends Record<string, any>
|
|
453
|
+
> = {
|
|
454
|
+
suites: ISuites;
|
|
455
|
+
givens: IGivens;
|
|
456
|
+
whens: IWhens;
|
|
457
|
+
thens: IThens;
|
|
458
|
+
checks: IChecks;
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
export type Ibdd_in<
|
|
462
|
+
IInput,
|
|
463
|
+
ISubject,
|
|
464
|
+
IStore,
|
|
465
|
+
ISelection,
|
|
466
|
+
IGiven,
|
|
467
|
+
IWhen,
|
|
468
|
+
IThen
|
|
469
|
+
> = {
|
|
470
|
+
iinput: IInput;
|
|
471
|
+
isubject: ISubject;
|
|
472
|
+
istore: IStore;
|
|
473
|
+
iselection: ISelection;
|
|
474
|
+
given: IGiven;
|
|
475
|
+
when: IWhen;
|
|
476
|
+
then: IThen;
|
|
477
|
+
};
|
package/src/Web.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { error } from "console";
|
|
1
2
|
import { PM_Web } from "./PM/web";
|
|
2
3
|
import type {
|
|
3
4
|
IBaseTest,
|
|
@@ -10,7 +11,14 @@ import {
|
|
|
10
11
|
ITTestResourceRequest,
|
|
11
12
|
defaultTestResourceRequirement,
|
|
12
13
|
} from "./lib/index.js";
|
|
13
|
-
import { ITestInterface, IWebTestInterface } from "./lib/types";
|
|
14
|
+
import { IFinalResults, ITestInterface, IWebTestInterface } from "./lib/types";
|
|
15
|
+
|
|
16
|
+
let errorCallback = (e: any) => {};
|
|
17
|
+
let unhandledrejectionCallback = (event: PromiseRejectionEvent) => {
|
|
18
|
+
console.log("window.addEventListener unhandledrejection", event);
|
|
19
|
+
// cb({ error: event.reason.message });
|
|
20
|
+
// throw event;
|
|
21
|
+
};
|
|
14
22
|
|
|
15
23
|
export class WebTesteranto<
|
|
16
24
|
TestShape extends IBaseTest<
|
|
@@ -40,7 +48,40 @@ export class WebTesteranto<
|
|
|
40
48
|
testSpecification,
|
|
41
49
|
testImplementation,
|
|
42
50
|
testResourceRequirement,
|
|
43
|
-
testInterface
|
|
51
|
+
testInterface,
|
|
52
|
+
(cb) => {
|
|
53
|
+
window.removeEventListener("error", errorCallback);
|
|
54
|
+
|
|
55
|
+
errorCallback = (e) => {
|
|
56
|
+
console.log("window.addEventListener error", e);
|
|
57
|
+
cb(e);
|
|
58
|
+
// throw e;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
window.addEventListener("error", errorCallback);
|
|
62
|
+
|
|
63
|
+
window.removeEventListener(
|
|
64
|
+
"unhandledrejection",
|
|
65
|
+
unhandledrejectionCallback
|
|
66
|
+
);
|
|
67
|
+
/////////////////////
|
|
68
|
+
|
|
69
|
+
window.removeEventListener(
|
|
70
|
+
"unhandledrejection",
|
|
71
|
+
unhandledrejectionCallback
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
unhandledrejectionCallback = (event: PromiseRejectionEvent) => {
|
|
75
|
+
console.log("window.addEventListener unhandledrejection", event);
|
|
76
|
+
cb({ error: event.reason.message });
|
|
77
|
+
// throw event;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
window.addEventListener(
|
|
81
|
+
"unhandledrejection",
|
|
82
|
+
unhandledrejectionCallback
|
|
83
|
+
);
|
|
84
|
+
}
|
|
44
85
|
);
|
|
45
86
|
}
|
|
46
87
|
|
|
@@ -49,28 +90,9 @@ export class WebTesteranto<
|
|
|
49
90
|
const pm = new PM_Web(t);
|
|
50
91
|
const { failed, artifacts, logPromise, features } =
|
|
51
92
|
await this.testJobs[0].receiveTestResourceConfig(pm);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
res(features);
|
|
93
|
+
return new Promise<IFinalResults>((res, rej) => {
|
|
94
|
+
res({ features, failed });
|
|
55
95
|
});
|
|
56
|
-
// return features;
|
|
57
|
-
// Promise.all([...artifacts, logPromise]).then(async () => {
|
|
58
|
-
// console.log("hello world");
|
|
59
|
-
// pm.customclose();
|
|
60
|
-
// // we can't close the window becuase we might be taking a screenshot
|
|
61
|
-
// // window.close();
|
|
62
|
-
// // console.log(
|
|
63
|
-
// // "(window as any).browser",
|
|
64
|
-
// // JSON.stringify(await (window as any).browser)
|
|
65
|
-
// // );
|
|
66
|
-
// // var currentWindow = (await (window as any).browser).getCurrentWindow();
|
|
67
|
-
// // window.close();
|
|
68
|
-
// // var customWindow = window.open("", "_blank", "");
|
|
69
|
-
// // customWindow.close();
|
|
70
|
-
// // this.puppetMaster.browser.page
|
|
71
|
-
// // window["customclose"]();
|
|
72
|
-
// // console.log("goodbye", window["customclose"]());
|
|
73
|
-
// });
|
|
74
96
|
}
|
|
75
97
|
}
|
|
76
98
|
|