testeranto 0.171.0 → 0.172.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 (23) hide show
  1. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  2. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  3. package/dist/prebuild/App.css +13 -9
  4. package/dist/prebuild/App.js +99 -96
  5. package/dist/types/src/components/pure/ProjectPageView.test/index.d.ts +1 -2
  6. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  7. package/package.json +5 -4
  8. package/testeranto/App.css +13 -9
  9. package/testeranto/App.js +99 -96
  10. package/testeranto/bundles/node/allTests/metafile.json +3 -3
  11. package/testeranto/bundles/node/allTests/src/lib/pmProxy.test/index.mjs +352 -250
  12. package/testeranto/bundles/pure/allTests/metafile.json +15 -15
  13. package/testeranto/bundles/web/allTests/metafile.json +22 -15962
  14. package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/logs.txt +24 -24
  15. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/logs.txt +1 -1
  16. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/logs.txt +34 -34
  17. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/logs.txt +1 -1
  18. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/logs.txt +15 -15
  19. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/logs.txt +1 -1
  20. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/logs.txt +27 -27
  21. package/testeranto/reportsnode_build_errors +20 -0
  22. package/testeranto/reportspure_build_errors +343 -0
  23. package/testeranto/bundles/web/allTests/chunk-RLDR6LJN.mjs +0 -1030
@@ -1,1030 +0,0 @@
1
- import {
2
- init_buffer,
3
- init_dirname,
4
- init_process
5
- } from "./chunk-HPYA4YZC.mjs";
6
-
7
- // src/lib/BaseSuite.ts
8
- init_dirname();
9
- init_buffer();
10
- init_process();
11
-
12
- // src/lib/pmProxy.ts
13
- init_dirname();
14
- init_buffer();
15
- init_process();
16
- var baseProxy = function(pm, mappings) {
17
- return new Proxy(pm, {
18
- get: (target, prop, receiver) => {
19
- for (const mapping of mappings) {
20
- const method = mapping[0];
21
- const arger = mapping[1];
22
- if (prop === method) {
23
- return (...x) => target[prop](arger(...x));
24
- }
25
- }
26
- return (...x) => target[prop](...x);
27
- }
28
- });
29
- };
30
- var butThenProxy = (pm, filepath) => {
31
- return baseProxy(pm, [
32
- [
33
- "screencast",
34
- (opts2, p) => {
35
- const path = `${filepath}/butThen/${opts2.path}`;
36
- console.log(`[Proxy] Captured artifact path for butThen:`, path);
37
- if (pm.currentStep?.addArtifact) {
38
- pm.currentStep.addArtifact(path);
39
- } else {
40
- console.warn("No currentStep or addArtifact method found");
41
- }
42
- return [
43
- {
44
- ...opts2,
45
- path
46
- },
47
- p
48
- ];
49
- }
50
- ],
51
- ["createWriteStream", (fp) => {
52
- const path = `${filepath}/butThen/${fp}`;
53
- console.log(`[Proxy] Captured artifact path for butThen:`, path);
54
- if (pm.currentStep?.addArtifact) {
55
- pm.currentStep.addArtifact(path);
56
- } else {
57
- console.warn("No currentStep or addArtifact method found");
58
- }
59
- return [path];
60
- }],
61
- [
62
- "writeFileSync",
63
- (fp, contents) => {
64
- const path = `${filepath}/butThen/${fp}`;
65
- pm.currentStep?.artifacts?.push(path);
66
- return [path, contents];
67
- }
68
- ],
69
- [
70
- "customScreenShot",
71
- (opts2, p) => {
72
- const path = `${filepath}/butThen/${opts2.path}`;
73
- pm.currentStep?.artifacts?.push(path);
74
- return [
75
- {
76
- ...opts2,
77
- path
78
- },
79
- p
80
- ];
81
- }
82
- ]
83
- ]);
84
- };
85
- var andWhenProxy = (pm, filepath) => baseProxy(pm, [
86
- [
87
- "screencast",
88
- (opts2, p) => {
89
- const path = `${filepath}/andWhen/${opts2.path}`;
90
- pm.currentStep?.artifacts?.push(path);
91
- return [
92
- {
93
- ...opts2,
94
- path
95
- },
96
- p
97
- ];
98
- }
99
- ],
100
- ["createWriteStream", (fp) => {
101
- const path = `${filepath}/andWhen/${fp}`;
102
- pm.currentStep?.artifacts?.push(path);
103
- return [path];
104
- }],
105
- ["writeFileSync", (fp, contents) => {
106
- const path = `${filepath}/andWhen/${fp}`;
107
- pm.currentStep?.artifacts?.push(path);
108
- return [path, contents];
109
- }],
110
- [
111
- "customScreenShot",
112
- (opts2, p) => {
113
- const path = `${filepath}/andWhen/${opts2.path}`;
114
- pm.currentStep?.artifacts?.push(path);
115
- return [
116
- {
117
- ...opts2,
118
- path
119
- },
120
- p
121
- ];
122
- }
123
- ]
124
- ]);
125
- var afterEachProxy = (pm, suite, given) => baseProxy(pm, [
126
- [
127
- "screencast",
128
- (opts2, p) => {
129
- const path = `suite-${suite}/given-${given}/afterEach/${opts2.path}`;
130
- pm.currentStep?.artifacts?.push(path);
131
- return [
132
- {
133
- ...opts2,
134
- path
135
- },
136
- p
137
- ];
138
- }
139
- ],
140
- ["createWriteStream", (fp) => {
141
- const path = `suite-${suite}/afterEach/${fp}`;
142
- pm.currentStep?.artifacts?.push(path);
143
- return [path];
144
- }],
145
- [
146
- "writeFileSync",
147
- (fp, contents) => {
148
- const path = `suite-${suite}/given-${given}/afterEach/${fp}`;
149
- pm.currentStep?.artifacts?.push(path);
150
- return [path, contents];
151
- }
152
- ],
153
- [
154
- "customScreenShot",
155
- (opts2, p) => {
156
- const path = `suite-${suite}/given-${given}/afterEach/${opts2.path}`;
157
- pm.currentStep?.artifacts?.push(path);
158
- return [
159
- {
160
- ...opts2,
161
- path
162
- },
163
- p
164
- ];
165
- }
166
- ]
167
- ]);
168
- var beforeEachProxy = (pm, suite) => baseProxy(pm, [
169
- [
170
- "screencast",
171
- (opts2, p) => {
172
- const path = `suite-${suite}/beforeEach/${opts2.path}`;
173
- pm.currentStep?.artifacts?.push(path);
174
- return [
175
- {
176
- ...opts2,
177
- path
178
- },
179
- p
180
- ];
181
- }
182
- ],
183
- [
184
- "writeFileSync",
185
- (fp, contents) => {
186
- const path = `suite-${suite}/beforeEach/${fp}`;
187
- pm.currentStep?.artifacts?.push(path);
188
- return [path, contents];
189
- }
190
- ],
191
- [
192
- "customScreenShot",
193
- (opts2, p) => {
194
- const path = `suite-${suite}/beforeEach/${opts2.path}`;
195
- pm.currentStep?.artifacts?.push(path);
196
- return [
197
- {
198
- ...opts2,
199
- path
200
- },
201
- p
202
- ];
203
- }
204
- ],
205
- ["createWriteStream", (fp) => {
206
- const path = `suite-${suite}/beforeEach/${fp}`;
207
- pm.currentStep?.artifacts?.push(path);
208
- return [path];
209
- }]
210
- ]);
211
- var beforeAllProxy = (pm, suite) => baseProxy(pm, [
212
- [
213
- "writeFileSync",
214
- (fp, contents) => {
215
- const path = `suite-${suite}/beforeAll/${fp}`;
216
- pm.currentStep?.artifacts?.push(path);
217
- return [path, contents];
218
- }
219
- ],
220
- [
221
- "customScreenShot",
222
- (opts2, p) => {
223
- const path = `suite-${suite}/beforeAll/${opts2.path}`;
224
- pm.currentStep?.artifacts?.push(path);
225
- return [
226
- {
227
- ...opts2,
228
- path
229
- },
230
- p
231
- ];
232
- }
233
- ],
234
- ["createWriteStream", (fp) => {
235
- const path = `suite-${suite}/beforeAll/${fp}`;
236
- pm.currentStep?.artifacts?.push(path);
237
- return [path];
238
- }]
239
- ]);
240
- var afterAllProxy = (pm, suite) => baseProxy(pm, [
241
- ["createWriteStream", (fp) => {
242
- const path = `suite-${suite}/afterAll/${fp}`;
243
- pm.currentStep?.artifacts?.push(path);
244
- return [path];
245
- }],
246
- [
247
- "writeFileSync",
248
- (fp, contents) => {
249
- const path = `suite-${suite}/afterAll/${fp}`;
250
- pm.currentStep?.artifacts?.push(path);
251
- return [path, contents];
252
- }
253
- ],
254
- [
255
- "customScreenShot",
256
- (opts2, p) => {
257
- const path = `suite-${suite}/afterAll/${opts2.path}`;
258
- pm.currentStep?.artifacts?.push(path);
259
- return [
260
- {
261
- ...opts2,
262
- path
263
- },
264
- p
265
- ];
266
- }
267
- ]
268
- ]);
269
-
270
- // src/lib/BaseSuite.ts
271
- var BaseSuite = class {
272
- constructor(name, index, givens = {}) {
273
- const suiteName = name || "testSuite";
274
- if (!suiteName) {
275
- throw new Error("BaseSuite requires a non-empty name");
276
- }
277
- console.log(
278
- "[DEBUG] BaseSuite constructor - name:",
279
- suiteName,
280
- "index:",
281
- index
282
- );
283
- this.name = suiteName;
284
- this.index = index;
285
- this.givens = givens;
286
- this.fails = 0;
287
- console.log("[DEBUG] BaseSuite initialized:", this.name, this.index);
288
- console.log("[DEBUG] BaseSuite givens:", Object.keys(givens).toString());
289
- }
290
- features() {
291
- try {
292
- const features = Object.keys(this.givens).map((k) => this.givens[k].features).flat().filter((value, index, array) => {
293
- return array.indexOf(value) === index;
294
- });
295
- console.debug("[DEBUG] Features extracted:", features.toString());
296
- return features || [];
297
- } catch (e) {
298
- console.error("[ERROR] Failed to extract features:", e);
299
- return [];
300
- }
301
- }
302
- toObj() {
303
- const givens = Object.keys(this.givens).map((k) => this.givens[k].toObj());
304
- return {
305
- name: this.name,
306
- givens,
307
- fails: this.fails,
308
- failed: this.failed,
309
- features: this.features()
310
- };
311
- }
312
- setup(s, artifactory, tr, pm) {
313
- return new Promise((res) => res(s));
314
- }
315
- assertThat(t) {
316
- return !!t;
317
- }
318
- afterAll(store, artifactory, pm) {
319
- return store;
320
- }
321
- async run(input, testResourceConfiguration, artifactory, tLog, pm) {
322
- this.testResourceConfiguration = testResourceConfiguration;
323
- const suiteArtifactory = (fPath, value) => artifactory(`suite-${this.index}-${this.name}/${fPath}`, value);
324
- tLog("\nSuite:", this.index, this.name);
325
- const sNdx = this.index;
326
- const subject = await this.setup(
327
- input,
328
- suiteArtifactory,
329
- testResourceConfiguration,
330
- beforeAllProxy(pm, sNdx.toString())
331
- );
332
- for (const [gKey, g] of Object.entries(this.givens)) {
333
- const giver = this.givens[gKey];
334
- this.store = await giver.give(
335
- subject,
336
- gKey,
337
- testResourceConfiguration,
338
- this.assertThat,
339
- suiteArtifactory,
340
- tLog,
341
- pm,
342
- sNdx
343
- ).catch((e) => {
344
- this.failed = true;
345
- this.fails = this.fails + 1;
346
- throw e;
347
- });
348
- }
349
- try {
350
- this.afterAll(
351
- this.store,
352
- artifactory,
353
- afterAllProxy(pm, sNdx.toString())
354
- );
355
- } catch (e) {
356
- console.error(e);
357
- }
358
- return this;
359
- }
360
- };
361
-
362
- // src/Web.ts
363
- init_dirname();
364
- init_buffer();
365
- init_process();
366
-
367
- // src/PM/web.ts
368
- init_dirname();
369
- init_buffer();
370
- init_process();
371
-
372
- // src/PM/index.ts
373
- init_dirname();
374
- init_buffer();
375
- init_process();
376
- var PM = class {
377
- };
378
-
379
- // src/PM/web.ts
380
- var PM_Web = class extends PM {
381
- constructor(t) {
382
- super();
383
- this.testResourceConfiguration = t;
384
- }
385
- start() {
386
- return new Promise((r) => r());
387
- }
388
- stop() {
389
- return new Promise((r) => r());
390
- }
391
- getInnerHtml(selector, page2) {
392
- throw new Error("web.ts getInnHtml not implemented");
393
- }
394
- pages() {
395
- throw new Error("Method not implemented.");
396
- }
397
- stopSideCar(n) {
398
- return window["stopSideCar"](n, this.testResourceConfiguration.name);
399
- }
400
- launchSideCar(n) {
401
- return window["launchSideCar"](n, this.testResourceConfiguration.name);
402
- }
403
- waitForSelector(p, s) {
404
- return window["waitForSelector"](p, s);
405
- }
406
- screencast(o, p) {
407
- return window["screencast"](
408
- {
409
- ...opts,
410
- path: this.testResourceConfiguration.fs + "/" + opts.path
411
- },
412
- page.mainFrame()._id,
413
- this.testResourceConfiguration.name
414
- );
415
- }
416
- screencastStop(recorder) {
417
- return window["screencastStop"](recorder);
418
- }
419
- closePage(p) {
420
- return window["closePage"](p);
421
- }
422
- goto(p, url) {
423
- return window["goto"](p, url);
424
- }
425
- newPage() {
426
- return window["newPage"]();
427
- }
428
- $(selector) {
429
- return window["$"](selector);
430
- }
431
- isDisabled(selector) {
432
- return window["isDisabled"](selector);
433
- }
434
- getAttribute(selector, attribute) {
435
- return window["getAttribute"](selector, attribute);
436
- }
437
- getValue(selector) {
438
- return window["getValue"](selector);
439
- }
440
- focusOn(selector) {
441
- return window["focusOn"](selector);
442
- }
443
- typeInto(value) {
444
- return window["typeInto"](value);
445
- }
446
- async page(x) {
447
- return window["page"](x);
448
- }
449
- click(selector) {
450
- return window["click"](selector);
451
- }
452
- customScreenShot(x, y) {
453
- const opts2 = x[0];
454
- const page2 = x[1];
455
- console.log("customScreenShot 2 opts", opts2);
456
- console.log("customScreenShot 2 page", page2);
457
- return window["customScreenShot"](
458
- {
459
- ...opts2,
460
- path: this.testResourceConfiguration.fs + "/" + opts2.path
461
- },
462
- this.testResourceConfiguration.name,
463
- page2
464
- );
465
- }
466
- existsSync(destFolder) {
467
- return window["existsSync"](destFolder);
468
- }
469
- mkdirSync(x) {
470
- return window["mkdirSync"](this.testResourceConfiguration.fs + "/");
471
- }
472
- write(uid, contents) {
473
- return window["write"](uid, contents);
474
- }
475
- writeFileSync(filepath, contents) {
476
- return window["writeFileSync"](
477
- this.testResourceConfiguration.fs + "/" + filepath,
478
- contents,
479
- this.testResourceConfiguration.name
480
- );
481
- }
482
- createWriteStream(filepath) {
483
- return window["createWriteStream"](
484
- this.testResourceConfiguration.fs + "/" + filepath,
485
- this.testResourceConfiguration.name
486
- );
487
- }
488
- end(uid) {
489
- return window["end"](uid);
490
- }
491
- customclose() {
492
- window["customclose"](
493
- this.testResourceConfiguration.fs,
494
- this.testResourceConfiguration.name
495
- );
496
- }
497
- testArtiFactoryfileWriter(tLog, callback) {
498
- return (fPath, value) => {
499
- callback(
500
- new Promise((res, rej) => {
501
- tLog("testArtiFactory =>", fPath);
502
- })
503
- );
504
- };
505
- }
506
- };
507
-
508
- // src/lib/core.ts
509
- init_dirname();
510
- init_buffer();
511
- init_process();
512
-
513
- // src/lib/index.ts
514
- init_dirname();
515
- init_buffer();
516
- init_process();
517
- var BaseAdapter = () => ({
518
- beforeAll: async (s) => s,
519
- beforeEach: async function(subject, initialValues, x, testResource, pm) {
520
- return subject;
521
- },
522
- afterEach: async (s) => s,
523
- afterAll: (store) => void 0,
524
- butThen: async (store, thenCb) => {
525
- return thenCb(store);
526
- },
527
- andWhen: async (store, whenCB, testResource, pm) => {
528
- try {
529
- await whenCB(store, testResource, pm);
530
- } catch (error) {
531
- console.error("Error in andWhen:", error);
532
- throw error;
533
- }
534
- },
535
- assertThis: (x) => x
536
- });
537
- var DefaultAdapter = (p) => {
538
- return {
539
- ...BaseAdapter,
540
- ...p
541
- };
542
- };
543
- var defaultTestResourceRequirement = {
544
- ports: 0
545
- };
546
-
547
- // src/lib/abstractBase.ts
548
- init_dirname();
549
- init_buffer();
550
- init_process();
551
- var BaseGiven = class {
552
- constructor(name, features, whens, thens, givenCB, initialValues) {
553
- this.artifacts = [];
554
- this.name = name;
555
- this.features = features;
556
- this.whens = whens;
557
- this.thens = thens;
558
- this.givenCB = givenCB;
559
- this.initialValues = initialValues;
560
- }
561
- addArtifact(path) {
562
- console.log(`[Artifact] Adding to ${this.constructor.name}:`, path);
563
- this.artifacts.push(path);
564
- }
565
- beforeAll(store) {
566
- return store;
567
- }
568
- toObj() {
569
- return {
570
- key: this.key,
571
- name: this.name,
572
- whens: this.whens.map((w) => {
573
- if (w && w.toObj)
574
- return w.toObj();
575
- console.error("w is not as expected!", w.toString());
576
- return {};
577
- }),
578
- thens: this.thens.map((t) => t.toObj()),
579
- error: this.error ? [this.error, this.error.stack] : null,
580
- failed: this.failed,
581
- features: this.features,
582
- artifacts: this.artifacts
583
- };
584
- }
585
- async afterEach(store, key, artifactory, pm) {
586
- return store;
587
- }
588
- async give(subject, key, testResourceConfiguration, tester, artifactory, tLog, pm, suiteNdx) {
589
- this.key = key;
590
- tLog(`
591
- ${this.key}`);
592
- tLog(`
593
- Given: ${this.name}`);
594
- const givenArtifactory = (fPath, value) => artifactory(`given-${key}/${fPath}`, value);
595
- this.uberCatcher((e) => {
596
- console.error(e.toString());
597
- this.error = e.error;
598
- tLog(e.stack);
599
- });
600
- try {
601
- const proxiedPm = beforeEachProxy(pm, suiteNdx.toString());
602
- console.log(`[Given] Setting currentStep for beforeEach:`, this.name);
603
- proxiedPm.currentStep = this;
604
- this.store = await this.givenThat(
605
- subject,
606
- testResourceConfiguration,
607
- givenArtifactory,
608
- this.givenCB,
609
- this.initialValues,
610
- proxiedPm
611
- );
612
- } catch (e) {
613
- console.error("Given failure: ", e.toString());
614
- this.error = e;
615
- throw e;
616
- }
617
- try {
618
- for (const [whenNdx, whenStep] of this.whens.entries()) {
619
- await whenStep.test(
620
- this.store,
621
- testResourceConfiguration,
622
- tLog,
623
- pm,
624
- `suite-${suiteNdx}/given-${key}/when/${whenNdx}`
625
- );
626
- }
627
- for (const [thenNdx, thenStep] of this.thens.entries()) {
628
- const t = await thenStep.test(
629
- this.store,
630
- testResourceConfiguration,
631
- tLog,
632
- pm,
633
- `suite-${suiteNdx}/given-${key}/then-${thenNdx}`
634
- );
635
- tester(t);
636
- }
637
- } catch (e) {
638
- this.failed = true;
639
- tLog(e.stack);
640
- throw e;
641
- } finally {
642
- try {
643
- await this.afterEach(
644
- this.store,
645
- this.key,
646
- givenArtifactory,
647
- afterEachProxy(pm, suiteNdx.toString(), key)
648
- );
649
- } catch (e) {
650
- console.error("afterEach failed!", e.toString());
651
- this.failed = e;
652
- throw e;
653
- }
654
- }
655
- return this.store;
656
- }
657
- };
658
- var BaseWhen = class {
659
- constructor(name, whenCB) {
660
- this.artifacts = [];
661
- this.name = name;
662
- this.whenCB = whenCB;
663
- }
664
- toObj() {
665
- console.log("toObj error", this.error);
666
- if (this.error) {
667
- return {
668
- name: this.name,
669
- error: this.error && this.error.name + this.error.stack,
670
- artifacts: this.artifacts
671
- };
672
- } else {
673
- return {
674
- name: this.name,
675
- artifacts: this.artifacts
676
- };
677
- }
678
- }
679
- async test(store, testResourceConfiguration, tLog, pm, filepath) {
680
- try {
681
- tLog(" When:", this.name);
682
- console.debug("[DEBUG] Executing When step:", this.name.toString());
683
- const proxiedPm = andWhenProxy(pm, filepath);
684
- console.log(`[When] Setting currentStep for andWhen:`, this.name);
685
- proxiedPm.currentStep = this;
686
- const result = await this.andWhen(
687
- store,
688
- this.whenCB,
689
- testResourceConfiguration,
690
- proxiedPm
691
- );
692
- console.debug("[DEBUG] When step completed:", this.name.toString());
693
- return result;
694
- } catch (e) {
695
- console.error(
696
- "[ERROR] When step failed:",
697
- this.name.toString(),
698
- e.toString()
699
- );
700
- this.error = e;
701
- throw e;
702
- }
703
- }
704
- };
705
- var BaseThen = class {
706
- constructor(name, thenCB) {
707
- this.artifacts = [];
708
- this.name = name;
709
- this.thenCB = thenCB;
710
- this.error = false;
711
- }
712
- toObj() {
713
- return {
714
- name: this.name,
715
- error: this.error,
716
- artifacts: this.artifacts
717
- };
718
- }
719
- async test(store, testResourceConfiguration, tLog, pm, filepath) {
720
- const proxiedPm = butThenProxy(pm, filepath);
721
- console.log(`[Then] Setting currentStep for butThen:`, this.name);
722
- proxiedPm.currentStep = this;
723
- return this.butThen(
724
- store,
725
- async (s) => {
726
- if (typeof this.thenCB === "function") {
727
- return await this.thenCB(s, proxiedPm);
728
- } else {
729
- return this.thenCB;
730
- }
731
- },
732
- testResourceConfiguration,
733
- butThenProxy(pm, filepath)
734
- ).catch((e) => {
735
- this.error = e.toString();
736
- });
737
- }
738
- };
739
-
740
- // src/lib/classBuilder.ts
741
- init_dirname();
742
- init_buffer();
743
- init_process();
744
-
745
- // src/lib/basebuilder.ts
746
- init_dirname();
747
- init_buffer();
748
- init_process();
749
- var BaseBuilder = class {
750
- constructor(input, suitesOverrides, givenOverides, whenOverides, thenOverides, testResourceRequirement, testSpecification) {
751
- this.artifacts = [];
752
- this.artifacts = [];
753
- this.testResourceRequirement = testResourceRequirement;
754
- this.suitesOverrides = suitesOverrides;
755
- this.givenOverides = givenOverides;
756
- this.whenOverides = whenOverides;
757
- this.thenOverides = thenOverides;
758
- this.testSpecification = testSpecification;
759
- this.specs = testSpecification(
760
- this.Suites(),
761
- this.Given(),
762
- this.When(),
763
- this.Then()
764
- );
765
- this.testJobs = this.specs.map((suite) => {
766
- const suiteRunner = (suite2) => async (puppetMaster, tLog) => {
767
- const x = await suite2.run(
768
- input,
769
- puppetMaster.testResourceConfiguration,
770
- (fPath, value) => puppetMaster.testArtiFactoryfileWriter(
771
- tLog,
772
- (p) => {
773
- this.artifacts.push(p);
774
- }
775
- )(puppetMaster.testResourceConfiguration.fs + "/" + fPath, value),
776
- tLog,
777
- puppetMaster
778
- );
779
- return x;
780
- };
781
- const runner = suiteRunner(suite);
782
- return {
783
- test: suite,
784
- toObj: () => {
785
- return suite.toObj();
786
- },
787
- runner,
788
- receiveTestResourceConfig: async function(puppetMaster) {
789
- const tLog = async (...l) => {
790
- };
791
- const suiteDone = await runner(puppetMaster, tLog);
792
- const fails = suiteDone.fails;
793
- await puppetMaster.writeFileSync(`bdd_errors.txt`, fails.toString());
794
- await puppetMaster.writeFileSync(
795
- `tests.json`,
796
- JSON.stringify(this.toObj(), null, 2)
797
- );
798
- return {
799
- failed: fails > 0,
800
- fails,
801
- artifacts: this.artifacts || [],
802
- // logPromise,
803
- features: suiteDone.features()
804
- };
805
- }
806
- };
807
- });
808
- }
809
- // testsJson() {
810
- // puppetMaster.writeFileSync(
811
- // `tests.json`,
812
- // JSON.stringify({ features: suiteDone.features() }, null, 2)
813
- // );
814
- // }
815
- Specs() {
816
- return this.specs;
817
- }
818
- Suites() {
819
- return this.suitesOverrides;
820
- }
821
- Given() {
822
- return this.givenOverides;
823
- }
824
- When() {
825
- return this.whenOverides;
826
- }
827
- Then() {
828
- return this.thenOverides;
829
- }
830
- };
831
-
832
- // src/lib/classBuilder.ts
833
- var ClassBuilder = class extends BaseBuilder {
834
- constructor(testImplementation, testSpecification, input, suiteKlasser, givenKlasser, whenKlasser, thenKlasser, testResourceRequirement) {
835
- const classySuites = Object.entries(testImplementation.suites).reduce(
836
- (a, [key], index) => {
837
- a[key] = (somestring, givens) => {
838
- return new suiteKlasser.prototype.constructor(
839
- somestring,
840
- index,
841
- givens
842
- );
843
- };
844
- return a;
845
- },
846
- {}
847
- );
848
- const classyGivens = Object.entries(testImplementation.givens).reduce(
849
- (a, [key, g]) => {
850
- a[key] = (features, whens, thens, ...initialValues) => {
851
- return new givenKlasser.prototype.constructor(
852
- key,
853
- features,
854
- whens,
855
- thens,
856
- testImplementation.givens[key],
857
- initialValues
858
- );
859
- };
860
- return a;
861
- },
862
- {}
863
- );
864
- const classyWhens = Object.entries(testImplementation.whens).reduce(
865
- (a, [key, whEn]) => {
866
- a[key] = (...payload) => {
867
- return new whenKlasser.prototype.constructor(
868
- `${whEn.name}: ${payload && payload.toString()}`,
869
- whEn(...payload)
870
- );
871
- };
872
- return a;
873
- },
874
- {}
875
- );
876
- const classyThens = Object.entries(
877
- testImplementation.thens
878
- ).reduce(
879
- (a, [key, thEn]) => {
880
- a[key] = (expected, ...x) => {
881
- return new thenKlasser.prototype.constructor(
882
- `${thEn.name}: ${expected && expected.toString()}`,
883
- thEn(expected, ...x)
884
- );
885
- };
886
- return a;
887
- },
888
- {}
889
- );
890
- super(
891
- input,
892
- classySuites,
893
- classyGivens,
894
- classyWhens,
895
- classyThens,
896
- testResourceRequirement,
897
- testSpecification
898
- );
899
- }
900
- };
901
-
902
- // src/lib/core.ts
903
- var TesterantoCore = class extends ClassBuilder {
904
- constructor(input, testSpecification, testImplementation, testResourceRequirement = defaultTestResourceRequirement, testAdapter, uberCatcher) {
905
- const fullAdapter = DefaultAdapter(testAdapter);
906
- super(
907
- testImplementation,
908
- testSpecification,
909
- input,
910
- class extends BaseSuite {
911
- afterAll(store, artifactory, pm) {
912
- return fullAdapter.afterAll(store, pm);
913
- }
914
- assertThat(t) {
915
- return fullAdapter.assertThis(t);
916
- }
917
- async setup(s, artifactory, tr, pm) {
918
- return (fullAdapter.beforeAll || (async (input2, artifactory2, tr2, pm2) => input2))(
919
- s,
920
- this.testResourceConfiguration,
921
- // artifactory,
922
- pm
923
- );
924
- }
925
- },
926
- class Given extends BaseGiven {
927
- constructor() {
928
- super(...arguments);
929
- this.uberCatcher = uberCatcher;
930
- }
931
- async givenThat(subject, testResource, artifactory, initializer, initialValues, pm) {
932
- return fullAdapter.beforeEach(
933
- subject,
934
- initializer,
935
- testResource,
936
- initialValues,
937
- pm
938
- );
939
- }
940
- afterEach(store, key, artifactory, pm) {
941
- return new Promise(
942
- (res) => res(fullAdapter.afterEach(store, key, pm))
943
- );
944
- }
945
- },
946
- class When extends BaseWhen {
947
- async andWhen(store, whenCB, testResource, pm) {
948
- return await fullAdapter.andWhen(store, whenCB, testResource, pm);
949
- }
950
- },
951
- class Then extends BaseThen {
952
- async butThen(store, thenCB, testResource, pm) {
953
- return await fullAdapter.butThen(store, thenCB, testResource, pm);
954
- }
955
- },
956
- testResourceRequirement
957
- );
958
- }
959
- };
960
-
961
- // src/Web.ts
962
- var errorCallback = (e) => {
963
- };
964
- var unhandledrejectionCallback = (event) => {
965
- console.log(
966
- "window.addEventListener unhandledrejection 1",
967
- JSON.stringify(event)
968
- );
969
- };
970
- var WebTesteranto = class extends TesterantoCore {
971
- constructor(input, testSpecification, testImplementation, testResourceRequirement, testAdapter) {
972
- super(
973
- input,
974
- testSpecification,
975
- testImplementation,
976
- testResourceRequirement,
977
- testAdapter,
978
- (cb) => {
979
- window.removeEventListener("error", errorCallback);
980
- errorCallback = (e) => {
981
- console.log("window.addEventListener error 2", JSON.stringify(e));
982
- cb(e);
983
- };
984
- window.addEventListener("error", errorCallback);
985
- window.removeEventListener(
986
- "unhandledrejection",
987
- unhandledrejectionCallback
988
- );
989
- window.removeEventListener(
990
- "unhandledrejection",
991
- unhandledrejectionCallback
992
- );
993
- unhandledrejectionCallback = (event) => {
994
- console.log(
995
- "window.addEventListener unhandledrejection 3",
996
- JSON.stringify(event)
997
- );
998
- cb({ error: event.reason.message });
999
- };
1000
- window.addEventListener(
1001
- "unhandledrejection",
1002
- unhandledrejectionCallback
1003
- );
1004
- }
1005
- );
1006
- }
1007
- async receiveTestResourceConfig(partialTestResource) {
1008
- const t = partialTestResource;
1009
- const pm = new PM_Web(t);
1010
- return await this.testJobs[0].receiveTestResourceConfig(pm);
1011
- }
1012
- };
1013
- var Web_default = async (input, testSpecification, testImplementation, testAdapter, testResourceRequirement = defaultTestResourceRequirement) => {
1014
- return new WebTesteranto(
1015
- input,
1016
- testSpecification,
1017
- testImplementation,
1018
- testResourceRequirement,
1019
- testAdapter
1020
- );
1021
- };
1022
-
1023
- export {
1024
- BaseGiven,
1025
- BaseWhen,
1026
- BaseThen,
1027
- BaseBuilder,
1028
- BaseSuite,
1029
- Web_default
1030
- };