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