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