testeranto 0.167.0 → 0.171.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 (181) hide show
  1. package/dist/common/src/NavBar.js +45 -0
  2. package/dist/common/src/PM/main.js +81 -59
  3. package/dist/common/src/Pure.js +16 -14
  4. package/dist/common/src/ReportServer.js +48 -5
  5. package/dist/common/src/Web.js +35 -20
  6. package/dist/common/src/components/SunriseAnimation.test/implementation.js +1 -0
  7. package/dist/common/src/components/SunriseAnimation.test/index.js +1 -0
  8. package/dist/common/src/components/SunriseAnimation.test/interface.js +1 -0
  9. package/dist/common/src/components/SunriseAnimation.test/specification.js +1 -0
  10. package/dist/common/src/components/TestStatusBadge.js +55 -0
  11. package/dist/common/src/components/pure/ProjectPageView.js +204 -0
  12. package/dist/common/src/components/pure/ProjectPageView.test/adapter.js +20 -0
  13. package/dist/common/src/components/pure/ProjectPageView.test/implementation.js +71 -0
  14. package/dist/common/src/components/pure/ProjectPageView.test/index.js +10 -0
  15. package/dist/common/src/components/pure/ProjectPageView.test/specification.js +19 -0
  16. package/dist/common/src/components/pure/ProjectPageView.test/types.js +2 -0
  17. package/dist/common/src/lib/BaseSuite.js +3 -3
  18. package/dist/common/src/lib/BaseSuite.test/test.js +1 -1
  19. package/dist/common/src/lib/abstractBase.js +41 -14
  20. package/dist/common/src/lib/baseBuilder.test/baseBuilder.test.adapter.js +1 -1
  21. package/dist/common/src/lib/pmProxy.js +185 -64
  22. package/dist/common/testeranto.config.js +6 -0
  23. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  24. package/dist/module/src/App.js +3 -3
  25. package/dist/module/src/PM/main.js +81 -59
  26. package/dist/module/src/ProjectsPage.js +1 -110
  27. package/dist/module/src/Pure.js +16 -14
  28. package/dist/module/src/ReportServer.js +48 -5
  29. package/dist/module/src/TestPage.js +45 -16
  30. package/dist/module/src/Web.js +35 -20
  31. package/dist/module/src/components/SunriseAnimation.test/implementation.js +1 -0
  32. package/dist/module/src/components/SunriseAnimation.test/index.js +1 -0
  33. package/dist/module/src/components/SunriseAnimation.test/interface.js +1 -0
  34. package/dist/module/src/components/SunriseAnimation.test/specification.js +1 -0
  35. package/dist/module/src/components/pure/ProjectPageView.js +197 -0
  36. package/dist/module/src/components/pure/ProjectPageView.test/adapter.js +17 -0
  37. package/dist/module/src/components/pure/ProjectPageView.test/implementation.js +68 -0
  38. package/dist/module/src/components/pure/ProjectPageView.test/index.js +5 -0
  39. package/dist/module/src/components/pure/ProjectPageView.test/specification.js +15 -0
  40. package/dist/module/src/components/pure/ProjectPageView.test/types.js +1 -0
  41. package/dist/module/src/components/pure/ProjectsPageView.js +58 -0
  42. package/dist/module/src/components/pure/TestPageView.js +136 -0
  43. package/dist/module/src/components/stateful/ProjectPage.js +63 -0
  44. package/dist/module/src/components/stateful/ProjectsPage.js +55 -0
  45. package/dist/module/src/components/stateful/TestPage.js +82 -0
  46. package/dist/module/src/lib/BaseSuite.js +3 -3
  47. package/dist/module/src/lib/BaseSuite.test/test.js +1 -1
  48. package/dist/module/src/lib/abstractBase.js +41 -14
  49. package/dist/module/src/lib/baseBuilder.test/baseBuilder.test.adapter.js +1 -1
  50. package/dist/module/src/lib/pmProxy.js +185 -64
  51. package/dist/module/testeranto.config.js +6 -0
  52. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  53. package/dist/prebuild/App.js +541 -495
  54. package/dist/prebuild/ReportServer.mjs +44 -4
  55. package/dist/prebuild/run.mjs +67 -39
  56. package/dist/types/src/NavBar.d.ts +19 -0
  57. package/dist/types/src/PM/index.d.ts +3 -1
  58. package/dist/types/src/PM/main.d.ts +0 -4
  59. package/dist/types/src/PM/node.d.ts +2 -2
  60. package/dist/types/src/components/SunriseAnimation.test/interface.d.ts +0 -0
  61. package/dist/types/src/components/SunriseAnimation.test/specification.d.ts +0 -0
  62. package/dist/types/src/components/TestStatusBadge.d.ts +15 -0
  63. package/dist/types/src/components/pure/ProjectPageView.d.ts +14 -0
  64. package/dist/types/src/components/pure/ProjectPageView.test/adapter.d.ts +3 -0
  65. package/dist/types/src/components/pure/ProjectPageView.test/implementation.d.ts +3 -0
  66. package/dist/types/src/components/pure/ProjectPageView.test/index.d.ts +3 -0
  67. package/dist/types/src/components/pure/ProjectPageView.test/specification.d.ts +3 -0
  68. package/dist/types/src/components/pure/ProjectPageView.test/types.d.ts +39 -0
  69. package/dist/types/src/lib/BaseSuite.d.ts +2 -0
  70. package/dist/types/src/lib/abstractBase.d.ts +12 -0
  71. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  72. package/package.json +3 -2
  73. package/src/App.tsx +5 -9
  74. package/src/PM/index.ts +1 -1
  75. package/src/PM/main.ts +87 -82
  76. package/src/PM/node.ts +2 -2
  77. package/src/ProjectsPage.tsx +1 -164
  78. package/src/Pure.ts +16 -16
  79. package/src/ReportServer.ts +49 -6
  80. package/src/TestPage.tsx +78 -5
  81. package/src/Web.ts +35 -35
  82. package/src/components/SunriseAnimation.test/implementation.ts +0 -0
  83. package/src/components/SunriseAnimation.test/index.ts +0 -0
  84. package/src/components/SunriseAnimation.test/interface.ts +0 -0
  85. package/src/components/SunriseAnimation.test/specification.ts +0 -0
  86. package/src/components/pure/ProjectPageView.test/adapter.ts +21 -0
  87. package/src/components/pure/ProjectPageView.test/implementation.tsx +84 -0
  88. package/src/components/pure/ProjectPageView.test/index.ts +8 -0
  89. package/src/components/pure/ProjectPageView.test/specification.ts +31 -0
  90. package/src/components/pure/ProjectPageView.test/types.ts +55 -0
  91. package/src/components/pure/ProjectPageView.tsx +332 -0
  92. package/src/components/pure/ProjectsPageView.tsx +99 -0
  93. package/src/components/pure/TestPageView.tsx +278 -0
  94. package/src/components/stateful/ProjectPage.tsx +83 -0
  95. package/src/components/stateful/ProjectsPage.tsx +73 -0
  96. package/src/components/stateful/TestPage.tsx +107 -0
  97. package/src/lib/BaseSuite.test/test.ts +1 -1
  98. package/src/lib/BaseSuite.ts +9 -4
  99. package/src/lib/abstractBase.ts +45 -14
  100. package/src/lib/baseBuilder.test/baseBuilder.test.adapter.ts +1 -1
  101. package/src/lib/pmProxy.ts +184 -87
  102. package/testeranto/App.js +541 -495
  103. package/testeranto/bundles/node/allTests/{chunk-4ONUZRZ4.mjs → chunk-3EUGBAOM.mjs} +1 -1
  104. package/testeranto/bundles/node/allTests/{chunk-IDCUSTSM.mjs → chunk-E75CSRER.mjs} +246 -115
  105. package/testeranto/bundles/node/allTests/{chunk-NQEP7SN4.mjs → chunk-M6DO7VMB.mjs} +1 -1
  106. package/testeranto/bundles/node/allTests/metafile.json +34 -34
  107. package/testeranto/bundles/node/allTests/src/lib/BaseSuite.test/node.test.mjs +4 -4
  108. package/testeranto/bundles/node/allTests/src/lib/baseBuilder.test/baseBuilder.test.node.mjs +3 -3
  109. package/testeranto/bundles/node/allTests/src/lib/classBuilder.test/classBuilder.test.mjs +3 -3
  110. package/testeranto/bundles/node/allTests/src/lib/core.test/core.test.mjs +2 -17
  111. package/testeranto/bundles/node/allTests/src/lib/pmProxy.test/index.mjs +2 -2
  112. package/testeranto/bundles/pure/allTests/{chunk-5SBJWHSZ.mjs → chunk-KHDVEHF7.mjs} +2 -17
  113. package/testeranto/bundles/pure/allTests/{chunk-4ULDTZFU.mjs → chunk-VMUSFSZM.mjs} +246 -115
  114. package/testeranto/bundles/pure/allTests/metafile.json +57 -27
  115. package/testeranto/bundles/pure/allTests/src/Pure.test.mjs +2 -2
  116. package/testeranto/bundles/pure/allTests/src/lib/BaseSuite.test/pure.test.mjs +3 -3
  117. package/testeranto/bundles/pure/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure.mjs +2 -29
  118. package/testeranto/bundles/web/allTests/chunk-HPYA4YZC.mjs +2283 -0
  119. package/testeranto/bundles/web/allTests/{chunk-TU3MJSSI.mjs → chunk-RLDR6LJN.mjs} +302 -127
  120. package/testeranto/bundles/web/allTests/{chunk-46E6YGGN.mjs → chunk-U7AW26HL.mjs} +292 -142
  121. package/testeranto/bundles/web/allTests/metafile.json +15062 -43
  122. package/testeranto/bundles/web/allTests/src/components/pure/ProjectPageView.test/index.html +19 -0
  123. package/testeranto/bundles/web/allTests/src/components/pure/ProjectPageView.test/index.mjs +37524 -0
  124. package/testeranto/bundles/web/allTests/src/lib/BaseSuite.test/web.test.mjs +20 -2
  125. package/testeranto/bundles/web/allTests/src/lib/baseBuilder.test/baseBuilder.test.web.mjs +26 -2
  126. package/testeranto/reports/allTests/config.json +8 -0
  127. package/testeranto/reports/allTests/src/Pure.test/pure/type_errors.txt +9 -3
  128. package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/bdd_errors.txt +1 -0
  129. package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/lint_errors.txt +13 -0
  130. package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/logs.txt +50 -0
  131. package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/message.txt +2 -0
  132. package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/prompt.txt +17 -0
  133. package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/tests.json +32 -0
  134. package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/type_errors.txt +68 -0
  135. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/logs.txt +22 -39
  136. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/tests.json +6 -3
  137. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/type_errors.txt +8 -1
  138. package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/tests.json +6 -3
  139. package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/type_errors.txt +9 -3
  140. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/logs.txt +66 -55
  141. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/prompt.txt +2 -2
  142. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/tests.json +6 -3
  143. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/type_errors.txt +10 -5
  144. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/logs.txt +16 -48
  145. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/tests.json +18 -9
  146. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/type_errors.txt +8 -1
  147. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/type_errors.txt +10 -5
  148. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/logs.txt +62 -33
  149. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/prompt.txt +2 -2
  150. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/tests.json +18 -9
  151. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/type_errors.txt +10 -5
  152. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/logs.txt +37 -50
  153. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/tests.json +36 -18
  154. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/type_errors.txt +8 -1
  155. package/testeranto/reports/allTests/src/lib/core.test/core.test/node/logs.txt +2 -2
  156. package/testeranto/reports/allTests/src/lib/core.test/core.test/node/type_errors.txt +9 -3
  157. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/logs.txt +21 -36
  158. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/tests.json +28 -14
  159. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/type_errors.txt +8 -1
  160. package/testeranto/reports/allTests/summary.json +15 -8
  161. package/testeranto/reportsweb_build_errors +25 -0
  162. package/testeranto.config.ts +7 -0
  163. package/tsc.log +100 -26
  164. package/dist/tsconfig.tsbuildinfo +0 -1
  165. package/testeranto/bundles/node/allTests/chunk-FFBRDUBH.mjs +0 -677
  166. package/testeranto/bundles/node/allTests/chunk-H2IBV7SY.mjs +0 -113
  167. package/testeranto/bundles/node/allTests/chunk-ZHOULXPN.mjs +0 -252
  168. package/testeranto/bundles/pure/allTests/chunk-CSMXYJ65.mjs +0 -200
  169. package/testeranto/bundles/pure/allTests/chunk-QK4IXLF6.mjs +0 -674
  170. package/testeranto/bundles/web/allTests/src/lib/BaseSuite.test/web.test/manifest.json +0 -1
  171. package/testeranto/bundles/web/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/manifest.json +0 -1
  172. package/testeranto/reports/allTests/src/Pure.test/pure/manifest.json +0 -1
  173. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/manifest.json +0 -1
  174. package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/manifest.json +0 -1
  175. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/manifest.json +0 -1
  176. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/manifest.json +0 -1
  177. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/manifest.json +0 -1
  178. package/testeranto/reports/allTests/src/lib/core.test/core.test/node/manifest.json +0 -1
  179. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/manifest.json +0 -1
  180. /package/{testeranto/reports/allTests/src/Pure.test/pure/logs.txt → dist/types/src/components/SunriseAnimation.test/implementation.d.ts} +0 -0
  181. /package/{testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/logs.txt → dist/types/src/components/SunriseAnimation.test/index.d.ts} +0 -0
@@ -1,674 +0,0 @@
1
- import { createRequire } from 'module';const require = createRequire(import.meta.url);
2
-
3
- // src/lib/pmProxy.ts
4
- var baseProxy = function(pm, mappings) {
5
- return new Proxy(pm, {
6
- get: (target, prop, receiver) => {
7
- for (const mapping of mappings) {
8
- const method = mapping[0];
9
- const arger = mapping[1];
10
- if (prop === method) {
11
- return (...x) => target[prop](arger(...x));
12
- }
13
- }
14
- return (...x) => target[prop](...x);
15
- }
16
- });
17
- };
18
- var butThenProxy = (pm, filepath) => baseProxy(pm, [
19
- [
20
- "screencast",
21
- (opts, p) => [
22
- {
23
- ...opts,
24
- path: `${filepath}/butThen/${opts.path}`
25
- },
26
- p
27
- ]
28
- ],
29
- ["createWriteStream", (fp) => [`${filepath}/butThen/${fp}`]],
30
- [
31
- "writeFileSync",
32
- (fp, contents) => [`${filepath}/butThen/${fp}`, contents]
33
- ],
34
- [
35
- "customScreenShot",
36
- (opts, p) => [
37
- {
38
- ...opts,
39
- path: `${filepath}/butThen/${opts.path}`
40
- },
41
- p
42
- ]
43
- ]
44
- ]);
45
- var andWhenProxy = (pm, filepath) => baseProxy(pm, [
46
- [
47
- "screencast",
48
- (opts, p) => [
49
- {
50
- ...opts,
51
- path: `${filepath}/andWhen/${opts.path}`
52
- },
53
- p
54
- ]
55
- ],
56
- ["createWriteStream", (fp) => [`${filepath}/andWhen/${fp}`]],
57
- ["writeFileSync", (fp, contents) => [`${filepath}/andWhen${fp}`, contents]],
58
- [
59
- "customScreenShot",
60
- (opts, p) => [
61
- {
62
- ...opts,
63
- path: `${filepath}/andWhen${opts.path}`
64
- },
65
- p
66
- ]
67
- ]
68
- ]);
69
- var afterEachProxy = (pm, suite, given) => baseProxy(pm, [
70
- [
71
- "screencast",
72
- (opts, p) => [
73
- {
74
- ...opts,
75
- path: `suite-${suite}/given-${given}/afterEach/${opts.path}`
76
- },
77
- p
78
- ]
79
- ],
80
- ["createWriteStream", (fp) => [`suite-${suite}/afterEach/${fp}`]],
81
- [
82
- "writeFileSync",
83
- (fp, contents) => [
84
- `suite-${suite}/given-${given}/afterEach/${fp}`,
85
- contents
86
- ]
87
- ],
88
- [
89
- "customScreenShot",
90
- (opts, p) => [
91
- {
92
- ...opts,
93
- path: `suite-${suite}/given-${given}/afterEach/${opts.path}`
94
- },
95
- p
96
- ]
97
- ]
98
- ]);
99
- var beforeEachProxy = (pm, suite) => baseProxy(pm, [
100
- [
101
- "screencast",
102
- (opts, p) => [
103
- {
104
- ...opts,
105
- path: `suite-${suite}/beforeEach/${opts.path}`
106
- },
107
- p
108
- ]
109
- ],
110
- [
111
- "writeFileSync",
112
- (fp, contents) => [`suite-${suite}/beforeEach/${fp}`, contents]
113
- ],
114
- [
115
- "customScreenShot",
116
- (opts, p) => [
117
- {
118
- ...opts,
119
- path: `suite-${suite}/beforeEach/${opts.path}`
120
- },
121
- p
122
- ]
123
- ],
124
- ["createWriteStream", (fp) => [`suite-${suite}/beforeEach/${fp}`]]
125
- ]);
126
- var beforeAllProxy = (pm, suite) => baseProxy(pm, [
127
- [
128
- "writeFileSync",
129
- (fp, contents) => [`suite-${suite}/beforeAll/${fp}`, contents]
130
- ],
131
- [
132
- "customScreenShot",
133
- (opts, p) => [
134
- {
135
- ...opts,
136
- path: `suite-${suite}/beforeAll/${opts.path}`
137
- },
138
- p
139
- ]
140
- ],
141
- ["createWriteStream", (fp) => [`suite-${suite}/beforeAll/${fp}`]]
142
- ]);
143
- var afterAllProxy = (pm, suite) => baseProxy(pm, [
144
- ["createWriteStream", (fp) => [`suite-${suite}/afterAll/${fp}`]],
145
- [
146
- "writeFileSync",
147
- (fp, contents) => [`suite-${suite}/afterAll/${fp}`, contents]
148
- ],
149
- [
150
- "customScreenShot",
151
- (opts, p) => [
152
- {
153
- ...opts,
154
- path: `suite-${suite}/afterAll/${opts.path}`
155
- },
156
- p
157
- ]
158
- ]
159
- ]);
160
-
161
- // src/lib/BaseSuite.ts
162
- var BaseSuite = class {
163
- constructor(name, index, givens = {}) {
164
- const suiteName = name || "testSuite";
165
- if (!suiteName) {
166
- throw new Error("BaseSuite requires a non-empty name");
167
- }
168
- console.log("[DEBUG] BaseSuite constructor - name:", suiteName, "index:", index);
169
- this.name = suiteName;
170
- this.index = index;
171
- this.givens = givens;
172
- this.fails = 0;
173
- console.log("[DEBUG] BaseSuite initialized:", this.name, this.index);
174
- console.log("[DEBUG] BaseSuite givens:", Object.keys(givens));
175
- }
176
- features() {
177
- try {
178
- const features = Object.keys(this.givens).map((k) => this.givens[k].features).flat().filter((value, index, array) => {
179
- return array.indexOf(value) === index;
180
- });
181
- console.debug("[DEBUG] Features extracted:", features);
182
- return features || [];
183
- } catch (e) {
184
- console.error("[ERROR] Failed to extract features:", e);
185
- return [];
186
- }
187
- }
188
- toObj() {
189
- const givens = Object.keys(this.givens).map((k) => this.givens[k].toObj());
190
- return {
191
- name: this.name,
192
- givens,
193
- fails: this.fails,
194
- failed: this.failed,
195
- features: this.features()
196
- };
197
- }
198
- setup(s, artifactory, tr, pm) {
199
- return new Promise((res) => res(s));
200
- }
201
- assertThat(t) {
202
- return !!t;
203
- }
204
- afterAll(store, artifactory, pm) {
205
- return store;
206
- }
207
- async run(input, testResourceConfiguration, artifactory, tLog, pm) {
208
- this.testResourceConfiguration = testResourceConfiguration;
209
- const suiteArtifactory = (fPath, value) => artifactory(`suite-${this.index}-${this.name}/${fPath}`, value);
210
- tLog("\nSuite:", this.index, this.name);
211
- const sNdx = this.index;
212
- const subject = await this.setup(
213
- input,
214
- suiteArtifactory,
215
- testResourceConfiguration,
216
- beforeAllProxy(pm, sNdx.toString())
217
- );
218
- for (const [gKey, g] of Object.entries(this.givens)) {
219
- const giver = this.givens[gKey];
220
- this.store = await giver.give(
221
- subject,
222
- gKey,
223
- testResourceConfiguration,
224
- this.assertThat,
225
- suiteArtifactory,
226
- tLog,
227
- pm,
228
- sNdx
229
- ).catch((e) => {
230
- this.failed = true;
231
- this.fails = this.fails + 1;
232
- console.error("Given error 1:", e);
233
- throw e;
234
- });
235
- }
236
- try {
237
- this.afterAll(
238
- this.store,
239
- artifactory,
240
- afterAllProxy(pm, sNdx.toString())
241
- );
242
- } catch (e) {
243
- console.error(e);
244
- }
245
- return this;
246
- }
247
- };
248
-
249
- // src/lib/index.ts
250
- var BaseAdapter = () => ({
251
- beforeAll: async (s) => s,
252
- beforeEach: async function(subject, initialValues, x, testResource, pm) {
253
- return subject;
254
- },
255
- afterEach: async (s) => s,
256
- afterAll: (store) => void 0,
257
- butThen: async (store, thenCb) => {
258
- return thenCb(store);
259
- },
260
- andWhen: async (store, whenCB, testResource, pm) => {
261
- try {
262
- await whenCB(store, testResource, pm);
263
- } catch (error) {
264
- console.error("Error in andWhen:", error);
265
- throw error;
266
- }
267
- },
268
- assertThis: (x) => x
269
- });
270
- var DefaultAdapter = (p) => {
271
- return {
272
- ...BaseAdapter,
273
- ...p
274
- };
275
- };
276
- var defaultTestResourceRequirement = {
277
- ports: 0
278
- };
279
-
280
- // src/lib/basebuilder.ts
281
- var BaseBuilder = class {
282
- constructor(input, suitesOverrides, givenOverides, whenOverides, thenOverides, testResourceRequirement, testSpecification) {
283
- this.artifacts = [];
284
- this.artifacts = [];
285
- this.testResourceRequirement = testResourceRequirement;
286
- this.suitesOverrides = suitesOverrides;
287
- this.givenOverides = givenOverides;
288
- this.whenOverides = whenOverides;
289
- this.thenOverides = thenOverides;
290
- this.testSpecification = testSpecification;
291
- this.specs = testSpecification(
292
- this.Suites(),
293
- this.Given(),
294
- this.When(),
295
- this.Then()
296
- );
297
- this.testJobs = this.specs.map((suite) => {
298
- const suiteRunner = (suite2) => async (puppetMaster, tLog) => {
299
- const x = await suite2.run(
300
- input,
301
- puppetMaster.testResourceConfiguration,
302
- (fPath, value) => puppetMaster.testArtiFactoryfileWriter(
303
- tLog,
304
- (p) => {
305
- this.artifacts.push(p);
306
- }
307
- )(puppetMaster.testResourceConfiguration.fs + "/" + fPath, value),
308
- tLog,
309
- puppetMaster
310
- );
311
- return x;
312
- };
313
- const runner = suiteRunner(suite);
314
- return {
315
- test: suite,
316
- toObj: () => {
317
- return suite.toObj();
318
- },
319
- runner,
320
- receiveTestResourceConfig: async function(puppetMaster) {
321
- const logFilePath = "logs.txt";
322
- const access = await puppetMaster.createWriteStream(
323
- logFilePath
324
- );
325
- const tLog = async (...l) => {
326
- };
327
- const suiteDone = await runner(puppetMaster, tLog);
328
- const logPromise = new Promise(async (res) => {
329
- await puppetMaster.end(access);
330
- res(true);
331
- });
332
- const fails = suiteDone.fails;
333
- await puppetMaster.writeFileSync(`bdd_errors.txt`, fails.toString());
334
- await puppetMaster.writeFileSync(
335
- `tests.json`,
336
- JSON.stringify(this.toObj(), null, 2)
337
- );
338
- return {
339
- failed: fails > 0,
340
- fails,
341
- artifacts: this.artifacts || [],
342
- logPromise,
343
- features: suiteDone.features()
344
- };
345
- }
346
- };
347
- });
348
- }
349
- // testsJson() {
350
- // puppetMaster.writeFileSync(
351
- // `tests.json`,
352
- // JSON.stringify({ features: suiteDone.features() }, null, 2)
353
- // );
354
- // }
355
- Specs() {
356
- return this.specs;
357
- }
358
- Suites() {
359
- return this.suitesOverrides;
360
- }
361
- Given() {
362
- return this.givenOverides;
363
- }
364
- When() {
365
- return this.whenOverides;
366
- }
367
- Then() {
368
- return this.thenOverides;
369
- }
370
- };
371
-
372
- // src/lib/abstractBase.ts
373
- var BaseGiven = class {
374
- constructor(name, features, whens, thens, givenCB, initialValues) {
375
- this.name = name;
376
- this.features = features;
377
- this.whens = whens;
378
- this.thens = thens;
379
- this.givenCB = givenCB;
380
- this.initialValues = initialValues;
381
- }
382
- beforeAll(store) {
383
- return store;
384
- }
385
- toObj() {
386
- return {
387
- key: this.key,
388
- name: this.name,
389
- whens: this.whens.map((w) => {
390
- if (w && w.toObj)
391
- return w.toObj();
392
- console.error("w is not as expected!", w);
393
- return {};
394
- }),
395
- thens: this.thens.map((t) => t.toObj()),
396
- error: this.error ? [this.error, this.error.stack] : null,
397
- failed: this.failed,
398
- features: this.features
399
- };
400
- }
401
- async afterEach(store, key, artifactory, pm) {
402
- return store;
403
- }
404
- async give(subject, key, testResourceConfiguration, tester, artifactory, tLog, pm, suiteNdx) {
405
- this.key = key;
406
- tLog(`
407
- ${this.key}`);
408
- tLog(`
409
- Given: ${this.name}`);
410
- const givenArtifactory = (fPath, value) => artifactory(`given-${key}/${fPath}`, value);
411
- this.uberCatcher((e) => {
412
- console.error(e);
413
- this.error = e.error;
414
- tLog(e.stack);
415
- });
416
- try {
417
- this.store = await this.givenThat(
418
- subject,
419
- testResourceConfiguration,
420
- givenArtifactory,
421
- this.givenCB,
422
- this.initialValues,
423
- beforeEachProxy(pm, suiteNdx.toString())
424
- );
425
- } catch (e) {
426
- console.error("failure 4 ", e);
427
- this.error = e;
428
- throw e;
429
- }
430
- try {
431
- for (const [whenNdx, whenStep] of this.whens.entries()) {
432
- await whenStep.test(
433
- this.store,
434
- testResourceConfiguration,
435
- tLog,
436
- pm,
437
- `suite-${suiteNdx}/given-${key}/when/${whenNdx}`
438
- );
439
- }
440
- for (const [thenNdx, thenStep] of this.thens.entries()) {
441
- const t = await thenStep.test(
442
- this.store,
443
- testResourceConfiguration,
444
- tLog,
445
- pm,
446
- `suite-${suiteNdx}/given-${key}/then-${thenNdx}`
447
- );
448
- tester(t);
449
- }
450
- } catch (e) {
451
- this.failed = true;
452
- tLog(e.stack);
453
- throw e;
454
- } finally {
455
- try {
456
- await this.afterEach(
457
- this.store,
458
- this.key,
459
- givenArtifactory,
460
- afterEachProxy(pm, suiteNdx.toString(), key)
461
- );
462
- } catch (e) {
463
- console.error("afterEach failed!", e);
464
- this.failed = e;
465
- throw e;
466
- }
467
- }
468
- return this.store;
469
- }
470
- };
471
- var BaseWhen = class {
472
- constructor(name, whenCB) {
473
- this.name = name;
474
- this.whenCB = whenCB;
475
- }
476
- toObj() {
477
- console.log("toObj error", this.error);
478
- return {
479
- name: this.name,
480
- error: this.error && this.error.name + this.error.stack
481
- };
482
- }
483
- async test(store, testResourceConfiguration, tLog, pm, filepath) {
484
- try {
485
- tLog(" When:", this.name);
486
- console.debug("[DEBUG] Executing When step:", this.name);
487
- const result = await this.andWhen(
488
- store,
489
- this.whenCB,
490
- testResourceConfiguration,
491
- andWhenProxy(pm, filepath)
492
- );
493
- console.debug("[DEBUG] When step completed:", this.name);
494
- return result;
495
- } catch (e) {
496
- console.error("[ERROR] When step failed:", this.name, e);
497
- this.error = e;
498
- throw e;
499
- }
500
- }
501
- };
502
- var BaseThen = class {
503
- constructor(name, thenCB) {
504
- this.name = name;
505
- this.thenCB = thenCB;
506
- this.error = false;
507
- }
508
- toObj() {
509
- return {
510
- name: this.name,
511
- error: this.error
512
- };
513
- }
514
- async test(store, testResourceConfiguration, tLog, pm, filepath) {
515
- return this.butThen(
516
- store,
517
- async (s) => {
518
- if (typeof this.thenCB === "function") {
519
- return await this.thenCB(s);
520
- } else {
521
- return this.thenCB;
522
- }
523
- },
524
- testResourceConfiguration,
525
- butThenProxy(pm, filepath)
526
- ).catch((e) => {
527
- this.error = e.toString();
528
- });
529
- }
530
- };
531
-
532
- // src/lib/classBuilder.ts
533
- var ClassBuilder = class extends BaseBuilder {
534
- constructor(testImplementation, testSpecification, input, suiteKlasser, givenKlasser, whenKlasser, thenKlasser, testResourceRequirement) {
535
- const classySuites = Object.entries(testImplementation.suites).reduce(
536
- (a, [key], index) => {
537
- a[key] = (somestring, givens) => {
538
- return new suiteKlasser.prototype.constructor(
539
- somestring,
540
- index,
541
- givens
542
- );
543
- };
544
- return a;
545
- },
546
- {}
547
- );
548
- const classyGivens = Object.entries(testImplementation.givens).reduce(
549
- (a, [key, g]) => {
550
- a[key] = (features, whens, thens, ...initialValues) => {
551
- return new givenKlasser.prototype.constructor(
552
- key,
553
- features,
554
- whens,
555
- thens,
556
- testImplementation.givens[key],
557
- initialValues
558
- );
559
- };
560
- return a;
561
- },
562
- {}
563
- );
564
- const classyWhens = Object.entries(testImplementation.whens).reduce(
565
- (a, [key, whEn]) => {
566
- a[key] = (...payload) => {
567
- return new whenKlasser.prototype.constructor(
568
- `${whEn.name}: ${payload && payload.toString()}`,
569
- whEn(...payload)
570
- );
571
- };
572
- return a;
573
- },
574
- {}
575
- );
576
- const classyThens = Object.entries(
577
- testImplementation.thens
578
- ).reduce(
579
- (a, [key, thEn]) => {
580
- a[key] = (expected, ...x) => {
581
- return new thenKlasser.prototype.constructor(
582
- `${thEn.name}: ${expected && expected.toString()}`,
583
- thEn(expected, ...x)
584
- );
585
- };
586
- return a;
587
- },
588
- {}
589
- );
590
- super(
591
- input,
592
- classySuites,
593
- classyGivens,
594
- classyWhens,
595
- classyThens,
596
- testResourceRequirement,
597
- testSpecification
598
- );
599
- }
600
- };
601
-
602
- // src/lib/core.ts
603
- var TesterantoCore = class extends ClassBuilder {
604
- constructor(input, testSpecification, testImplementation, testResourceRequirement = defaultTestResourceRequirement, testAdapter, uberCatcher) {
605
- const fullAdapter = DefaultAdapter(testAdapter);
606
- super(
607
- testImplementation,
608
- testSpecification,
609
- input,
610
- class extends BaseSuite {
611
- afterAll(store, artifactory, pm) {
612
- return fullAdapter.afterAll(store, pm);
613
- }
614
- assertThat(t) {
615
- return fullAdapter.assertThis(t);
616
- }
617
- async setup(s, artifactory, tr, pm) {
618
- return (fullAdapter.beforeAll || (async (input2, artifactory2, tr2, pm2) => input2))(
619
- s,
620
- this.testResourceConfiguration,
621
- // artifactory,
622
- pm
623
- );
624
- }
625
- },
626
- class Given extends BaseGiven {
627
- constructor() {
628
- super(...arguments);
629
- this.uberCatcher = uberCatcher;
630
- }
631
- async givenThat(subject, testResource, artifactory, initializer, initialValues, pm) {
632
- return fullAdapter.beforeEach(
633
- subject,
634
- initializer,
635
- testResource,
636
- initialValues,
637
- pm
638
- );
639
- }
640
- afterEach(store, key, artifactory, pm) {
641
- return new Promise(
642
- (res) => res(fullAdapter.afterEach(store, key, pm))
643
- );
644
- }
645
- },
646
- class When extends BaseWhen {
647
- async andWhen(store, whenCB, testResource, pm) {
648
- return await fullAdapter.andWhen(store, whenCB, testResource, pm);
649
- }
650
- },
651
- class Then extends BaseThen {
652
- async butThen(store, thenCB, testResource, pm) {
653
- return await fullAdapter.butThen(store, thenCB, testResource, pm);
654
- }
655
- },
656
- testResourceRequirement
657
- );
658
- }
659
- };
660
-
661
- // src/PM/index.ts
662
- var PM = class {
663
- };
664
-
665
- export {
666
- defaultTestResourceRequirement,
667
- BaseGiven,
668
- BaseWhen,
669
- BaseThen,
670
- BaseBuilder,
671
- BaseSuite,
672
- TesterantoCore,
673
- PM
674
- };