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.
Files changed (133) hide show
  1. package/bundle.js +4 -7
  2. package/dist/common/src/Node.js +5 -3
  3. package/dist/common/src/PM/main.js +254 -126
  4. package/dist/common/src/PM/node.js +20 -5
  5. package/dist/common/src/PM/web.js +19 -4
  6. package/dist/common/src/SubPackages/puppeteer.js +1 -1
  7. package/dist/common/src/SubPackages/react/jsx/index.js +14 -6
  8. package/dist/common/src/SubPackages/react/jsx/node.js +2 -2
  9. package/dist/common/src/SubPackages/react-dom/component/web.js +13 -39
  10. package/dist/common/src/SubPackages/react-test-renderer/component/interface.js +2 -10
  11. package/dist/common/src/Web.js +25 -21
  12. package/dist/common/src/cli.js +439 -0
  13. package/dist/common/src/cli2.js +144 -0
  14. package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +18 -8
  15. package/dist/common/src/esbuildConfigs/node.js +1 -4
  16. package/dist/common/src/esbuildConfigs/web.js +1 -1
  17. package/dist/common/src/lib/abstractBase.js +31 -263
  18. package/dist/common/src/lib/basebuilder.js +1 -11
  19. package/dist/common/src/lib/classBuilder.js +1 -1
  20. package/dist/common/src/lib/core.js +8 -28
  21. package/dist/common/src/lib/types.js +1 -0
  22. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  23. package/dist/module/src/Node.js +5 -3
  24. package/dist/module/src/PM/main.js +254 -126
  25. package/dist/module/src/PM/node.js +20 -5
  26. package/dist/module/src/PM/web.js +19 -4
  27. package/dist/module/src/SubPackages/puppeteer.js +1 -1
  28. package/dist/module/src/SubPackages/react/jsx/index.js +14 -6
  29. package/dist/module/src/SubPackages/react/jsx/node.js +2 -2
  30. package/dist/module/src/SubPackages/react-dom/component/web.js +13 -39
  31. package/dist/module/src/SubPackages/react-test-renderer/component/interface.js +2 -10
  32. package/dist/module/src/Web.js +25 -21
  33. package/dist/module/src/cli.js +411 -0
  34. package/dist/module/src/cli2.js +116 -0
  35. package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +18 -8
  36. package/dist/module/src/esbuildConfigs/node.js +1 -4
  37. package/dist/module/src/esbuildConfigs/web.js +1 -1
  38. package/dist/module/src/lib/abstractBase.js +31 -263
  39. package/dist/module/src/lib/basebuilder.js +1 -11
  40. package/dist/module/src/lib/classBuilder.js +1 -1
  41. package/dist/module/src/lib/core.js +8 -28
  42. package/dist/module/src/lib/types.js +1 -0
  43. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  44. package/dist/prebuild/cli.mjs +1491 -0
  45. package/dist/prebuild/{run-tests.mjs → cli2.mjs} +223 -212
  46. package/dist/types/src/Node.d.ts +6 -3
  47. package/dist/types/src/PM/index.d.ts +10 -2
  48. package/dist/types/src/PM/main.d.ts +14 -7
  49. package/dist/types/src/PM/node.d.ts +9 -2
  50. package/dist/types/src/PM/web.d.ts +9 -3
  51. package/dist/types/src/SubPackages/puppeteer.d.ts +1 -1
  52. package/dist/types/src/SubPackages/react/component/node.d.ts +1 -1
  53. package/dist/types/src/SubPackages/react/component/web.d.ts +1 -1
  54. package/dist/types/src/SubPackages/react/jsx/node.d.ts +3 -3
  55. package/dist/types/src/SubPackages/react/jsx/web.d.ts +2 -2
  56. package/dist/types/src/SubPackages/react-dom/component/node.d.ts +2 -2
  57. package/dist/types/src/SubPackages/react-dom/component/web.d.ts +1 -1
  58. package/dist/types/src/SubPackages/react-dom/jsx/node.d.ts +1 -1
  59. package/dist/types/src/SubPackages/react-dom/jsx/web.d.ts +2 -2
  60. package/dist/types/src/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +2 -2
  61. package/dist/types/src/SubPackages/react-test-renderer/component/interface.d.ts +1 -1
  62. package/dist/types/src/SubPackages/react-test-renderer/component/node.d.ts +2 -2
  63. package/dist/types/src/SubPackages/react-test-renderer/component/web.d.ts +2 -2
  64. package/dist/types/src/SubPackages/react-test-renderer/fc/node.d.ts +2 -2
  65. package/dist/types/src/SubPackages/react-test-renderer/fc/web.d.ts +2 -2
  66. package/dist/types/src/SubPackages/react-test-renderer/jsx/node.d.ts +3 -2
  67. package/dist/types/src/SubPackages/react-test-renderer/jsx/web.d.ts +2 -2
  68. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/node.d.ts +2 -2
  69. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/web.d.ts +2 -2
  70. package/dist/types/src/Types.d.ts +60 -21
  71. package/dist/types/src/Web.d.ts +3 -3
  72. package/dist/types/src/lib/abstractBase.d.ts +6 -2
  73. package/dist/types/src/lib/core.d.ts +3 -3
  74. package/dist/types/src/lib/index.d.ts +1 -1
  75. package/dist/types/src/lib/types.d.ts +6 -30
  76. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  77. package/package.json +23 -20
  78. package/src/Node.ts +6 -3
  79. package/src/PM/index.ts +12 -8
  80. package/src/PM/main.ts +331 -165
  81. package/src/PM/node.ts +42 -7
  82. package/src/PM/web.ts +33 -5
  83. package/src/SubPackages/puppeteer.ts +1 -1
  84. package/src/SubPackages/react/jsx/index.ts +15 -7
  85. package/src/SubPackages/react/jsx/node.ts +18 -6
  86. package/src/SubPackages/react-dom/component/web.ts +28 -51
  87. package/src/SubPackages/react-test-renderer/component/interface.ts +4 -11
  88. package/src/SubPackages/react-test-renderer/jsx/node.ts +16 -1
  89. package/src/Types.ts +362 -114
  90. package/src/Web.ts +45 -23
  91. package/src/cli.ts +535 -0
  92. package/src/cli2.ts +157 -0
  93. package/src/esbuildConfigs/inputFilesPlugin.ts +27 -9
  94. package/src/esbuildConfigs/node.ts +4 -7
  95. package/src/esbuildConfigs/web.ts +4 -3
  96. package/src/lib/abstractBase.ts +84 -291
  97. package/src/lib/basebuilder.ts +1 -12
  98. package/src/lib/classBuilder.ts +2 -1
  99. package/src/lib/core.ts +17 -29
  100. package/src/lib/types.ts +5 -177
  101. package/dist/common/src/Aider.js +0 -143
  102. package/dist/common/src/Project.js +0 -225
  103. package/dist/common/src/Puppeteer.js +0 -113
  104. package/dist/common/src/build-tests.js +0 -39
  105. package/dist/common/src/esbuildConfigs/features.js +0 -14
  106. package/dist/common/src/esbuildConfigs/report.js +0 -14
  107. package/dist/common/src/esbuildConfigs/tests.js +0 -13
  108. package/dist/common/src/run-tests.js +0 -39
  109. package/dist/module/src/Aider.js +0 -136
  110. package/dist/module/src/Project.js +0 -218
  111. package/dist/module/src/Puppeteer.js +0 -108
  112. package/dist/module/src/build-tests.js +0 -11
  113. package/dist/module/src/esbuildConfigs/features.js +0 -12
  114. package/dist/module/src/esbuildConfigs/report.js +0 -14
  115. package/dist/module/src/esbuildConfigs/tests.js +0 -11
  116. package/dist/module/src/run-tests.js +0 -11
  117. package/dist/prebuild/build-tests.mjs +0 -552
  118. package/dist/types/src/Aider.d.ts +0 -1
  119. package/dist/types/src/Project.d.ts +0 -12
  120. package/dist/types/src/Puppeteer.d.ts +0 -2
  121. package/dist/types/src/esbuildConfigs/features.d.ts +0 -4
  122. package/dist/types/src/esbuildConfigs/report.d.ts +0 -0
  123. package/dist/types/src/esbuildConfigs/tests.d.ts +0 -4
  124. package/src/Aider.ts +0 -168
  125. package/src/Project.ts +0 -291
  126. package/src/Puppeteer.ts +0 -145
  127. package/src/build-tests.ts +0 -12
  128. package/src/esbuildConfigs/features.ts +0 -17
  129. package/src/esbuildConfigs/report.ts +0 -15
  130. package/src/esbuildConfigs/tests.ts +0 -14
  131. package/src/run-tests.ts +0 -12
  132. /package/dist/types/src/{build-tests.d.ts → cli.d.ts} +0 -0
  133. /package/dist/types/src/{run-tests.d.ts → cli2.d.ts} +0 -0
package/src/Types.ts CHANGED
@@ -1,4 +1,8 @@
1
- import { ITTestResourceRequest, ITestCheckCallback } from "./lib/index.js";
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 IPartialInterface<
19
- I extends IBaseTest<
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
- > = Partial<ITestInterface<I>>;
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 IPartialNodeInterface<
36
- I extends IBaseTest<
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
- > = Partial<INodeTestInterface<I>>;
51
- export type IPartialWebInterface<
52
- I extends IBaseTest<
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
- Record<string, any>,
61
- Record<string, any>,
62
- Record<string, any>,
63
- Record<string, any>,
64
- Record<string, any>
169
+ unknown,
170
+ unknown,
171
+ unknown,
172
+ unknown,
173
+ unknown,
174
+ unknown
65
175
  >
66
- > = Partial<IWebTestInterface<I>>;
176
+ > = Partial<ITestInterface<I>>;
67
177
 
68
- export type IEntry<
69
- ITestShape extends IBaseTest<
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
- ITestShape extends IBaseTest<
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 ITestShape["suites"]]: (
216
+ [K in keyof I["suites"]]: (
109
217
  name: string,
110
- givens: IGivens<ITestShape>,
111
- checks: BaseCheck<ITestShape>[]
112
- ) => BaseSuite<ITestShape>;
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 ITestShape["givens"]]: (
268
+ [K in keyof I["givens"]]: (
116
269
  features: string[],
117
- whens: BaseWhen<ITestShape>[],
118
- thens: BaseThen<ITestShape>[],
119
- ...xtrasB: ITestShape["givens"][K]
120
- ) => BaseGiven<ITestShape>;
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 ITestShape["whens"]]: (
124
- ...xtrasC: ITestShape["whens"][K]
125
- ) => BaseWhen<ITestShape>;
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 ITestShape["thens"]]: (
129
- ...xtrasD: ITestShape["thens"][K]
130
- ) => BaseThen<ITestShape>;
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<ITestShape>
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
- ITestShape extends IBaseTest<
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
- IMod = object
151
- > = Modify<
152
- {
153
- suites: {
154
- [K in keyof ITestShape["suites"]]: string;
155
- };
156
- givens: {
157
- [K in keyof ITestShape["givens"]]: (
158
- ...Ig: ITestShape["givens"][K]
159
- ) => ITestShape["given"];
160
- };
161
- whens: {
162
- [K in keyof ITestShape["whens"]]: (
163
- ...Iw: ITestShape["whens"][K]
164
- ) => (
165
- zel: ITestShape["iselection"],
166
- utils: PM
167
- ) => Promise<ITestShape["when"]>;
168
- };
169
- thens: {
170
- [K in keyof ITestShape["thens"]]: (
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
- // suites: Record<string, any>;
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
- pm.customclose();
53
- return new Promise<string[]>((res, rej) => {
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