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,797 +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/BaseSuite.ts
259
- var BaseSuite = class {
260
- constructor(name, index, givens = {}) {
261
- const suiteName = name || "testSuite";
262
- if (!suiteName) {
263
- throw new Error("BaseSuite requires a non-empty name");
264
- }
265
- console.log(
266
- "[DEBUG] BaseSuite constructor - name:",
267
- suiteName,
268
- "index:",
269
- index
270
- );
271
- this.name = suiteName;
272
- this.index = index;
273
- this.givens = givens;
274
- this.fails = 0;
275
- console.log("[DEBUG] BaseSuite initialized:", this.name, this.index);
276
- console.log("[DEBUG] BaseSuite givens:", Object.keys(givens).toString());
277
- }
278
- features() {
279
- try {
280
- const features = Object.keys(this.givens).map((k) => this.givens[k].features).flat().filter((value, index, array) => {
281
- return array.indexOf(value) === index;
282
- });
283
- console.debug("[DEBUG] Features extracted:", features.toString());
284
- return features || [];
285
- } catch (e) {
286
- console.error("[ERROR] Failed to extract features:", e);
287
- return [];
288
- }
289
- }
290
- toObj() {
291
- const givens = Object.keys(this.givens).map((k) => this.givens[k].toObj());
292
- return {
293
- name: this.name,
294
- givens,
295
- fails: this.fails,
296
- failed: this.failed,
297
- features: this.features()
298
- };
299
- }
300
- setup(s, artifactory, tr, pm) {
301
- return new Promise((res) => res(s));
302
- }
303
- assertThat(t) {
304
- return !!t;
305
- }
306
- afterAll(store, artifactory, pm) {
307
- return store;
308
- }
309
- async run(input, testResourceConfiguration, artifactory, tLog, pm) {
310
- this.testResourceConfiguration = testResourceConfiguration;
311
- const suiteArtifactory = (fPath, value) => artifactory(`suite-${this.index}-${this.name}/${fPath}`, value);
312
- tLog("\nSuite:", this.index, this.name);
313
- const sNdx = this.index;
314
- const subject = await this.setup(
315
- input,
316
- suiteArtifactory,
317
- testResourceConfiguration,
318
- beforeAllProxy(pm, sNdx.toString())
319
- );
320
- for (const [gKey, g] of Object.entries(this.givens)) {
321
- const giver = this.givens[gKey];
322
- this.store = await giver.give(
323
- subject,
324
- gKey,
325
- testResourceConfiguration,
326
- this.assertThat,
327
- suiteArtifactory,
328
- tLog,
329
- pm,
330
- sNdx
331
- ).catch((e) => {
332
- this.failed = true;
333
- this.fails = this.fails + 1;
334
- throw e;
335
- });
336
- }
337
- try {
338
- this.afterAll(
339
- this.store,
340
- artifactory,
341
- afterAllProxy(pm, sNdx.toString())
342
- );
343
- } catch (e) {
344
- console.error(e);
345
- }
346
- return this;
347
- }
348
- };
349
-
350
- // src/lib/index.ts
351
- var BaseAdapter = () => ({
352
- beforeAll: async (s) => s,
353
- beforeEach: async function(subject, initialValues, x, testResource, pm) {
354
- return subject;
355
- },
356
- afterEach: async (s) => s,
357
- afterAll: (store) => void 0,
358
- butThen: async (store, thenCb) => {
359
- return thenCb(store);
360
- },
361
- andWhen: async (store, whenCB, testResource, pm) => {
362
- try {
363
- await whenCB(store, testResource, pm);
364
- } catch (error) {
365
- console.error("Error in andWhen:", error);
366
- throw error;
367
- }
368
- },
369
- assertThis: (x) => x
370
- });
371
- var DefaultAdapter = (p) => {
372
- return {
373
- ...BaseAdapter,
374
- ...p
375
- };
376
- };
377
- var defaultTestResourceRequirement = {
378
- ports: 0
379
- };
380
-
381
- // src/lib/basebuilder.ts
382
- var BaseBuilder = class {
383
- constructor(input, suitesOverrides, givenOverides, whenOverides, thenOverides, testResourceRequirement, testSpecification) {
384
- this.artifacts = [];
385
- this.artifacts = [];
386
- this.testResourceRequirement = testResourceRequirement;
387
- this.suitesOverrides = suitesOverrides;
388
- this.givenOverides = givenOverides;
389
- this.whenOverides = whenOverides;
390
- this.thenOverides = thenOverides;
391
- this.testSpecification = testSpecification;
392
- this.specs = testSpecification(
393
- this.Suites(),
394
- this.Given(),
395
- this.When(),
396
- this.Then()
397
- );
398
- this.testJobs = this.specs.map((suite) => {
399
- const suiteRunner = (suite2) => async (puppetMaster, tLog) => {
400
- const x = await suite2.run(
401
- input,
402
- puppetMaster.testResourceConfiguration,
403
- (fPath, value) => puppetMaster.testArtiFactoryfileWriter(
404
- tLog,
405
- (p) => {
406
- this.artifacts.push(p);
407
- }
408
- )(puppetMaster.testResourceConfiguration.fs + "/" + fPath, value),
409
- tLog,
410
- puppetMaster
411
- );
412
- return x;
413
- };
414
- const runner = suiteRunner(suite);
415
- return {
416
- test: suite,
417
- toObj: () => {
418
- return suite.toObj();
419
- },
420
- runner,
421
- receiveTestResourceConfig: async function(puppetMaster) {
422
- const tLog = async (...l) => {
423
- };
424
- const suiteDone = await runner(puppetMaster, tLog);
425
- const fails = suiteDone.fails;
426
- await puppetMaster.writeFileSync(`bdd_errors.txt`, fails.toString());
427
- await puppetMaster.writeFileSync(
428
- `tests.json`,
429
- JSON.stringify(this.toObj(), null, 2)
430
- );
431
- return {
432
- failed: fails > 0,
433
- fails,
434
- artifacts: this.artifacts || [],
435
- // logPromise,
436
- features: suiteDone.features()
437
- };
438
- }
439
- };
440
- });
441
- }
442
- // testsJson() {
443
- // puppetMaster.writeFileSync(
444
- // `tests.json`,
445
- // JSON.stringify({ features: suiteDone.features() }, null, 2)
446
- // );
447
- // }
448
- Specs() {
449
- return this.specs;
450
- }
451
- Suites() {
452
- return this.suitesOverrides;
453
- }
454
- Given() {
455
- return this.givenOverides;
456
- }
457
- When() {
458
- return this.whenOverides;
459
- }
460
- Then() {
461
- return this.thenOverides;
462
- }
463
- };
464
-
465
- // src/lib/abstractBase.ts
466
- var BaseGiven = class {
467
- constructor(name, features, whens, thens, givenCB, initialValues) {
468
- this.artifacts = [];
469
- this.name = name;
470
- this.features = features;
471
- this.whens = whens;
472
- this.thens = thens;
473
- this.givenCB = givenCB;
474
- this.initialValues = initialValues;
475
- }
476
- addArtifact(path) {
477
- console.log(`[Artifact] Adding to ${this.constructor.name}:`, path);
478
- this.artifacts.push(path);
479
- }
480
- beforeAll(store) {
481
- return store;
482
- }
483
- toObj() {
484
- return {
485
- key: this.key,
486
- name: this.name,
487
- whens: this.whens.map((w) => {
488
- if (w && w.toObj)
489
- return w.toObj();
490
- console.error("w is not as expected!", w.toString());
491
- return {};
492
- }),
493
- thens: this.thens.map((t) => t.toObj()),
494
- error: this.error ? [this.error, this.error.stack] : null,
495
- failed: this.failed,
496
- features: this.features,
497
- artifacts: this.artifacts
498
- };
499
- }
500
- async afterEach(store, key, artifactory, pm) {
501
- return store;
502
- }
503
- async give(subject, key, testResourceConfiguration, tester, artifactory, tLog, pm, suiteNdx) {
504
- this.key = key;
505
- tLog(`
506
- ${this.key}`);
507
- tLog(`
508
- Given: ${this.name}`);
509
- const givenArtifactory = (fPath, value) => artifactory(`given-${key}/${fPath}`, value);
510
- this.uberCatcher((e) => {
511
- console.error(e.toString());
512
- this.error = e.error;
513
- tLog(e.stack);
514
- });
515
- try {
516
- const proxiedPm = beforeEachProxy(pm, suiteNdx.toString());
517
- console.log(`[Given] Setting currentStep for beforeEach:`, this.name);
518
- proxiedPm.currentStep = this;
519
- this.store = await this.givenThat(
520
- subject,
521
- testResourceConfiguration,
522
- givenArtifactory,
523
- this.givenCB,
524
- this.initialValues,
525
- proxiedPm
526
- );
527
- } catch (e) {
528
- console.error("Given failure: ", e.toString());
529
- this.error = e;
530
- throw e;
531
- }
532
- try {
533
- for (const [whenNdx, whenStep] of this.whens.entries()) {
534
- await whenStep.test(
535
- this.store,
536
- testResourceConfiguration,
537
- tLog,
538
- pm,
539
- `suite-${suiteNdx}/given-${key}/when/${whenNdx}`
540
- );
541
- }
542
- for (const [thenNdx, thenStep] of this.thens.entries()) {
543
- const t = await thenStep.test(
544
- this.store,
545
- testResourceConfiguration,
546
- tLog,
547
- pm,
548
- `suite-${suiteNdx}/given-${key}/then-${thenNdx}`
549
- );
550
- tester(t);
551
- }
552
- } catch (e) {
553
- this.failed = true;
554
- tLog(e.stack);
555
- throw e;
556
- } finally {
557
- try {
558
- await this.afterEach(
559
- this.store,
560
- this.key,
561
- givenArtifactory,
562
- afterEachProxy(pm, suiteNdx.toString(), key)
563
- );
564
- } catch (e) {
565
- console.error("afterEach failed!", e.toString());
566
- this.failed = e;
567
- throw e;
568
- }
569
- }
570
- return this.store;
571
- }
572
- };
573
- var BaseWhen = class {
574
- constructor(name, whenCB) {
575
- this.artifacts = [];
576
- this.name = name;
577
- this.whenCB = whenCB;
578
- }
579
- toObj() {
580
- console.log("toObj error", this.error);
581
- if (this.error) {
582
- return {
583
- name: this.name,
584
- error: this.error && this.error.name + this.error.stack,
585
- artifacts: this.artifacts
586
- };
587
- } else {
588
- return {
589
- name: this.name,
590
- artifacts: this.artifacts
591
- };
592
- }
593
- }
594
- async test(store, testResourceConfiguration, tLog, pm, filepath) {
595
- try {
596
- tLog(" When:", this.name);
597
- console.debug("[DEBUG] Executing When step:", this.name.toString());
598
- const proxiedPm = andWhenProxy(pm, filepath);
599
- console.log(`[When] Setting currentStep for andWhen:`, this.name);
600
- proxiedPm.currentStep = this;
601
- const result = await this.andWhen(
602
- store,
603
- this.whenCB,
604
- testResourceConfiguration,
605
- proxiedPm
606
- );
607
- console.debug("[DEBUG] When step completed:", this.name.toString());
608
- return result;
609
- } catch (e) {
610
- console.error(
611
- "[ERROR] When step failed:",
612
- this.name.toString(),
613
- e.toString()
614
- );
615
- this.error = e;
616
- throw e;
617
- }
618
- }
619
- };
620
- var BaseThen = class {
621
- constructor(name, thenCB) {
622
- this.artifacts = [];
623
- this.name = name;
624
- this.thenCB = thenCB;
625
- this.error = false;
626
- }
627
- toObj() {
628
- return {
629
- name: this.name,
630
- error: this.error,
631
- artifacts: this.artifacts
632
- };
633
- }
634
- async test(store, testResourceConfiguration, tLog, pm, filepath) {
635
- const proxiedPm = butThenProxy(pm, filepath);
636
- console.log(`[Then] Setting currentStep for butThen:`, this.name);
637
- proxiedPm.currentStep = this;
638
- return this.butThen(
639
- store,
640
- async (s) => {
641
- if (typeof this.thenCB === "function") {
642
- return await this.thenCB(s, proxiedPm);
643
- } else {
644
- return this.thenCB;
645
- }
646
- },
647
- testResourceConfiguration,
648
- butThenProxy(pm, filepath)
649
- ).catch((e) => {
650
- this.error = e.toString();
651
- });
652
- }
653
- };
654
-
655
- // src/lib/classBuilder.ts
656
- var ClassBuilder = class extends BaseBuilder {
657
- constructor(testImplementation, testSpecification, input, suiteKlasser, givenKlasser, whenKlasser, thenKlasser, testResourceRequirement) {
658
- const classySuites = Object.entries(testImplementation.suites).reduce(
659
- (a, [key], index) => {
660
- a[key] = (somestring, givens) => {
661
- return new suiteKlasser.prototype.constructor(
662
- somestring,
663
- index,
664
- givens
665
- );
666
- };
667
- return a;
668
- },
669
- {}
670
- );
671
- const classyGivens = Object.entries(testImplementation.givens).reduce(
672
- (a, [key, g]) => {
673
- a[key] = (features, whens, thens, ...initialValues) => {
674
- return new givenKlasser.prototype.constructor(
675
- key,
676
- features,
677
- whens,
678
- thens,
679
- testImplementation.givens[key],
680
- initialValues
681
- );
682
- };
683
- return a;
684
- },
685
- {}
686
- );
687
- const classyWhens = Object.entries(testImplementation.whens).reduce(
688
- (a, [key, whEn]) => {
689
- a[key] = (...payload) => {
690
- return new whenKlasser.prototype.constructor(
691
- `${whEn.name}: ${payload && payload.toString()}`,
692
- whEn(...payload)
693
- );
694
- };
695
- return a;
696
- },
697
- {}
698
- );
699
- const classyThens = Object.entries(
700
- testImplementation.thens
701
- ).reduce(
702
- (a, [key, thEn]) => {
703
- a[key] = (expected, ...x) => {
704
- return new thenKlasser.prototype.constructor(
705
- `${thEn.name}: ${expected && expected.toString()}`,
706
- thEn(expected, ...x)
707
- );
708
- };
709
- return a;
710
- },
711
- {}
712
- );
713
- super(
714
- input,
715
- classySuites,
716
- classyGivens,
717
- classyWhens,
718
- classyThens,
719
- testResourceRequirement,
720
- testSpecification
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
- BaseGiven,
791
- BaseWhen,
792
- BaseThen,
793
- BaseBuilder,
794
- BaseSuite,
795
- TesterantoCore,
796
- PM
797
- };