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
@@ -112,7 +112,11 @@ export class PM_Base {
112
112
  }
113
113
  return false;
114
114
  }
115
- async writeFileSync(filepath, contents, testName) {
115
+ async writeFileSync(...x) {
116
+ const filepath = x[0];
117
+ const contents = x[1];
118
+ const testName = x[2];
119
+ console.log("writing file", filepath);
116
120
  return new Promise(async (res) => {
117
121
  fs.mkdirSync(path.dirname(filepath), {
118
122
  recursive: true,
@@ -3,6 +3,7 @@
3
3
  /* eslint-disable @typescript-eslint/no-explicit-any */
4
4
  /* eslint-disable @typescript-eslint/no-unused-vars */
5
5
  import { spawn } from "node:child_process";
6
+ import ansiColors from "ansi-colors";
6
7
  import net from "net";
7
8
  import fs, { watch } from "fs";
8
9
  import path from "path";
@@ -12,7 +13,6 @@ import crypto from "node:crypto";
12
13
  import { getRunnables } from "../utils";
13
14
  import { Queue } from "../utils/queue.js";
14
15
  import { PM_WithEslintAndTsc } from "./PM_WithEslintAndTsc.js";
15
- import ansiColors from "ansi-colors";
16
16
  const changes = {};
17
17
  const fileHashes = {};
18
18
  const files = {};
@@ -281,7 +281,12 @@ export class PM_Main extends PM_WithEslintAndTsc {
281
281
  const ipcfile = "/tmp/tpipe_" + Math.random();
282
282
  const child = spawn("node",
283
283
  // "node",
284
- ["--inspect-brk", builtfile, testResources, ipcfile], {
284
+ [
285
+ // "--inspect-brk",
286
+ builtfile,
287
+ testResources,
288
+ ipcfile,
289
+ ], {
285
290
  stdio: ["pipe", "pipe", "pipe", "ipc"],
286
291
  });
287
292
  let buffer = new Buffer("");
@@ -687,16 +692,6 @@ export class PM_Main extends PM_WithEslintAndTsc {
687
692
  browserWSEndpoint: this.browser.wsEndpoint(),
688
693
  });
689
694
  const d = `${dest}?cacheBust=${Date.now()}`;
690
- const evaluation = `
691
-
692
- import('${d}').then(async (x) => {
693
-
694
- try {
695
- return await (await x.default).receiveTestResourceConfig(${webArgz})
696
- } catch (e) {
697
- console.log("web run failure", e.toString())
698
- }
699
- })`;
700
695
  const ofile = `${reportDest}/logs.txt`;
701
696
  const oStream = fs.createWriteStream(ofile);
702
697
  this.browser
@@ -735,7 +730,6 @@ export class PM_Main extends PM_WithEslintAndTsc {
735
730
  page.close();
736
731
  oStream.close();
737
732
  });
738
- console.log("ostream is closed");
739
733
  return;
740
734
  };
741
735
  page.on("pageerror", (err) => {
@@ -758,7 +752,7 @@ export class PM_Main extends PM_WithEslintAndTsc {
758
752
  close();
759
753
  });
760
754
  page.on("console", (log) => {
761
- console.log("console message: ", log.text());
755
+ // console.log("console message: ", log.text());
762
756
  if (oStream.closed) {
763
757
  console.log("missed console message: ", log.text());
764
758
  return;
@@ -774,19 +768,28 @@ export class PM_Main extends PM_WithEslintAndTsc {
774
768
  });
775
769
  await page.goto(`file://${`${destFolder}.html`}`, {});
776
770
  await page
777
- .evaluate(evaluation)
771
+ .evaluate(`
772
+ import('${d}').then(async (x) => {
773
+ try {
774
+ return await (await x.default).receiveTestResourceConfig(${webArgz})
775
+ } catch (e) {
776
+ console.log("web run failure", e.toString())
777
+ }
778
+ })
779
+ `)
778
780
  .then(async ({ fails, failed, features }) => {
779
781
  statusMessagePretty(fails, src, "web");
780
782
  this.bddTestIsNowDone(src, fails);
781
- close();
783
+ // close();
782
784
  })
783
785
  .catch((e) => {
784
- console.log(ansiC.red(ansiC.inverse(e)));
786
+ console.log(ansiC.red(ansiC.inverse(e.stack)));
785
787
  console.log(ansiC.red(ansiC.inverse(`web ! ${src} failed to execute. No "tests.json" file was generated. Check ${reportDest}/logs.txt for more info`)));
786
788
  this.bddTestIsNowDone(src, -1);
787
789
  })
788
790
  .finally(() => {
789
791
  // process.exit(-1);
792
+ close();
790
793
  });
791
794
  return page;
792
795
  });
@@ -995,9 +998,9 @@ export class PM_Main extends PM_WithEslintAndTsc {
995
998
  slowMo: 1,
996
999
  waitForInitialPage: false,
997
1000
  executablePath,
998
- headless: false,
1001
+ headless: true,
999
1002
  dumpio: false,
1000
- devtools: true,
1003
+ devtools: false,
1001
1004
  args: [
1002
1005
  "--disable-features=site-per-process",
1003
1006
  "--allow-file-access-from-files",
@@ -108,7 +108,10 @@ export class PM_Node extends PM {
108
108
  async write(uid, contents) {
109
109
  return await this.send("write", ...arguments);
110
110
  }
111
- async writeFileSync(filepath, contents) {
111
+ async writeFileSync(x) {
112
+ const z = arguments["0"];
113
+ const filepath = z[0];
114
+ const contents = z[1];
112
115
  return await this.send("writeFileSync", this.testResourceConfiguration.fs + "/" + filepath, contents, this.testResourceConfiguration.name);
113
116
  }
114
117
  async createWriteStream(filepath) {
@@ -82,7 +82,10 @@ export class PM_Pure extends PM {
82
82
  write(uid, contents) {
83
83
  return globalThis["write"](uid, contents);
84
84
  }
85
- writeFileSync(filepath, contents) {
85
+ writeFileSync(x) {
86
+ const z = arguments["0"];
87
+ const filepath = z[0];
88
+ const contents = z[1];
86
89
  return globalThis["writeFileSync"](this.testResourceConfiguration.fs + "/" + filepath, contents, this.testResourceConfiguration.name);
87
90
  }
88
91
  createWriteStream(filepath) {
@@ -67,8 +67,8 @@ export class PM_Web extends PM {
67
67
  customScreenShot(x, y) {
68
68
  const opts = x[0];
69
69
  const page = x[1];
70
- console.log("customScreenShot 2 opts", opts);
71
- console.log("customScreenShot 2 page", page);
70
+ // console.log("customScreenShot 2 opts", opts);
71
+ // console.log("customScreenShot 2 page", page);
72
72
  return window["customScreenShot"](Object.assign(Object.assign({}, opts), { path: this.testResourceConfiguration.fs + "/" + opts.path }), this.testResourceConfiguration.name, page);
73
73
  }
74
74
  existsSync(destFolder) {
@@ -80,7 +80,10 @@ export class PM_Web extends PM {
80
80
  write(uid, contents) {
81
81
  return window["write"](uid, contents);
82
82
  }
83
- writeFileSync(filepath, contents) {
83
+ writeFileSync(x) {
84
+ const z = arguments["0"];
85
+ const filepath = z[0];
86
+ const contents = z[1];
84
87
  return window["writeFileSync"](this.testResourceConfiguration.fs + "/" + filepath, contents, this.testResourceConfiguration.name);
85
88
  }
86
89
  createWriteStream(filepath) {
@@ -8,10 +8,8 @@ export class PureTesteranto extends Testeranto {
8
8
  });
9
9
  }
10
10
  async receiveTestResourceConfig(partialTestResource) {
11
- console.log("[DEBUG] receiveTestResourceConfig called with:", partialTestResource);
12
11
  const t = JSON.parse(partialTestResource);
13
12
  const pm = new PM_Pure(t);
14
- // console.log("[DEBUG] Current test jobs:", this.testJobs?.length);
15
13
  // if (!this.testJobs || this.testJobs.length === 0) {
16
14
  // console.error(
17
15
  // "[ERROR] No test jobs available - checking specs:",
@@ -27,9 +25,7 @@ export class PureTesteranto extends Testeranto {
27
25
  // };
28
26
  // }
29
27
  try {
30
- console.log("[DEBUG] Executing test job with PM:", pm);
31
28
  const result = await this.testJobs[0].receiveTestResourceConfig(pm);
32
- console.log("[DEBUG] Test job completed with result:", result);
33
29
  return result;
34
30
  }
35
31
  catch (e) {
@@ -48,7 +48,7 @@ const implementation = {
48
48
  modifySpecs: (modifier) => (store) => {
49
49
  console.debug("[DEBUG] Modifying specs");
50
50
  return Object.assign(Object.assign({}, store), { specs: modifier(store.specs || []) });
51
- }
51
+ },
52
52
  },
53
53
  thens: {
54
54
  initializedProperly: () => (store) => {
@@ -1,124 +1,3 @@
1
1
  // simple http server to preview reports
2
- import staticServer from "node-static";
3
- import http from "http";
4
- import path from "path";
5
- import fs from "fs";
6
- const fileServer = new staticServer.Server("./", {
7
- cache: false,
8
- headers: {
9
- "Cache-Control": "no-cache, no-store, must-revalidate",
10
- "Pragma": "no-cache",
11
- "Expires": "0"
12
- }
13
- });
14
- const server = http.createServer((req, res) => {
15
- // Handle potential double responses
16
- let responded = false;
17
- const safeResponse = (handler) => {
18
- if (responded)
19
- return;
20
- responded = true;
21
- try {
22
- handler();
23
- }
24
- catch (err) {
25
- console.error('Error handling request:', err);
26
- if (!res.headersSent) {
27
- res.writeHead(500);
28
- }
29
- res.end('Internal Server Error');
30
- }
31
- };
32
- req.on('error', (err) => {
33
- console.error('Request error:', err);
34
- safeResponse(() => {
35
- if (!res.headersSent) {
36
- res.writeHead(400);
37
- }
38
- res.end('Bad Request');
39
- });
40
- });
41
- req.on('end', () => {
42
- safeResponse(() => {
43
- const filePath = path.join(process.cwd(), req.url || '');
44
- // First check if file exists
45
- fs.stat(filePath, (err, stats) => {
46
- if (err || !stats.isFile()) {
47
- // Check if directory exists
48
- fs.stat(filePath, (dirErr, dirStats) => {
49
- if (!dirErr && dirStats.isDirectory()) {
50
- // Serve directory listing
51
- fs.readdir(filePath, (readErr, files) => {
52
- if (readErr) {
53
- res.writeHead(500);
54
- return res.end('Error reading directory');
55
- }
56
- res.writeHead(200, { 'Content-Type': 'text/html' });
57
- res.write(`
58
- <html>
59
- <head>
60
- <title>Directory Listing: ${req.url}</title>
61
- <style>
62
- body { font-family: sans-serif; margin: 2rem; }
63
- h1 { color: #333; }
64
- ul { list-style: none; padding: 0; }
65
- li { padding: 0.5rem; }
66
- li a { color: #0366d6; text-decoration: none; }
67
- li a:hover { text-decoration: underline; }
68
- </style>
69
- </head>
70
- <body>
71
- <h1>Directory: ${req.url}</h1>
72
- <ul>
73
- ${files.map(file => `
74
- <li>
75
- <a href="${path.join(req.url || '', file)}">
76
- ${file}${file.endsWith('/') ? '/' : ''}
77
- </a>
78
- </li>
79
- `).join('')}
80
- </ul>
81
- </body>
82
- </html>
83
- `);
84
- res.end();
85
- });
86
- }
87
- else {
88
- // Neither file nor directory exists - send 404
89
- if (!res.headersSent) {
90
- res.writeHead(404, { 'Content-Type': 'text/plain' });
91
- res.end('File not found');
92
- }
93
- }
94
- });
95
- return;
96
- }
97
- // File exists - serve it through node-static
98
- const serve = () => {
99
- fileServer.serve(req, res, (err) => {
100
- if (err && !res.headersSent) {
101
- res.writeHead(err.status || 500);
102
- res.end(err.message);
103
- }
104
- });
105
- };
106
- // Ensure we don't double-serve
107
- if (!res.headersSent) {
108
- serve();
109
- }
110
- });
111
- });
112
- });
113
- req.resume();
114
- });
115
- server.listen(8080, () => {
116
- console.log('Server running on http://localhost:8080');
117
- console.log('Serving files from:', process.cwd());
118
- });
119
- server.on('error', (err) => {
120
- console.error('Server error:', err);
121
- });
122
- process.on('uncaughtException', (err) => {
123
- console.error('Uncaught exception:', err);
124
- });
2
+ import { ReportServerOfPort } from "./ReportServerLib";
3
+ ReportServerOfPort(process.argv[2]);
@@ -0,0 +1,73 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ /* eslint-disable @typescript-eslint/no-unused-vars */
3
+ /* eslint-disable @typescript-eslint/no-empty-object-type */
4
+ import testeranto from "../Node";
5
+ import { ReportServerOfPort } from "../ReportServerLib";
6
+ const specification = (Suite, Given, When, Then) => [
7
+ Suite.Default("the http server which is used in development", {
8
+ initialization: Given["the http server which is used in development"](["It should serve the front page", "It should serve the ReportApp"], [], [
9
+ Then["the frontpage looks good"](),
10
+ // Then["the projects page looks good"](),
11
+ // Then["a project page looks good"](),
12
+ // Then["a test page looks good"](),
13
+ ]),
14
+ }),
15
+ ];
16
+ const implementation = {
17
+ suites: {
18
+ Default: "the http server which is used in development",
19
+ },
20
+ givens: {
21
+ "the http server which is used in development": function (subject) {
22
+ // throw new Error("Function not implemented.");
23
+ return subject;
24
+ },
25
+ },
26
+ // There are no "whens", it is a stateless server.
27
+ whens: {},
28
+ thens: {
29
+ "the frontpage looks good": async (port, utils) => {
30
+ // throw new Error("Function not implemented.");
31
+ // utils.newPage(`localhost:${port}`);
32
+ debugger;
33
+ const page = await utils.newPage();
34
+ utils.goto(page, `localhost:${port}`);
35
+ utils.customScreenShot({ path: `frontpage.png` }, page);
36
+ return;
37
+ },
38
+ "the projects page looks good": function () {
39
+ throw new Error("Function not implemented.");
40
+ },
41
+ "a project page looks good": function () {
42
+ throw new Error("Function not implemented.");
43
+ },
44
+ "a test page looks good": function () {
45
+ throw new Error("Function not implemented.");
46
+ },
47
+ },
48
+ };
49
+ const adapter = {
50
+ assertThis: function (x) {
51
+ throw new Error("Function not implemented.");
52
+ },
53
+ andWhen: function (store, whenCB, testResource, pm) {
54
+ throw new Error("Function not implemented.");
55
+ },
56
+ butThen: function (store, thenCB, testResource, pm) {
57
+ throw new Error("Function not implemented.");
58
+ },
59
+ afterAll: function (store, pm) {
60
+ throw new Error("Function not implemented.");
61
+ },
62
+ afterEach: function (store, key, pm) {
63
+ throw new Error("Function not implemented.");
64
+ },
65
+ beforeAll: async function (input, testResource, pm) {
66
+ await new Promise((res, rej) => input(testResource.ports[0]));
67
+ return testResource.ports[0];
68
+ },
69
+ beforeEach: function (subject, initializer, testResource, initialValues, pm) {
70
+ throw new Error("Function not implemented.");
71
+ },
72
+ };
73
+ export default testeranto(ReportServerOfPort, specification, implementation, adapter);
@@ -0,0 +1,134 @@
1
+ // simple http server to preview reports
2
+ import staticServer from "node-static";
3
+ import http from "http";
4
+ import path from "path";
5
+ import fs from "fs";
6
+ const fileServer = new staticServer.Server("./", {
7
+ cache: false,
8
+ headers: {
9
+ "Cache-Control": "no-cache, no-store, must-revalidate",
10
+ Pragma: "no-cache",
11
+ Expires: "0",
12
+ },
13
+ });
14
+ const server = http.createServer((req, res) => {
15
+ // Handle potential double responses
16
+ let responded = false;
17
+ const safeResponse = (handler) => {
18
+ if (responded)
19
+ return;
20
+ responded = true;
21
+ try {
22
+ handler();
23
+ }
24
+ catch (err) {
25
+ console.error("Error handling request:", err);
26
+ if (!res.headersSent) {
27
+ res.writeHead(500);
28
+ }
29
+ res.end("Internal Server Error");
30
+ }
31
+ };
32
+ req.on("error", (err) => {
33
+ console.error("Request error:", err);
34
+ safeResponse(() => {
35
+ if (!res.headersSent) {
36
+ res.writeHead(400);
37
+ }
38
+ res.end("Bad Request");
39
+ });
40
+ });
41
+ req.on("end", () => {
42
+ safeResponse(() => {
43
+ const filePath = path.join(process.cwd(), req.url || "");
44
+ // First check if file exists
45
+ fs.stat(filePath, (err, stats) => {
46
+ if (err || !stats.isFile()) {
47
+ // Check if directory exists
48
+ fs.stat(filePath, (dirErr, dirStats) => {
49
+ if (!dirErr && dirStats.isDirectory()) {
50
+ // Serve directory listing
51
+ fs.readdir(filePath, (readErr, files) => {
52
+ if (readErr) {
53
+ res.writeHead(500);
54
+ return res.end("Error reading directory");
55
+ }
56
+ res.writeHead(200, { "Content-Type": "text/html" });
57
+ res.write(`
58
+ <html>
59
+ <head>
60
+ <title>Directory Listing: ${req.url}</title>
61
+ <style>
62
+ body { font-family: sans-serif; margin: 2rem; }
63
+ h1 { color: #333; }
64
+ ul { list-style: none; padding: 0; }
65
+ li { padding: 0.5rem; }
66
+ li a { color: #0366d6; text-decoration: none; }
67
+ li a:hover { text-decoration: underline; }
68
+ </style>
69
+ </head>
70
+ <body>
71
+ <h1>Directory: ${req.url}</h1>
72
+ <ul>
73
+ ${files
74
+ .map((file) => `
75
+ <li>
76
+ <a href="${path.join(req.url || "", file)}">
77
+ ${file}${file.endsWith("/") ? "/" : ""}
78
+ </a>
79
+ </li>
80
+ `)
81
+ .join("")}
82
+ </ul>
83
+ </body>
84
+ </html>
85
+ `);
86
+ res.end();
87
+ });
88
+ }
89
+ else {
90
+ // Neither file nor directory exists - send 404
91
+ if (!res.headersSent) {
92
+ res.writeHead(404, { "Content-Type": "text/plain" });
93
+ res.end("File not found");
94
+ }
95
+ }
96
+ });
97
+ return;
98
+ }
99
+ // File exists - serve it through node-static
100
+ const serve = () => {
101
+ fileServer.serve(req, res, (err) => {
102
+ if (err && !res.headersSent) {
103
+ res.writeHead(err.status || 500);
104
+ res.end(err.message);
105
+ }
106
+ });
107
+ };
108
+ // Ensure we don't double-serve
109
+ if (!res.headersSent) {
110
+ serve();
111
+ }
112
+ });
113
+ });
114
+ });
115
+ req.resume();
116
+ });
117
+ server.on("error", (err) => {
118
+ console.error("Server error:", err);
119
+ });
120
+ process.on("uncaughtException", (err) => {
121
+ console.error("Uncaught exception:", err);
122
+ });
123
+ const start = (port) => {
124
+ if (port) {
125
+ server.listen(port, () => {
126
+ console.log(`Server running on http://localhost:${port}`);
127
+ console.log("Serving files from:", process.cwd());
128
+ });
129
+ }
130
+ else {
131
+ console.log("you need to specify a port");
132
+ }
133
+ };
134
+ export const ReportServerOfPort = (port) => start(port);
@@ -185,14 +185,18 @@ export const TestPage = () => {
185
185
  React.createElement(Button, { variant: "outline-light", onClick: () => navigate(`/projects/${projectName}#${runtime}`) }, "View Build Logs")))) : testData ? (React.createElement("div", { className: "test-results" },
186
186
  React.createElement("div", { className: "mb-3" }),
187
187
  testData.givens.map((given, i) => {
188
- var _a;
188
+ var _a, _b;
189
189
  return (React.createElement("div", { key: i, className: "mb-4 card" },
190
190
  React.createElement("div", { className: "card-header bg-primary text-white" },
191
191
  React.createElement("div", { className: "d-flex justify-content-between align-items-center" },
192
- React.createElement("h4", null,
193
- "Given: ",
194
- given.name),
195
- ((_a = given.artifacts) === null || _a === void 0 ? void 0 : _a.length) > 0 && (React.createElement("div", { className: "dropdown" },
192
+ React.createElement("div", null,
193
+ React.createElement("h4", null,
194
+ "Given: ",
195
+ given.name),
196
+ ((_a = given.features) === null || _a === void 0 ? void 0 : _a.length) > 0 && (React.createElement("div", { className: "mt-1" },
197
+ React.createElement("small", null, "Features:"),
198
+ React.createElement("ul", { className: "list-unstyled" }, given.features.map((feature, fi) => (React.createElement("li", { key: fi }, feature.startsWith('http') ? (React.createElement("a", { href: feature, target: "_blank", rel: "noopener noreferrer", className: "text-white" }, new URL(feature).hostname)) : (React.createElement("span", { className: "text-white" }, feature))))))))),
199
+ ((_b = given.artifacts) === null || _b === void 0 ? void 0 : _b.length) > 0 && (React.createElement("div", { className: "dropdown" },
196
200
  React.createElement("button", { className: "btn btn-sm btn-light dropdown-toggle", type: "button", "data-bs-toggle": "dropdown" },
197
201
  "Artifacts (",
198
202
  given.artifacts.length,
@@ -201,29 +205,37 @@ export const TestPage = () => {
201
205
  React.createElement("a", { className: "dropdown-item", href: `/testeranto/reports/${projectName}/${testName.split('.').slice(0, -1).join('.')}/${runtime}/${artifact}`, target: "_blank", rel: "noopener noreferrer" }, artifact.split('/').pop()))))))))),
202
206
  React.createElement("div", { className: "card-body" },
203
207
  given.whens.map((when, j) => {
204
- var _a;
208
+ var _a, _b;
205
209
  return (React.createElement("div", { key: `w-${j}`, className: `p-3 mb-2 ${when.error ? 'bg-danger text-white' : 'bg-success text-white'}` },
206
210
  React.createElement("div", { className: "d-flex justify-content-between align-items-start" },
207
211
  React.createElement("div", null,
208
- React.createElement("strong", null, "When:"),
209
- " ",
210
- when.name,
211
- when.error && React.createElement("pre", { className: "mt-2" }, when.error)),
212
- ((_a = when.artifacts) === null || _a === void 0 ? void 0 : _a.length) > 0 && (React.createElement("div", { className: "ms-3" },
212
+ React.createElement("div", null,
213
+ React.createElement("strong", null, "When:"),
214
+ " ",
215
+ when.name,
216
+ ((_a = when.features) === null || _a === void 0 ? void 0 : _a.length) > 0 && (React.createElement("div", { className: "mt-2" },
217
+ React.createElement("small", null, "Features:"),
218
+ React.createElement("ul", { className: "list-unstyled" }, when.features.map((feature, fi) => (React.createElement("li", { key: fi }, feature.startsWith('http') ? (React.createElement("a", { href: feature, target: "_blank", rel: "noopener noreferrer" }, new URL(feature).hostname)) : (feature))))))),
219
+ when.error && React.createElement("pre", { className: "mt-2" }, when.error))),
220
+ ((_b = when.artifacts) === null || _b === void 0 ? void 0 : _b.length) > 0 && (React.createElement("div", { className: "ms-3" },
213
221
  React.createElement("strong", null, "Artifacts:"),
214
222
  React.createElement("ul", { className: "list-unstyled" }, when.artifacts.map((artifact, ai) => (React.createElement("li", { key: ai },
215
223
  React.createElement("a", { href: `/testeranto/reports/${projectName}/${testName.split('.').slice(0, -1).join('.')}/${runtime}/${artifact}`, target: "_blank", className: "text-white", rel: "noopener noreferrer" }, artifact.split('/').pop()))))))))));
216
224
  }),
217
225
  given.thens.map((then, k) => {
218
- var _a;
226
+ var _a, _b;
219
227
  return (React.createElement("div", { key: `t-${k}`, className: `p-3 mb-2 ${then.error ? 'bg-danger text-white' : 'bg-success text-white'}` },
220
228
  React.createElement("div", { className: "d-flex justify-content-between align-items-start" },
221
229
  React.createElement("div", null,
222
- React.createElement("strong", null, "Then:"),
223
- " ",
224
- then.name,
225
- then.error && React.createElement("pre", { className: "mt-2" }, then.error)),
226
- ((_a = then.artifacts) === null || _a === void 0 ? void 0 : _a.length) > 0 && (React.createElement("div", { className: "ms-3" },
230
+ React.createElement("div", null,
231
+ React.createElement("strong", null, "Then:"),
232
+ " ",
233
+ then.name,
234
+ ((_a = then.features) === null || _a === void 0 ? void 0 : _a.length) > 0 && (React.createElement("div", { className: "mt-2" },
235
+ React.createElement("small", null, "Features:"),
236
+ React.createElement("ul", { className: "list-unstyled" }, then.features.map((feature, fi) => (React.createElement("li", { key: fi }, feature.startsWith('http') ? (React.createElement("a", { href: feature, target: "_blank", rel: "noopener noreferrer" }, new URL(feature).hostname)) : (feature))))))),
237
+ then.error && React.createElement("pre", { className: "mt-2" }, then.error))),
238
+ ((_b = then.artifacts) === null || _b === void 0 ? void 0 : _b.length) > 0 && (React.createElement("div", { className: "ms-3" },
227
239
  React.createElement("strong", null, "Artifacts:"),
228
240
  React.createElement("ul", { className: "list-unstyled" }, then.artifacts.map((artifact, ai) => (React.createElement("li", { key: ai },
229
241
  React.createElement("a", { href: `/testeranto/reports/${projectName}/${testName.split('.').slice(0, -1).join('.')}/${runtime}/${artifact}`, target: "_blank", className: "text-white", rel: "noopener noreferrer" }, artifact.split('/').pop()))))))))));
@@ -35,7 +35,7 @@ export const implementation = {
35
35
  thens: {
36
36
  happyPath: () => async ({ container, html }, pm) => {
37
37
  console.group('[Test] Verifying render output');
38
- debugger;
38
+ // debugger
39
39
  const p = await pm.page();
40
40
  await pm.customScreenShot({ path: "happyPath.png" }, p);
41
41
  assert.equal(1, 1);