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,677 +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/basebuilder.ts
162
- var BaseBuilder = class {
163
- constructor(input, suitesOverrides, givenOverides, whenOverides, thenOverides, testResourceRequirement, testSpecification) {
164
- this.artifacts = [];
165
- this.artifacts = [];
166
- this.testResourceRequirement = testResourceRequirement;
167
- this.suitesOverrides = suitesOverrides;
168
- this.givenOverides = givenOverides;
169
- this.whenOverides = whenOverides;
170
- this.thenOverides = thenOverides;
171
- this.testSpecification = testSpecification;
172
- this.specs = testSpecification(
173
- this.Suites(),
174
- this.Given(),
175
- this.When(),
176
- this.Then()
177
- );
178
- this.testJobs = this.specs.map((suite) => {
179
- const suiteRunner = (suite2) => async (puppetMaster, tLog) => {
180
- const x = await suite2.run(
181
- input,
182
- puppetMaster.testResourceConfiguration,
183
- (fPath, value) => puppetMaster.testArtiFactoryfileWriter(
184
- tLog,
185
- (p) => {
186
- this.artifacts.push(p);
187
- }
188
- )(puppetMaster.testResourceConfiguration.fs + "/" + fPath, value),
189
- tLog,
190
- puppetMaster
191
- );
192
- return x;
193
- };
194
- const runner = suiteRunner(suite);
195
- return {
196
- test: suite,
197
- toObj: () => {
198
- return suite.toObj();
199
- },
200
- runner,
201
- receiveTestResourceConfig: async function(puppetMaster) {
202
- const logFilePath = "logs.txt";
203
- const access = await puppetMaster.createWriteStream(
204
- logFilePath
205
- );
206
- const tLog = async (...l) => {
207
- };
208
- const suiteDone = await runner(puppetMaster, tLog);
209
- const logPromise = new Promise(async (res) => {
210
- await puppetMaster.end(access);
211
- res(true);
212
- });
213
- const fails = suiteDone.fails;
214
- await puppetMaster.writeFileSync(`bdd_errors.txt`, fails.toString());
215
- await puppetMaster.writeFileSync(
216
- `tests.json`,
217
- JSON.stringify(this.toObj(), null, 2)
218
- );
219
- return {
220
- failed: fails > 0,
221
- fails,
222
- artifacts: this.artifacts || [],
223
- logPromise,
224
- features: suiteDone.features()
225
- };
226
- }
227
- };
228
- });
229
- }
230
- // testsJson() {
231
- // puppetMaster.writeFileSync(
232
- // `tests.json`,
233
- // JSON.stringify({ features: suiteDone.features() }, null, 2)
234
- // );
235
- // }
236
- Specs() {
237
- return this.specs;
238
- }
239
- Suites() {
240
- return this.suitesOverrides;
241
- }
242
- Given() {
243
- return this.givenOverides;
244
- }
245
- When() {
246
- return this.whenOverides;
247
- }
248
- Then() {
249
- return this.thenOverides;
250
- }
251
- };
252
-
253
- // src/lib/classBuilder.ts
254
- var ClassBuilder = class extends BaseBuilder {
255
- constructor(testImplementation, testSpecification, input, suiteKlasser, givenKlasser, whenKlasser, thenKlasser, testResourceRequirement) {
256
- const classySuites = Object.entries(testImplementation.suites).reduce(
257
- (a, [key], index) => {
258
- a[key] = (somestring, givens) => {
259
- return new suiteKlasser.prototype.constructor(
260
- somestring,
261
- index,
262
- givens
263
- );
264
- };
265
- return a;
266
- },
267
- {}
268
- );
269
- const classyGivens = Object.entries(testImplementation.givens).reduce(
270
- (a, [key, g]) => {
271
- a[key] = (features, whens, thens, ...initialValues) => {
272
- return new givenKlasser.prototype.constructor(
273
- key,
274
- features,
275
- whens,
276
- thens,
277
- testImplementation.givens[key],
278
- initialValues
279
- );
280
- };
281
- return a;
282
- },
283
- {}
284
- );
285
- const classyWhens = Object.entries(testImplementation.whens).reduce(
286
- (a, [key, whEn]) => {
287
- a[key] = (...payload) => {
288
- return new whenKlasser.prototype.constructor(
289
- `${whEn.name}: ${payload && payload.toString()}`,
290
- whEn(...payload)
291
- );
292
- };
293
- return a;
294
- },
295
- {}
296
- );
297
- const classyThens = Object.entries(
298
- testImplementation.thens
299
- ).reduce(
300
- (a, [key, thEn]) => {
301
- a[key] = (expected, ...x) => {
302
- return new thenKlasser.prototype.constructor(
303
- `${thEn.name}: ${expected && expected.toString()}`,
304
- thEn(expected, ...x)
305
- );
306
- };
307
- return a;
308
- },
309
- {}
310
- );
311
- super(
312
- input,
313
- classySuites,
314
- classyGivens,
315
- classyWhens,
316
- classyThens,
317
- testResourceRequirement,
318
- testSpecification
319
- );
320
- }
321
- };
322
-
323
- // src/lib/BaseSuite.ts
324
- var BaseSuite = class {
325
- constructor(name, index, givens = {}) {
326
- const suiteName = name || "testSuite";
327
- if (!suiteName) {
328
- throw new Error("BaseSuite requires a non-empty name");
329
- }
330
- console.log("[DEBUG] BaseSuite constructor - name:", suiteName, "index:", index);
331
- this.name = suiteName;
332
- this.index = index;
333
- this.givens = givens;
334
- this.fails = 0;
335
- console.log("[DEBUG] BaseSuite initialized:", this.name, this.index);
336
- console.log("[DEBUG] BaseSuite givens:", Object.keys(givens));
337
- }
338
- features() {
339
- try {
340
- const features = Object.keys(this.givens).map((k) => this.givens[k].features).flat().filter((value, index, array) => {
341
- return array.indexOf(value) === index;
342
- });
343
- console.debug("[DEBUG] Features extracted:", features);
344
- return features || [];
345
- } catch (e) {
346
- console.error("[ERROR] Failed to extract features:", e);
347
- return [];
348
- }
349
- }
350
- toObj() {
351
- const givens = Object.keys(this.givens).map((k) => this.givens[k].toObj());
352
- return {
353
- name: this.name,
354
- givens,
355
- fails: this.fails,
356
- failed: this.failed,
357
- features: this.features()
358
- };
359
- }
360
- setup(s, artifactory, tr, pm) {
361
- return new Promise((res) => res(s));
362
- }
363
- assertThat(t) {
364
- return !!t;
365
- }
366
- afterAll(store, artifactory, pm) {
367
- return store;
368
- }
369
- async run(input, testResourceConfiguration, artifactory, tLog, pm) {
370
- this.testResourceConfiguration = testResourceConfiguration;
371
- const suiteArtifactory = (fPath, value) => artifactory(`suite-${this.index}-${this.name}/${fPath}`, value);
372
- tLog("\nSuite:", this.index, this.name);
373
- const sNdx = this.index;
374
- const subject = await this.setup(
375
- input,
376
- suiteArtifactory,
377
- testResourceConfiguration,
378
- beforeAllProxy(pm, sNdx.toString())
379
- );
380
- for (const [gKey, g] of Object.entries(this.givens)) {
381
- const giver = this.givens[gKey];
382
- this.store = await giver.give(
383
- subject,
384
- gKey,
385
- testResourceConfiguration,
386
- this.assertThat,
387
- suiteArtifactory,
388
- tLog,
389
- pm,
390
- sNdx
391
- ).catch((e) => {
392
- this.failed = true;
393
- this.fails = this.fails + 1;
394
- console.error("Given error 1:", e);
395
- throw e;
396
- });
397
- }
398
- try {
399
- this.afterAll(
400
- this.store,
401
- artifactory,
402
- afterAllProxy(pm, sNdx.toString())
403
- );
404
- } catch (e) {
405
- console.error(e);
406
- }
407
- return this;
408
- }
409
- };
410
-
411
- // src/lib/index.ts
412
- var BaseAdapter = () => ({
413
- beforeAll: async (s) => s,
414
- beforeEach: async function(subject, initialValues, x, testResource, pm) {
415
- return subject;
416
- },
417
- afterEach: async (s) => s,
418
- afterAll: (store) => void 0,
419
- butThen: async (store, thenCb) => {
420
- return thenCb(store);
421
- },
422
- andWhen: async (store, whenCB, testResource, pm) => {
423
- try {
424
- await whenCB(store, testResource, pm);
425
- } catch (error) {
426
- console.error("Error in andWhen:", error);
427
- throw error;
428
- }
429
- },
430
- assertThis: (x) => x
431
- });
432
- var DefaultAdapter = (p) => {
433
- return {
434
- ...BaseAdapter,
435
- ...p
436
- };
437
- };
438
- var defaultTestResourceRequirement = {
439
- ports: 0
440
- };
441
-
442
- // src/lib/abstractBase.ts
443
- var BaseGiven = class {
444
- constructor(name, features, whens, thens, givenCB, initialValues) {
445
- this.name = name;
446
- this.features = features;
447
- this.whens = whens;
448
- this.thens = thens;
449
- this.givenCB = givenCB;
450
- this.initialValues = initialValues;
451
- }
452
- beforeAll(store) {
453
- return store;
454
- }
455
- toObj() {
456
- return {
457
- key: this.key,
458
- name: this.name,
459
- whens: this.whens.map((w) => {
460
- if (w && w.toObj)
461
- return w.toObj();
462
- console.error("w is not as expected!", w);
463
- return {};
464
- }),
465
- thens: this.thens.map((t) => t.toObj()),
466
- error: this.error ? [this.error, this.error.stack] : null,
467
- failed: this.failed,
468
- features: this.features
469
- };
470
- }
471
- async afterEach(store, key, artifactory, pm) {
472
- return store;
473
- }
474
- async give(subject, key, testResourceConfiguration, tester, artifactory, tLog, pm, suiteNdx) {
475
- this.key = key;
476
- tLog(`
477
- ${this.key}`);
478
- tLog(`
479
- Given: ${this.name}`);
480
- const givenArtifactory = (fPath, value) => artifactory(`given-${key}/${fPath}`, value);
481
- this.uberCatcher((e) => {
482
- console.error(e);
483
- this.error = e.error;
484
- tLog(e.stack);
485
- });
486
- try {
487
- this.store = await this.givenThat(
488
- subject,
489
- testResourceConfiguration,
490
- givenArtifactory,
491
- this.givenCB,
492
- this.initialValues,
493
- beforeEachProxy(pm, suiteNdx.toString())
494
- );
495
- } catch (e) {
496
- console.error("failure 4 ", e);
497
- this.error = e;
498
- throw e;
499
- }
500
- try {
501
- for (const [whenNdx, whenStep] of this.whens.entries()) {
502
- await whenStep.test(
503
- this.store,
504
- testResourceConfiguration,
505
- tLog,
506
- pm,
507
- `suite-${suiteNdx}/given-${key}/when/${whenNdx}`
508
- );
509
- }
510
- for (const [thenNdx, thenStep] of this.thens.entries()) {
511
- const t = await thenStep.test(
512
- this.store,
513
- testResourceConfiguration,
514
- tLog,
515
- pm,
516
- `suite-${suiteNdx}/given-${key}/then-${thenNdx}`
517
- );
518
- tester(t);
519
- }
520
- } catch (e) {
521
- this.failed = true;
522
- tLog(e.stack);
523
- throw e;
524
- } finally {
525
- try {
526
- await this.afterEach(
527
- this.store,
528
- this.key,
529
- givenArtifactory,
530
- afterEachProxy(pm, suiteNdx.toString(), key)
531
- );
532
- } catch (e) {
533
- console.error("afterEach failed!", e);
534
- this.failed = e;
535
- throw e;
536
- }
537
- }
538
- return this.store;
539
- }
540
- };
541
- var BaseWhen = class {
542
- constructor(name, whenCB) {
543
- this.name = name;
544
- this.whenCB = whenCB;
545
- }
546
- toObj() {
547
- console.log("toObj error", this.error);
548
- return {
549
- name: this.name,
550
- error: this.error && this.error.name + this.error.stack
551
- };
552
- }
553
- async test(store, testResourceConfiguration, tLog, pm, filepath) {
554
- try {
555
- tLog(" When:", this.name);
556
- console.debug("[DEBUG] Executing When step:", this.name);
557
- const result = await this.andWhen(
558
- store,
559
- this.whenCB,
560
- testResourceConfiguration,
561
- andWhenProxy(pm, filepath)
562
- );
563
- console.debug("[DEBUG] When step completed:", this.name);
564
- return result;
565
- } catch (e) {
566
- console.error("[ERROR] When step failed:", this.name, e);
567
- this.error = e;
568
- throw e;
569
- }
570
- }
571
- };
572
- var BaseThen = class {
573
- constructor(name, thenCB) {
574
- this.name = name;
575
- this.thenCB = thenCB;
576
- this.error = false;
577
- }
578
- toObj() {
579
- return {
580
- name: this.name,
581
- error: this.error
582
- };
583
- }
584
- async test(store, testResourceConfiguration, tLog, pm, filepath) {
585
- return this.butThen(
586
- store,
587
- async (s) => {
588
- if (typeof this.thenCB === "function") {
589
- return await this.thenCB(s);
590
- } else {
591
- return this.thenCB;
592
- }
593
- },
594
- testResourceConfiguration,
595
- butThenProxy(pm, filepath)
596
- ).catch((e) => {
597
- this.error = e.toString();
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
- butThenProxy,
668
- andWhenProxy,
669
- BaseGiven,
670
- BaseWhen,
671
- BaseThen,
672
- BaseBuilder,
673
- ClassBuilder,
674
- BaseSuite,
675
- TesterantoCore,
676
- PM
677
- };