testeranto 0.172.0 → 0.173.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 (193) hide show
  1. package/README.md +2 -4
  2. package/dist/common/src/PM/base.js +4 -0
  3. package/dist/common/src/PM/main.js +11 -4
  4. package/dist/common/src/PM/node.js +1 -1
  5. package/dist/common/src/PM/web.js +3 -3
  6. package/dist/common/src/ReportServer.js +2 -126
  7. package/dist/common/src/ReportServer.test.ts/index.js +78 -0
  8. package/dist/common/src/ReportServerLib.js +135 -0
  9. package/dist/common/src/components/pure/ProjectPageView.test/implementation.js +1 -1
  10. package/dist/common/src/lib/abstractBase.js +2 -0
  11. package/dist/common/src/lib/baseBuilder.test/baseBuilder.test.implementation.js +10 -9
  12. package/dist/common/src/lib/baseBuilder.test/baseBuilder.test.specification.js +7 -7
  13. package/dist/common/src/lib/basebuilder.js +8 -2
  14. package/dist/common/src/lib/pmProxy.js +54 -150
  15. package/dist/common/testeranto.config.js +35 -20
  16. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  17. package/dist/module/src/PM/base.js +4 -0
  18. package/dist/module/src/PM/main.js +11 -4
  19. package/dist/module/src/PM/node.js +1 -1
  20. package/dist/module/src/PM/web.js +3 -3
  21. package/dist/module/src/ReportServer.js +2 -123
  22. package/dist/module/src/ReportServer.test.ts/index.js +73 -0
  23. package/dist/module/src/ReportServerLib.js +128 -0
  24. package/dist/module/src/TestPage.js +29 -17
  25. package/dist/module/src/components/pure/ProjectPageView.test/implementation.js +1 -1
  26. package/dist/module/src/components/pure/TestPageView.js +29 -17
  27. package/dist/module/src/lib/abstractBase.js +2 -0
  28. package/dist/module/src/lib/baseBuilder.test/baseBuilder.test.implementation.js +10 -9
  29. package/dist/module/src/lib/baseBuilder.test/baseBuilder.test.specification.js +7 -7
  30. package/dist/module/src/lib/basebuilder.js +8 -2
  31. package/dist/module/src/lib/pmProxy.js +54 -150
  32. package/dist/module/testeranto.config.js +35 -20
  33. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  34. package/dist/prebuild/App.js +3 -3
  35. package/dist/prebuild/ReportServer.mjs +15 -9
  36. package/dist/prebuild/run.mjs +14 -4
  37. package/dist/types/src/PM/node.d.ts +1 -1
  38. package/dist/types/src/PM/web.d.ts +1 -1
  39. package/dist/types/src/ReportServer.test.ts/index.d.ts +29 -0
  40. package/dist/types/src/ReportServerLib.d.ts +2 -0
  41. package/dist/types/src/Types.d.ts +0 -1
  42. package/dist/types/src/components/pure/ProjectPageView.test/index.d.ts +2 -1
  43. package/dist/types/src/lib/abstractBase.d.ts +1 -1
  44. package/dist/types/src/lib/baseBuilder.test/baseBuilder.test.types.d.ts +7 -4
  45. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  46. package/package.json +2 -2
  47. package/src/PM/base.ts +5 -0
  48. package/src/PM/main.ts +12 -4
  49. package/src/PM/node.ts +1 -1
  50. package/src/PM/web.ts +3 -3
  51. package/src/ReportServer.test.ts/index.ts +194 -0
  52. package/src/ReportServer.ts +2 -132
  53. package/src/ReportServerLib.ts +144 -0
  54. package/src/TestPage.tsx +65 -5
  55. package/src/Types.ts +0 -1
  56. package/src/components/pure/ProjectPageView.test/implementation.tsx +1 -1
  57. package/src/components/pure/TestPageView.tsx +65 -5
  58. package/src/lib/abstractBase.ts +4 -1
  59. package/src/lib/baseBuilder.test/baseBuilder.test.implementation.ts +22 -10
  60. package/src/lib/baseBuilder.test/baseBuilder.test.specification.ts +9 -9
  61. package/src/lib/baseBuilder.test/baseBuilder.test.types.ts +7 -4
  62. package/src/lib/basebuilder.ts +7 -4
  63. package/src/lib/pmProxy.ts +78 -155
  64. package/testeranto/App.js +3 -3
  65. package/testeranto/bundles/node/allTests/metafile.json +38 -781
  66. package/testeranto/bundles/node/allTests/src/lib/baseBuilder.test/baseBuilder.test.node.mjs +983 -24
  67. package/testeranto/bundles/node/core/metafile.json +486 -0
  68. package/testeranto/bundles/{pure/allTests/chunk-VMUSFSZM.mjs → node/core/src/lib/baseBuilder.test/baseBuilder.test.node.mjs} +797 -412
  69. package/testeranto/bundles/node/staticSite/metafile.json +593 -0
  70. package/testeranto/bundles/node/staticSite/src/ReportServer.test.ts/index.mjs +1594 -0
  71. package/testeranto/bundles/pure/allTests/metafile.json +122 -550
  72. package/testeranto/bundles/pure/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure.mjs +740 -27
  73. package/testeranto/bundles/pure/core/metafile.json +626 -0
  74. package/testeranto/bundles/{node/allTests/chunk-E75CSRER.mjs → pure/core/src/lib/baseBuilder.test/baseBuilder.test.pure.mjs} +777 -483
  75. package/testeranto/bundles/pure/staticSite/metafile.json +8 -0
  76. package/testeranto/bundles/web/allTests/metafile.json +777 -22
  77. package/testeranto/bundles/web/allTests/src/lib/baseBuilder.test/baseBuilder.test.web.mjs +893 -45
  78. package/testeranto/bundles/web/core/metafile.json +780 -0
  79. package/testeranto/bundles/web/core/src/lib/baseBuilder.test/baseBuilder.test.web.html +19 -0
  80. package/testeranto/bundles/web/{allTests/chunk-U7AW26HL.mjs → core/src/lib/baseBuilder.test/baseBuilder.test.web.mjs} +506 -411
  81. package/testeranto/bundles/web/staticSite/metafile.json +8 -0
  82. package/testeranto/projects.json +2 -1
  83. package/testeranto/reports/allTests/config.json +0 -64
  84. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/lint_errors.txt +2 -0
  85. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/logs.txt +11 -13
  86. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/prompt.txt +10 -0
  87. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/suite-0/given-testInitialization/then-0/butThen/hello.txt +1 -0
  88. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/tests.json +10 -18
  89. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.node/node/type_errors.txt +25 -13
  90. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/lint_errors.txt +2 -0
  91. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/prompt.txt +8 -0
  92. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/type_errors.txt +24 -12
  93. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/lint_errors.txt +2 -0
  94. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/logs.txt +49 -55
  95. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/prompt.txt +12 -2
  96. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/suite-0/given-testInitialization/then-0/butThen/hello.txt +1 -0
  97. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/tests.json +10 -18
  98. package/testeranto/reports/allTests/src/lib/baseBuilder.test/baseBuilder.test.web/web/type_errors.txt +24 -12
  99. package/testeranto/reports/allTests/summary.json +6 -62
  100. package/testeranto/reports/core/config.json +24 -0
  101. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/lint_errors.txt +2 -0
  102. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/logs.txt +32 -0
  103. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/message.txt +2 -0
  104. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/prompt.txt +26 -0
  105. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/suite-0/given-testInitialization/then-0/butThen/hello.txt +1 -0
  106. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/tests.json +69 -0
  107. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.node/node/type_errors.txt +74 -0
  108. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/lint_errors.txt +2 -0
  109. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/message.txt +2 -0
  110. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/prompt.txt +26 -0
  111. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.pure/pure/type_errors.txt +74 -0
  112. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/lint_errors.txt +2 -0
  113. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/logs.txt +61 -0
  114. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/message.txt +2 -0
  115. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/prompt.txt +26 -0
  116. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/suite-0/given-testInitialization/then-0/butThen/hello.txt +1 -0
  117. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/tests.json +69 -0
  118. package/testeranto/reports/core/src/lib/baseBuilder.test/baseBuilder.test.web/web/type_errors.txt +74 -0
  119. package/testeranto/reports/core/summary.json +23 -0
  120. package/testeranto/reports/staticSite/config.json +24 -0
  121. package/testeranto/reports/staticSite/src/ReportServer.test.ts/index/node/lint_errors.txt +5 -0
  122. package/testeranto/reports/staticSite/src/ReportServer.test.ts/index/node/logs.txt +44 -0
  123. package/testeranto/reports/staticSite/src/ReportServer.test.ts/index/node/message.txt +2 -0
  124. package/testeranto/reports/staticSite/src/ReportServer.test.ts/index/node/prompt.txt +23 -0
  125. package/testeranto/reports/{allTests/src/lib/core.test/core.test → staticSite/src/ReportServer.test.ts/index}/node/type_errors.txt +21 -32
  126. package/testeranto/reports/staticSite/summary.json +9 -0
  127. package/testeranto/reportsnode_build_errors +8 -11
  128. package/testeranto.config.ts +37 -20
  129. package/testeranto/bundles/node/allTests/chunk-3EUGBAOM.mjs +0 -113
  130. package/testeranto/bundles/node/allTests/chunk-M6DO7VMB.mjs +0 -252
  131. package/testeranto/bundles/node/allTests/src/lib/BaseSuite.test/node.test.mjs +0 -323
  132. package/testeranto/bundles/node/allTests/src/lib/classBuilder.test/classBuilder.test.mjs +0 -411
  133. package/testeranto/bundles/node/allTests/src/lib/core.test/core.test.mjs +0 -528
  134. package/testeranto/bundles/node/allTests/src/lib/pmProxy.test/index.mjs +0 -4752
  135. package/testeranto/bundles/pure/allTests/chunk-KHDVEHF7.mjs +0 -185
  136. package/testeranto/bundles/pure/allTests/src/Pure.test.mjs +0 -429
  137. package/testeranto/bundles/pure/allTests/src/lib/BaseSuite.test/pure.test.mjs +0 -425
  138. package/testeranto/bundles/web/allTests/chunk-HPYA4YZC.mjs +0 -2283
  139. package/testeranto/bundles/web/allTests/src/components/pure/ProjectPageView.test/index.html +0 -19
  140. package/testeranto/bundles/web/allTests/src/components/pure/ProjectPageView.test/index.mjs +0 -37524
  141. package/testeranto/bundles/web/allTests/src/lib/BaseSuite.test/web.test.html +0 -19
  142. package/testeranto/bundles/web/allTests/src/lib/BaseSuite.test/web.test.mjs +0 -440
  143. package/testeranto/reports/allTests/src/Pure.test/pure/lint_errors.txt +0 -0
  144. package/testeranto/reports/allTests/src/Pure.test/pure/message.txt +0 -2
  145. package/testeranto/reports/allTests/src/Pure.test/pure/prompt.txt +0 -13
  146. package/testeranto/reports/allTests/src/Pure.test/pure/type_errors.txt +0 -101
  147. package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/lint_errors.txt +0 -13
  148. package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/logs.txt +0 -50
  149. package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/message.txt +0 -2
  150. package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/prompt.txt +0 -17
  151. package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/tests.json +0 -32
  152. package/testeranto/reports/allTests/src/components/pure/ProjectPageView.test/index/web/type_errors.txt +0 -68
  153. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/lint_errors.txt +0 -0
  154. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/logs.txt +0 -52
  155. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/message.txt +0 -2
  156. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/prompt.txt +0 -13
  157. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/tests.json +0 -31
  158. package/testeranto/reports/allTests/src/lib/BaseSuite.test/node.test/node/type_errors.txt +0 -111
  159. package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/bdd_errors.txt +0 -1
  160. package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/lint_errors.txt +0 -0
  161. package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/message.txt +0 -2
  162. package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/prompt.txt +0 -14
  163. package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/tests.json +0 -31
  164. package/testeranto/reports/allTests/src/lib/BaseSuite.test/pure.test/pure/type_errors.txt +0 -111
  165. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/bdd_errors.txt +0 -1
  166. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/lint_errors.txt +0 -0
  167. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/logs.txt +0 -108
  168. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/message.txt +0 -2
  169. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/prompt.txt +0 -14
  170. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/tests.json +0 -31
  171. package/testeranto/reports/allTests/src/lib/BaseSuite.test/web.test/web/type_errors.txt +0 -111
  172. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/bdd_errors.txt +0 -1
  173. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/lint_errors.txt +0 -0
  174. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/logs.txt +0 -700
  175. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/message.txt +0 -2
  176. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/prompt.txt +0 -16
  177. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/tests.json +0 -164
  178. package/testeranto/reports/allTests/src/lib/classBuilder.test/classBuilder.test/node/type_errors.txt +0 -138
  179. package/testeranto/reports/allTests/src/lib/core.test/core.test/node/lint_errors.txt +0 -21
  180. package/testeranto/reports/allTests/src/lib/core.test/core.test/node/logs.txt +0 -7
  181. package/testeranto/reports/allTests/src/lib/core.test/core.test/node/message.txt +0 -2
  182. package/testeranto/reports/allTests/src/lib/core.test/core.test/node/prompt.txt +0 -18
  183. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/bdd_errors.txt +0 -1
  184. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/lint_errors.txt +0 -20
  185. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/logs.txt +0 -31
  186. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/message.txt +0 -2
  187. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/prompt.txt +0 -16
  188. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/tests.json +0 -134
  189. package/testeranto/reports/allTests/src/lib/pmProxy.test/index/node/type_errors.txt +0 -76
  190. package/testeranto/reportspure_build_errors +0 -343
  191. package/testeranto/reportsweb_build_errors +0 -25
  192. /package/testeranto/reports/{allTests/src/components/pure/ProjectPageView.test/index/web → core/src/lib/baseBuilder.test/baseBuilder.test.node/node}/bdd_errors.txt +0 -0
  193. /package/testeranto/reports/{allTests/src/lib/BaseSuite.test/node.test/node → core/src/lib/baseBuilder.test/baseBuilder.test.web/web}/bdd_errors.txt +0 -0
@@ -1,5 +1,36 @@
1
1
  import { createRequire } from 'module';const require = createRequire(import.meta.url);
2
2
 
3
+ // src/lib/index.ts
4
+ var BaseAdapter = () => ({
5
+ beforeAll: async (s) => s,
6
+ beforeEach: async function(subject, initialValues, x, testResource, pm) {
7
+ return subject;
8
+ },
9
+ afterEach: async (s) => s,
10
+ afterAll: (store) => void 0,
11
+ butThen: async (store, thenCb) => {
12
+ return thenCb(store);
13
+ },
14
+ andWhen: async (store, whenCB, testResource, pm) => {
15
+ try {
16
+ await whenCB(store, testResource, pm);
17
+ } catch (error) {
18
+ console.error("Error in andWhen:", error);
19
+ throw error;
20
+ }
21
+ },
22
+ assertThis: (x) => x
23
+ });
24
+ var DefaultAdapter = (p) => {
25
+ return {
26
+ ...BaseAdapter,
27
+ ...p
28
+ };
29
+ };
30
+ var defaultTestResourceRequirement = {
31
+ ports: 0
32
+ };
33
+
3
34
  // src/lib/pmProxy.ts
4
35
  var baseProxy = function(pm, mappings) {
5
36
  return new Proxy(pm, {
@@ -20,49 +51,42 @@ var butThenProxy = (pm, filepath) => {
20
51
  [
21
52
  "screencast",
22
53
  (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
- }
54
+ const path2 = `${filepath}/butThen/${opts.path}`;
55
+ pm.currentStep?.artifacts?.push(path2);
30
56
  return [
31
57
  {
32
58
  ...opts,
33
- path
59
+ path: path2
34
60
  },
35
61
  p
36
62
  ];
37
63
  }
38
64
  ],
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");
65
+ [
66
+ "createWriteStream",
67
+ (fp) => {
68
+ const path2 = `${filepath}/butThen/${fp}`;
69
+ pm.currentStep?.artifacts?.push(path2);
70
+ return [path2];
46
71
  }
47
- return [path];
48
- }],
72
+ ],
49
73
  [
50
74
  "writeFileSync",
51
75
  (fp, contents) => {
52
- const path = `${filepath}/butThen/${fp}`;
53
- pm.currentStep?.artifacts?.push(path);
54
- return [path, contents];
76
+ const path2 = `${filepath}/butThen/${fp}`;
77
+ pm.currentStep?.artifacts?.push(path2);
78
+ return [path2, contents];
55
79
  }
56
80
  ],
57
81
  [
58
82
  "customScreenShot",
59
83
  (opts, p) => {
60
- const path = `${filepath}/butThen/${opts.path}`;
61
- pm.currentStep?.artifacts?.push(path);
84
+ const path2 = `${filepath}/butThen/${opts.path}`;
85
+ pm.currentStep?.artifacts?.push(path2);
62
86
  return [
63
87
  {
64
88
  ...opts,
65
- path
89
+ path: path2
66
90
  },
67
91
  p
68
92
  ];
@@ -73,395 +97,119 @@ var butThenProxy = (pm, filepath) => {
73
97
  var andWhenProxy = (pm, filepath) => baseProxy(pm, [
74
98
  [
75
99
  "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
- }
100
+ (opts, p) => [
101
+ {
102
+ ...opts,
103
+ path: `${filepath}/andWhen/${opts.path}`
104
+ },
105
+ p
106
+ ]
87
107
  ],
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
- }],
108
+ ["createWriteStream", (fp) => [`${filepath}/andWhen/${fp}`]],
109
+ ["writeFileSync", (fp, contents) => [`${filepath}/andWhen${fp}`, contents]],
98
110
  [
99
111
  "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
- }
112
+ (opts, p) => [
113
+ {
114
+ ...opts,
115
+ path: `${filepath}/andWhen${opts.path}`
116
+ },
117
+ p
118
+ ]
111
119
  ]
112
120
  ]);
113
121
  var afterEachProxy = (pm, suite, given) => baseProxy(pm, [
114
122
  [
115
123
  "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
- }
124
+ (opts, p) => [
125
+ {
126
+ ...opts,
127
+ path: `suite-${suite}/given-${given}/afterEach/${opts.path}`
128
+ },
129
+ p
130
+ ]
127
131
  ],
128
- ["createWriteStream", (fp) => {
129
- const path = `suite-${suite}/afterEach/${fp}`;
130
- pm.currentStep?.artifacts?.push(path);
131
- return [path];
132
- }],
132
+ ["createWriteStream", (fp) => [`suite-${suite}/afterEach/${fp}`]],
133
133
  [
134
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
- }
135
+ (fp, contents) => [
136
+ `suite-${suite}/given-${given}/afterEach/${fp}`,
137
+ contents
138
+ ]
140
139
  ],
141
140
  [
142
141
  "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
- }
142
+ (opts, p) => [
143
+ {
144
+ ...opts,
145
+ path: `suite-${suite}/given-${given}/afterEach/${opts.path}`
146
+ },
147
+ p
148
+ ]
154
149
  ]
155
150
  ]);
156
151
  var beforeEachProxy = (pm, suite) => baseProxy(pm, [
157
152
  [
158
153
  "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
- }
154
+ (opts, p) => [
155
+ {
156
+ ...opts,
157
+ path: `suite-${suite}/beforeEach/${opts.path}`
158
+ },
159
+ p
160
+ ]
170
161
  ],
171
162
  [
172
163
  "writeFileSync",
173
- (fp, contents) => {
174
- const path = `suite-${suite}/beforeEach/${fp}`;
175
- pm.currentStep?.artifacts?.push(path);
176
- return [path, contents];
177
- }
164
+ (fp, contents) => [`suite-${suite}/beforeEach/${fp}`, contents]
178
165
  ],
179
166
  [
180
167
  "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
- }
168
+ (opts, p) => [
169
+ {
170
+ ...opts,
171
+ path: `suite-${suite}/beforeEach/${opts.path}`
172
+ },
173
+ p
174
+ ]
192
175
  ],
193
- ["createWriteStream", (fp) => {
194
- const path = `suite-${suite}/beforeEach/${fp}`;
195
- pm.currentStep?.artifacts?.push(path);
196
- return [path];
197
- }]
176
+ ["createWriteStream", (fp) => [`suite-${suite}/beforeEach/${fp}`]]
198
177
  ]);
199
178
  var beforeAllProxy = (pm, suite) => baseProxy(pm, [
200
179
  [
201
180
  "writeFileSync",
202
- (fp, contents) => {
203
- const path = `suite-${suite}/beforeAll/${fp}`;
204
- pm.currentStep?.artifacts?.push(path);
205
- return [path, contents];
206
- }
181
+ (fp, contents) => [`suite-${suite}/beforeAll/${fp}`, contents]
207
182
  ],
208
183
  [
209
184
  "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
- }
185
+ (opts, p) => [
186
+ {
187
+ ...opts,
188
+ path: `suite-${suite}/beforeAll/${opts.path}`
189
+ },
190
+ p
191
+ ]
221
192
  ],
222
- ["createWriteStream", (fp) => {
223
- const path = `suite-${suite}/beforeAll/${fp}`;
224
- pm.currentStep?.artifacts?.push(path);
225
- return [path];
226
- }]
193
+ ["createWriteStream", (fp) => [`suite-${suite}/beforeAll/${fp}`]]
227
194
  ]);
228
195
  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
- }],
196
+ ["createWriteStream", (fp) => [`suite-${suite}/afterAll/${fp}`]],
234
197
  [
235
198
  "writeFileSync",
236
- (fp, contents) => {
237
- const path = `suite-${suite}/afterAll/${fp}`;
238
- pm.currentStep?.artifacts?.push(path);
239
- return [path, contents];
240
- }
199
+ (fp, contents) => [`suite-${suite}/afterAll/${fp}`, contents]
241
200
  ],
242
201
  [
243
202
  "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
- }
203
+ (opts, p) => [
204
+ {
205
+ ...opts,
206
+ path: `suite-${suite}/afterAll/${opts.path}`
207
+ },
208
+ p
209
+ ]
255
210
  ]
256
211
  ]);
257
212
 
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
213
  // src/lib/abstractBase.ts
466
214
  var BaseGiven = class {
467
215
  constructor(name, features, whens, thens, givenCB, initialValues) {
@@ -473,9 +221,9 @@ var BaseGiven = class {
473
221
  this.givenCB = givenCB;
474
222
  this.initialValues = initialValues;
475
223
  }
476
- addArtifact(path) {
477
- console.log(`[Artifact] Adding to ${this.constructor.name}:`, path);
478
- this.artifacts.push(path);
224
+ addArtifact(path2) {
225
+ console.log(`[Artifact] Adding to ${this.constructor.name}:`, path2);
226
+ this.artifacts.push(path2);
479
227
  }
480
228
  beforeAll(store) {
481
229
  return store;
@@ -616,39 +364,126 @@ var BaseWhen = class {
616
364
  throw e;
617
365
  }
618
366
  }
619
- };
620
- var BaseThen = class {
621
- constructor(name, thenCB) {
622
- this.artifacts = [];
623
- this.name = name;
624
- this.thenCB = thenCB;
625
- this.error = false;
367
+ };
368
+ var BaseThen = class {
369
+ constructor(name, thenCB) {
370
+ this.artifacts = [];
371
+ this.name = name;
372
+ this.thenCB = thenCB;
373
+ this.error = false;
374
+ }
375
+ toObj() {
376
+ return {
377
+ name: this.name,
378
+ error: this.error,
379
+ artifacts: this.artifacts
380
+ };
381
+ }
382
+ async test(store, testResourceConfiguration, tLog, pm, filepath) {
383
+ const proxiedPm = butThenProxy(pm, filepath);
384
+ console.log(`[Then] Setting currentStep for butThen:`, this.name);
385
+ proxiedPm.currentStep = this;
386
+ return this.butThen(
387
+ store,
388
+ async (s) => {
389
+ if (typeof this.thenCB === "function") {
390
+ return await this.thenCB(s, proxiedPm);
391
+ } else {
392
+ return this.thenCB;
393
+ }
394
+ },
395
+ testResourceConfiguration,
396
+ butThenProxy(pm, filepath)
397
+ ).catch((e) => {
398
+ this.error = e.toString();
399
+ });
400
+ }
401
+ };
402
+
403
+ // src/lib/basebuilder.ts
404
+ var BaseBuilder = class {
405
+ constructor(input, suitesOverrides, givenOverides, whenOverides, thenOverides, testResourceRequirement, testSpecification) {
406
+ this.artifacts = [];
407
+ this.artifacts = [];
408
+ this.testResourceRequirement = testResourceRequirement;
409
+ this.suitesOverrides = suitesOverrides;
410
+ this.givenOverides = givenOverides;
411
+ this.whenOverides = whenOverides;
412
+ this.thenOverides = thenOverides;
413
+ this.testSpecification = testSpecification;
414
+ this.specs = testSpecification(
415
+ this.Suites(),
416
+ this.Given(),
417
+ this.When(),
418
+ this.Then()
419
+ );
420
+ this.testJobs = this.specs.map((suite) => {
421
+ const suiteRunner = (suite2) => async (puppetMaster, tLog) => {
422
+ const x = await suite2.run(
423
+ input,
424
+ puppetMaster.testResourceConfiguration,
425
+ (fPath, value) => puppetMaster.testArtiFactoryfileWriter(
426
+ tLog,
427
+ (p) => {
428
+ this.artifacts.push(p);
429
+ }
430
+ )(puppetMaster.testResourceConfiguration.fs + "/" + fPath, value),
431
+ tLog,
432
+ puppetMaster
433
+ );
434
+ return x;
435
+ };
436
+ const runner = suiteRunner(suite);
437
+ return {
438
+ test: suite,
439
+ toObj: () => {
440
+ return suite.toObj();
441
+ },
442
+ runner,
443
+ receiveTestResourceConfig: async function(puppetMaster) {
444
+ const tLog = async (...l) => {
445
+ };
446
+ const suiteDone = await runner(puppetMaster, tLog);
447
+ const fails = suiteDone.fails;
448
+ await puppetMaster.writeFileSync([
449
+ `bdd_errors.txt`,
450
+ fails.toString()
451
+ ]);
452
+ await puppetMaster.writeFileSync([
453
+ `tests.json`,
454
+ JSON.stringify(this.toObj(), null, 2)
455
+ ]);
456
+ return {
457
+ failed: fails > 0,
458
+ fails,
459
+ artifacts: this.artifacts || [],
460
+ // logPromise,
461
+ features: suiteDone.features()
462
+ };
463
+ }
464
+ };
465
+ });
466
+ }
467
+ // testsJson() {
468
+ // puppetMaster.writeFileSync(
469
+ // `tests.json`,
470
+ // JSON.stringify({ features: suiteDone.features() }, null, 2)
471
+ // );
472
+ // }
473
+ Specs() {
474
+ return this.specs;
475
+ }
476
+ Suites() {
477
+ return this.suitesOverrides;
626
478
  }
627
- toObj() {
628
- return {
629
- name: this.name,
630
- error: this.error,
631
- artifacts: this.artifacts
632
- };
479
+ Given() {
480
+ return this.givenOverides;
633
481
  }
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
- });
482
+ When() {
483
+ return this.whenOverides;
484
+ }
485
+ Then() {
486
+ return this.thenOverides;
652
487
  }
653
488
  };
654
489
 
@@ -722,10 +557,102 @@ var ClassBuilder = class extends BaseBuilder {
722
557
  }
723
558
  };
724
559
 
560
+ // src/lib/BaseSuite.ts
561
+ var BaseSuite = class {
562
+ constructor(name, index, givens = {}) {
563
+ const suiteName = name || "testSuite";
564
+ if (!suiteName) {
565
+ throw new Error("BaseSuite requires a non-empty name");
566
+ }
567
+ console.log(
568
+ "[DEBUG] BaseSuite constructor - name:",
569
+ suiteName,
570
+ "index:",
571
+ index
572
+ );
573
+ this.name = suiteName;
574
+ this.index = index;
575
+ this.givens = givens;
576
+ this.fails = 0;
577
+ console.log("[DEBUG] BaseSuite initialized:", this.name, this.index);
578
+ console.log("[DEBUG] BaseSuite givens:", Object.keys(givens).toString());
579
+ }
580
+ features() {
581
+ try {
582
+ const features = Object.keys(this.givens).map((k) => this.givens[k].features).flat().filter((value, index, array) => {
583
+ return array.indexOf(value) === index;
584
+ });
585
+ console.debug("[DEBUG] Features extracted:", features.toString());
586
+ return features || [];
587
+ } catch (e) {
588
+ console.error("[ERROR] Failed to extract features:", e);
589
+ return [];
590
+ }
591
+ }
592
+ toObj() {
593
+ const givens = Object.keys(this.givens).map((k) => this.givens[k].toObj());
594
+ return {
595
+ name: this.name,
596
+ givens,
597
+ fails: this.fails,
598
+ failed: this.failed,
599
+ features: this.features()
600
+ };
601
+ }
602
+ setup(s, artifactory, tr, pm) {
603
+ return new Promise((res) => res(s));
604
+ }
605
+ assertThat(t) {
606
+ return !!t;
607
+ }
608
+ afterAll(store, artifactory, pm) {
609
+ return store;
610
+ }
611
+ async run(input, testResourceConfiguration, artifactory, tLog, pm) {
612
+ this.testResourceConfiguration = testResourceConfiguration;
613
+ const suiteArtifactory = (fPath, value) => artifactory(`suite-${this.index}-${this.name}/${fPath}`, value);
614
+ tLog("\nSuite:", this.index, this.name);
615
+ const sNdx = this.index;
616
+ const subject = await this.setup(
617
+ input,
618
+ suiteArtifactory,
619
+ testResourceConfiguration,
620
+ beforeAllProxy(pm, sNdx.toString())
621
+ );
622
+ for (const [gKey, g] of Object.entries(this.givens)) {
623
+ const giver = this.givens[gKey];
624
+ this.store = await giver.give(
625
+ subject,
626
+ gKey,
627
+ testResourceConfiguration,
628
+ this.assertThat,
629
+ suiteArtifactory,
630
+ tLog,
631
+ pm,
632
+ sNdx
633
+ ).catch((e) => {
634
+ this.failed = true;
635
+ this.fails = this.fails + 1;
636
+ throw e;
637
+ });
638
+ }
639
+ try {
640
+ this.afterAll(
641
+ this.store,
642
+ artifactory,
643
+ afterAllProxy(pm, sNdx.toString())
644
+ );
645
+ } catch (e) {
646
+ console.error(e);
647
+ }
648
+ return this;
649
+ }
650
+ };
651
+
725
652
  // src/lib/core.ts
726
653
  var TesterantoCore = class extends ClassBuilder {
727
- constructor(input, testSpecification, testImplementation, testResourceRequirement = defaultTestResourceRequirement, testAdapter, uberCatcher) {
728
- const fullAdapter = DefaultAdapter(testAdapter);
654
+ constructor(input, testSpecification, testImplementation, testResourceRequirement = defaultTestResourceRequirement, testAdapter2, uberCatcher) {
655
+ const fullAdapter = DefaultAdapter(testAdapter2);
729
656
  super(
730
657
  testImplementation,
731
658
  testSpecification,
@@ -781,17 +708,475 @@ var TesterantoCore = class extends ClassBuilder {
781
708
  }
782
709
  };
783
710
 
711
+ // src/PM/node.ts
712
+ import net from "net";
713
+ import fs from "fs";
714
+ import path from "path";
715
+
784
716
  // src/PM/index.ts
785
717
  var PM = class {
786
718
  };
787
719
 
720
+ // src/PM/node.ts
721
+ var fPaths = [];
722
+ var PM_Node = class extends PM {
723
+ constructor(t, ipcFile) {
724
+ super();
725
+ this.testResourceConfiguration = t;
726
+ this.client = net.createConnection(ipcFile, () => {
727
+ return;
728
+ });
729
+ }
730
+ start() {
731
+ throw new Error("DEPRECATED");
732
+ }
733
+ stop() {
734
+ throw new Error("stop not implemented.");
735
+ }
736
+ send(command, ...argz) {
737
+ const key = Math.random().toString();
738
+ if (!this.client) {
739
+ console.error(
740
+ `Tried to send "${command} (${argz})" but the test has not been started and the IPC client is not established. Exiting as failure!`
741
+ );
742
+ process.exit(-1);
743
+ }
744
+ return new Promise((res) => {
745
+ const myListener = (event) => {
746
+ const x = JSON.parse(event);
747
+ if (x.key === key) {
748
+ process.removeListener("message", myListener);
749
+ res(x.payload);
750
+ }
751
+ };
752
+ process.addListener("message", myListener);
753
+ this.client.write(JSON.stringify([command, ...argz, key]));
754
+ });
755
+ }
756
+ async launchSideCar(n) {
757
+ return this.send(
758
+ "launchSideCar",
759
+ n,
760
+ this.testResourceConfiguration.name
761
+ );
762
+ }
763
+ stopSideCar(n) {
764
+ return this.send(
765
+ "stopSideCar",
766
+ n,
767
+ this.testResourceConfiguration.name
768
+ );
769
+ }
770
+ async pages() {
771
+ return this.send("pages", ...arguments);
772
+ }
773
+ waitForSelector(p, s) {
774
+ return this.send("waitForSelector", ...arguments);
775
+ }
776
+ closePage(p) {
777
+ return this.send("closePage", ...arguments);
778
+ }
779
+ goto(page, url) {
780
+ return this.send("goto", ...arguments);
781
+ }
782
+ async newPage() {
783
+ return this.send("newPage");
784
+ }
785
+ $(selector, page) {
786
+ return this.send("$", ...arguments);
787
+ }
788
+ isDisabled(selector) {
789
+ return this.send("isDisabled", ...arguments);
790
+ }
791
+ getAttribute(selector, attribute, p) {
792
+ return this.send("getAttribute", ...arguments);
793
+ }
794
+ getInnerHtml(selector, p) {
795
+ return this.send("getInnerHtml", ...arguments);
796
+ }
797
+ // setValue(selector: string) {
798
+ // return this.send("getValue", ...arguments);
799
+ // }
800
+ focusOn(selector) {
801
+ return this.send("focusOn", ...arguments);
802
+ }
803
+ typeInto(selector) {
804
+ return this.send("typeInto", ...arguments);
805
+ }
806
+ page() {
807
+ return this.send("page");
808
+ }
809
+ click(selector) {
810
+ return this.send("click", ...arguments);
811
+ }
812
+ screencast(opts, page) {
813
+ return this.send(
814
+ "screencast",
815
+ {
816
+ ...opts,
817
+ path: this.testResourceConfiguration.fs + "/" + opts.path
818
+ },
819
+ page,
820
+ this.testResourceConfiguration.name
821
+ );
822
+ }
823
+ screencastStop(p) {
824
+ return this.send("screencastStop", ...arguments);
825
+ }
826
+ customScreenShot(x, y) {
827
+ const opts = x[0];
828
+ const page = x[1];
829
+ return this.send(
830
+ "customScreenShot",
831
+ {
832
+ ...opts,
833
+ path: this.testResourceConfiguration.fs + "/" + opts.path
834
+ },
835
+ this.testResourceConfiguration.name,
836
+ page
837
+ );
838
+ }
839
+ async existsSync(destFolder) {
840
+ return await this.send(
841
+ "existsSync",
842
+ this.testResourceConfiguration.fs + "/" + destFolder
843
+ );
844
+ }
845
+ mkdirSync() {
846
+ return this.send("mkdirSync", this.testResourceConfiguration.fs + "/");
847
+ }
848
+ async write(uid, contents) {
849
+ return await this.send("write", ...arguments);
850
+ }
851
+ async writeFileSync([filepath, contents]) {
852
+ return await this.send(
853
+ "writeFileSync",
854
+ this.testResourceConfiguration.fs + "/" + filepath,
855
+ contents,
856
+ this.testResourceConfiguration.name
857
+ );
858
+ }
859
+ async createWriteStream(filepath) {
860
+ return await this.send(
861
+ "createWriteStream",
862
+ this.testResourceConfiguration.fs + "/" + filepath,
863
+ this.testResourceConfiguration.name
864
+ );
865
+ }
866
+ async end(uid) {
867
+ return await this.send("end", ...arguments);
868
+ }
869
+ async customclose() {
870
+ return await this.send(
871
+ "customclose",
872
+ this.testResourceConfiguration.fs,
873
+ this.testResourceConfiguration.name
874
+ );
875
+ }
876
+ testArtiFactoryfileWriter(tLog, callback) {
877
+ return (fPath, value) => {
878
+ callback(
879
+ new Promise((res, rej) => {
880
+ tLog("testArtiFactory =>", fPath);
881
+ const cleanPath = path.resolve(fPath);
882
+ fPaths.push(cleanPath.replace(process.cwd(), ``));
883
+ const targetDir = cleanPath.split("/").slice(0, -1).join("/");
884
+ fs.mkdir(targetDir, { recursive: true }, async (error) => {
885
+ if (error) {
886
+ console.error(`\u2757\uFE0FtestArtiFactory failed`, targetDir, error);
887
+ }
888
+ if (Buffer.isBuffer(value)) {
889
+ fs.writeFileSync(fPath, value, "binary");
890
+ res();
891
+ } else if (`string` === typeof value) {
892
+ fs.writeFileSync(fPath, value.toString(), {
893
+ encoding: "utf-8"
894
+ });
895
+ res();
896
+ } else {
897
+ const pipeStream = value;
898
+ const myFile = fs.createWriteStream(fPath);
899
+ pipeStream.pipe(myFile);
900
+ pipeStream.on("close", () => {
901
+ myFile.close();
902
+ res();
903
+ });
904
+ }
905
+ });
906
+ })
907
+ );
908
+ };
909
+ }
910
+ // launch(options?: PuppeteerLaunchOptions): Promise<Browser>;
911
+ startPuppeteer(options) {
912
+ }
913
+ };
914
+
915
+ // src/Node.ts
916
+ var ipcfile;
917
+ var NodeTesteranto = class extends TesterantoCore {
918
+ constructor(input, testSpecification, testImplementation, testResourceRequirement, testAdapter2) {
919
+ super(
920
+ input,
921
+ testSpecification,
922
+ testImplementation,
923
+ testResourceRequirement,
924
+ testAdapter2,
925
+ () => {
926
+ }
927
+ );
928
+ }
929
+ async receiveTestResourceConfig(partialTestResource) {
930
+ console.log("receiveTestResourceConfig", partialTestResource);
931
+ const t = JSON.parse(partialTestResource);
932
+ const pm = new PM_Node(t, ipcfile);
933
+ return await this.testJobs[0].receiveTestResourceConfig(pm);
934
+ }
935
+ };
936
+ var testeranto = async (input, testSpecification, testImplementation, testAdapter2, testResourceRequirement = defaultTestResourceRequirement) => {
937
+ try {
938
+ const t = new NodeTesteranto(
939
+ input,
940
+ testSpecification,
941
+ testImplementation,
942
+ testResourceRequirement,
943
+ testAdapter2
944
+ );
945
+ process.on("unhandledRejection", (reason, promise) => {
946
+ console.error("Unhandled Rejection at:", promise, "reason:", reason);
947
+ });
948
+ ipcfile = process.argv[3];
949
+ const f = await t.receiveTestResourceConfig(process.argv[2]);
950
+ console.error("goodbye node with failures", f.fails);
951
+ process.exit(f.fails);
952
+ } catch (e) {
953
+ console.error("goodbye node with caught error", e);
954
+ process.exit(-1);
955
+ }
956
+ };
957
+ var Node_default = testeranto;
958
+
959
+ // src/lib/baseBuilder.test/baseBuilder.test.specification.ts
960
+ var specification = (Suite, Given, When, Then) => {
961
+ return [
962
+ Suite.Default("Testing BaseBuilder functionality", {
963
+ testInitialization: Given["the default BaseBuilder"](
964
+ ["BaseBuilder should initialize correctly"],
965
+ [],
966
+ [
967
+ Then["it is initialized"](),
968
+ Then["it tracks artifacts"]()
969
+ // Then["it creates jobs"](),
970
+ // Then["it generates TestSpecifications"](),
971
+ ]
972
+ ),
973
+ testSpecsGeneration: Given["the default BaseBuilder"](
974
+ ["BaseBuilder should generate specs from test specification"],
975
+ [],
976
+ [Then["it generates TestSpecifications"]()]
977
+ ),
978
+ testJobsCreation: Given["the default BaseBuilder"](
979
+ ["BaseBuilder should create test jobs"],
980
+ [],
981
+ [Then["it creates jobs"]()]
982
+ )
983
+ })
984
+ ];
985
+ };
986
+
987
+ // src/lib/baseBuilder.test/baseBuilder.test.mock.ts
988
+ var MockBaseBuilder = class extends BaseBuilder {
989
+ constructor(input, suitesOverrides = {}, givenOverrides = {}, whenOverrides = {}, thenOverrides = {}, testResourceRequirement = { ports: 0 }, testSpecification = () => []) {
990
+ super(
991
+ input,
992
+ suitesOverrides,
993
+ givenOverrides,
994
+ whenOverrides,
995
+ thenOverrides,
996
+ testResourceRequirement,
997
+ testSpecification
998
+ );
999
+ this.summary = {};
1000
+ }
1001
+ /**
1002
+ * Simplified version for testing that doesn't actually run tests
1003
+ */
1004
+ testRun(puppetMaster) {
1005
+ this.summary = {
1006
+ [puppetMaster.testResourceConfiguration.name]: {
1007
+ typeErrors: 0,
1008
+ staticErrors: 0,
1009
+ runTimeError: "",
1010
+ prompt: "",
1011
+ failingFeatures: {}
1012
+ }
1013
+ };
1014
+ return Promise.resolve({
1015
+ failed: false,
1016
+ fails: 0,
1017
+ artifacts: [],
1018
+ // logPromise: Promise.resolve(),
1019
+ features: []
1020
+ });
1021
+ }
1022
+ };
1023
+
1024
+ // src/lib/baseBuilder.test/baseBuilder.test.implementation.ts
1025
+ var implementation = {
1026
+ suites: {
1027
+ Default: "BaseBuilder test suite"
1028
+ },
1029
+ givens: {
1030
+ "the default BaseBuilder": () => {
1031
+ return new MockBaseBuilder(
1032
+ {},
1033
+ // input
1034
+ {},
1035
+ // suitesOverrides
1036
+ {},
1037
+ // givenOverrides
1038
+ {},
1039
+ // whenOverrides
1040
+ {},
1041
+ // thenOverrides
1042
+ { ports: 0 },
1043
+ // testResourceRequirement
1044
+ () => []
1045
+ // testSpecification
1046
+ );
1047
+ },
1048
+ "a BaseBuilder with TestInput": (input) => {
1049
+ return new MockBaseBuilder(
1050
+ input,
1051
+ {},
1052
+ {},
1053
+ {},
1054
+ {},
1055
+ { ports: [] },
1056
+ () => []
1057
+ );
1058
+ },
1059
+ "a BaseBuilder with Test Resource Requirements": (requirements) => {
1060
+ return new MockBaseBuilder({}, {}, {}, {}, {}, requirements, () => []);
1061
+ }
1062
+ },
1063
+ whens: {
1064
+ addArtifact: (artifact) => (builder) => {
1065
+ builder.artifacts.push(artifact);
1066
+ return builder;
1067
+ },
1068
+ setTestJobs: (jobs) => (builder) => {
1069
+ builder.testJobs = jobs;
1070
+ return builder;
1071
+ }
1072
+ },
1073
+ thens: {
1074
+ "it is initialized": () => (builder, utils) => {
1075
+ utils.writeFileSync("hello.txt", "world");
1076
+ if (!(builder instanceof BaseBuilder)) {
1077
+ console.error("Builder instance:", builder);
1078
+ throw new Error(
1079
+ `Builder was not properly initialized - expected BaseBuilder instance but got ${builder?.constructor?.name}`
1080
+ );
1081
+ }
1082
+ [
1083
+ "artifacts",
1084
+ "testJobs",
1085
+ "specs",
1086
+ "suitesOverrides",
1087
+ "givenOverides",
1088
+ "whenOverides",
1089
+ "thenOverides"
1090
+ ].forEach((prop) => {
1091
+ if (!(prop in builder)) {
1092
+ throw new Error(`Builder missing required property: ${prop}`);
1093
+ }
1094
+ });
1095
+ return builder;
1096
+ },
1097
+ "it generates TestSpecifications": () => (builder) => {
1098
+ if (!Array.isArray(builder.specs)) {
1099
+ throw new Error("Specs were not generated");
1100
+ }
1101
+ return builder;
1102
+ },
1103
+ "it creates jobs": () => (builder) => {
1104
+ if (!Array.isArray(builder.testJobs)) {
1105
+ throw new Error("Test jobs were not created");
1106
+ }
1107
+ return builder;
1108
+ },
1109
+ "it tracks artifacts": () => (builder) => {
1110
+ if (!Array.isArray(builder.artifacts)) {
1111
+ throw new Error("Artifacts array not initialized");
1112
+ }
1113
+ return builder;
1114
+ },
1115
+ resourceRequirementsSet: () => (builder) => {
1116
+ if (!builder.testResourceRequirement) {
1117
+ throw new Error("Resource requirements not set");
1118
+ }
1119
+ return builder;
1120
+ },
1121
+ suitesOverridesConfigured: () => (builder) => {
1122
+ if (!builder.suitesOverrides) {
1123
+ throw new Error("Suites overrides not configured");
1124
+ }
1125
+ return builder;
1126
+ },
1127
+ givensOverridesConfigured: () => (builder) => {
1128
+ if (!builder.givenOverides) {
1129
+ throw new Error("Givens overrides not configured");
1130
+ }
1131
+ return builder;
1132
+ },
1133
+ whensOverridesConfigured: () => (builder) => {
1134
+ if (!builder.whenOverides) {
1135
+ throw new Error("Whens overrides not configured");
1136
+ }
1137
+ return builder;
1138
+ },
1139
+ thensOverridesConfigured: () => (builder) => {
1140
+ if (!builder.thenOverides) {
1141
+ throw new Error("Thens overrides not configured");
1142
+ }
1143
+ return builder;
1144
+ }
1145
+ }
1146
+ };
1147
+
1148
+ // src/lib/baseBuilder.test/baseBuilder.test.adapter.ts
1149
+ var testAdapter = {
1150
+ beforeAll: async (input, testResource, pm) => input,
1151
+ beforeEach: async (subject, initializer, testResource, initialValues, pm) => {
1152
+ console.log("Initializing test with:", {
1153
+ subject,
1154
+ initializer,
1155
+ initialValues
1156
+ });
1157
+ const result = initializer();
1158
+ console.log("Initialization result:", result.toString());
1159
+ return result;
1160
+ },
1161
+ andWhen: async (store, whenCB, testResource, utils) => {
1162
+ return whenCB(store, utils);
1163
+ },
1164
+ butThen: async (store, thenCB, testResource, pm) => {
1165
+ return thenCB(store, pm);
1166
+ },
1167
+ afterEach: (store) => store,
1168
+ afterAll: () => {
1169
+ },
1170
+ assertThis: (x) => x
1171
+ };
1172
+
1173
+ // src/lib/baseBuilder.test/baseBuilder.test.node.ts
1174
+ var baseBuilder_test_node_default = Node_default(
1175
+ MockBaseBuilder.prototype,
1176
+ specification,
1177
+ implementation,
1178
+ testAdapter
1179
+ );
788
1180
  export {
789
- defaultTestResourceRequirement,
790
- BaseGiven,
791
- BaseWhen,
792
- BaseThen,
793
- BaseBuilder,
794
- BaseSuite,
795
- TesterantoCore,
796
- PM
1181
+ baseBuilder_test_node_default as default
797
1182
  };