testeranto 0.74.0 → 0.79.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 (257) hide show
  1. package/.eslintrc.js +5 -2
  2. package/Bundle.Dockerfile +52 -0
  3. package/README.md +25 -24
  4. package/build-tests.ts +16 -0
  5. package/dist/common/build-tests.js +38 -0
  6. package/dist/common/init-docs.js +8 -0
  7. package/dist/common/run-tests.js +34 -0
  8. package/dist/common/src/Aider.js +96 -0
  9. package/dist/common/src/Init.js +10 -0
  10. package/dist/common/{Node.js → src/Node.js} +1 -0
  11. package/dist/common/src/PM/index.js +7 -0
  12. package/dist/common/{PM → src/PM}/main.js +287 -10
  13. package/dist/common/{PM → src/PM}/node.js +4 -0
  14. package/dist/common/{PM → src/PM}/web.js +3 -0
  15. package/dist/common/{Project.js → src/Project.js} +15 -57
  16. package/dist/common/{Puppeteer.js → src/Puppeteer.js} +65 -26
  17. package/dist/common/{SubPackages → src/SubPackages}/react-dom/component/web.js +5 -25
  18. package/dist/common/src/SubPackages/react-dom/jsx/web.js +117 -0
  19. package/dist/common/{SubPackages/react-test-renderer/component/index.js → src/SubPackages/react-test-renderer/component/interface.js} +0 -20
  20. package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/component/node.js +2 -2
  21. package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/component/web.js +2 -2
  22. package/dist/common/{Types.js → src/Types.js} +0 -2
  23. package/dist/common/{esbuildConfigs → src/esbuildConfigs}/index.js +1 -0
  24. package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +52 -0
  25. package/dist/common/{esbuildConfigs → src/esbuildConfigs}/node.js +5 -1
  26. package/dist/common/src/esbuildConfigs/report.js +14 -0
  27. package/dist/common/{esbuildConfigs → src/esbuildConfigs}/web.js +3 -1
  28. package/dist/common/src/lib/abstractBase.js +581 -0
  29. package/dist/common/{lib → src/lib}/basebuilder.js +12 -38
  30. package/dist/common/{lib → src/lib}/classBuilder.js +1 -3
  31. package/dist/common/{lib → src/lib}/core.js +3 -5
  32. package/dist/common/src/lib/types.js +2 -0
  33. package/dist/common/src/utils.js +16 -0
  34. package/dist/common/testeranto.js +15 -0
  35. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  36. package/dist/module/build-tests.js +10 -0
  37. package/dist/module/init-docs.js +3 -0
  38. package/dist/module/run-tests.js +6 -0
  39. package/dist/module/src/Aider.js +89 -0
  40. package/dist/module/src/Init.js +5 -0
  41. package/dist/module/{Node.js → src/Node.js} +1 -0
  42. package/dist/module/src/PM/index.js +3 -0
  43. package/dist/module/src/PM/main.js +617 -0
  44. package/dist/module/{PM → src/PM}/node.js +4 -0
  45. package/dist/module/{PM → src/PM}/web.js +3 -0
  46. package/dist/module/{Project.js → src/Project.js} +15 -57
  47. package/dist/module/{Puppeteer.js → src/Puppeteer.js} +65 -26
  48. package/dist/module/{SubPackages → src/SubPackages}/react-dom/component/web.js +5 -25
  49. package/dist/module/src/SubPackages/react-dom/jsx/web.js +89 -0
  50. package/dist/module/{SubPackages/react-test-renderer/component/index.js → src/SubPackages/react-test-renderer/component/interface.js} +0 -20
  51. package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/component/node.js +1 -1
  52. package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/component/web.js +1 -1
  53. package/dist/module/{esbuildConfigs → src/esbuildConfigs}/index.js +1 -0
  54. package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +47 -0
  55. package/dist/module/{esbuildConfigs → src/esbuildConfigs}/node.js +5 -1
  56. package/dist/module/src/esbuildConfigs/report.js +14 -0
  57. package/dist/module/{esbuildConfigs → src/esbuildConfigs}/web.js +3 -1
  58. package/dist/module/src/lib/abstractBase.js +573 -0
  59. package/dist/module/{lib → src/lib}/basebuilder.js +12 -38
  60. package/dist/module/{lib → src/lib}/classBuilder.js +1 -3
  61. package/dist/module/{lib → src/lib}/core.js +3 -5
  62. package/dist/module/src/utils.js +9 -0
  63. package/dist/module/testeranto.js +13 -0
  64. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  65. package/dist/types/build-tests.d.ts +3 -0
  66. package/dist/types/init-docs.d.ts +2 -0
  67. package/dist/types/run-tests.d.ts +2 -0
  68. package/dist/types/src/Aider.d.ts +1 -0
  69. package/dist/types/src/Init.d.ts +2 -0
  70. package/dist/types/src/Node.d.ts +6 -0
  71. package/dist/types/{PM → src/PM}/index.d.ts +3 -2
  72. package/dist/types/{PM → src/PM}/main.d.ts +8 -3
  73. package/dist/types/{PM → src/PM}/node.d.ts +2 -0
  74. package/dist/types/{PM → src/PM}/web.d.ts +1 -0
  75. package/dist/types/{Project.d.ts → src/Project.d.ts} +1 -1
  76. package/dist/types/src/Puppeteer.d.ts +2 -0
  77. package/dist/types/src/SubPackages/puppeteer.d.ts +6 -0
  78. package/dist/types/{SubPackages → src/SubPackages}/react/component/node.d.ts +1 -1
  79. package/dist/types/{SubPackages → src/SubPackages}/react/component/web.d.ts +1 -1
  80. package/dist/types/src/SubPackages/react/jsx/node.d.ts +4 -0
  81. package/dist/types/src/SubPackages/react/jsx/web.d.ts +4 -0
  82. package/dist/types/{SubPackages → src/SubPackages}/react-dom/component/node.d.ts +2 -2
  83. package/dist/types/src/SubPackages/react-dom/component/web.d.ts +11 -0
  84. package/dist/types/src/SubPackages/react-dom/jsx/node.d.ts +6 -0
  85. package/dist/types/src/SubPackages/react-dom/jsx/web.d.ts +5 -0
  86. package/dist/types/src/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +5 -0
  87. package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/component/index.d.ts +0 -7
  88. package/dist/types/src/SubPackages/react-test-renderer/component/interface.d.ts +9 -0
  89. package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/component/node.d.ts +1 -2
  90. package/dist/types/src/SubPackages/react-test-renderer/component/web.d.ts +3 -0
  91. package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/fc/node.d.ts +1 -1
  92. package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/fc/web.d.ts +1 -1
  93. package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/jsx/node.d.ts +1 -2
  94. package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/jsx/web.d.ts +1 -2
  95. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/node.d.ts +4 -0
  96. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/web.d.ts +4 -0
  97. package/dist/types/src/Types.d.ts +51 -0
  98. package/dist/types/src/Web.d.ts +6 -0
  99. package/dist/types/src/esbuildConfigs/inputFilesPlugin.d.ts +5 -0
  100. package/dist/types/{lib → src/lib}/abstractBase.d.ts +8 -8
  101. package/dist/types/{lib → src/lib}/basebuilder.d.ts +1 -1
  102. package/dist/types/{lib → src/lib}/classBuilder.d.ts +1 -1
  103. package/dist/types/{lib → src/lib}/core.d.ts +1 -1
  104. package/dist/types/{lib → src/lib}/index.d.ts +5 -5
  105. package/dist/types/{lib → src/lib}/types.d.ts +15 -15
  106. package/dist/types/src/utils.d.ts +2 -0
  107. package/dist/types/testeranto.d.ts +16 -0
  108. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  109. package/docker-compose.yml +37 -0
  110. package/init-docs.ts +5 -0
  111. package/package.json +72 -25
  112. package/run-tests.ts +9 -0
  113. package/src/Aider.ts +125 -0
  114. package/src/Init.ts +20 -0
  115. package/src/Node.ts +31 -2
  116. package/src/PM/index.ts +7 -84
  117. package/src/PM/main.ts +400 -16
  118. package/src/PM/node.ts +6 -0
  119. package/src/PM/web.ts +4 -0
  120. package/src/Project.ts +33 -84
  121. package/src/Puppeteer.ts +115 -62
  122. package/src/SubPackages/react-dom/component/web.ts +10 -30
  123. package/src/SubPackages/react-dom/jsx/web.ts +110 -76
  124. package/src/SubPackages/react-test-renderer/component/index.ts +0 -66
  125. package/src/SubPackages/react-test-renderer/component/interface.ts +48 -0
  126. package/src/SubPackages/react-test-renderer/component/node.ts +2 -1
  127. package/src/SubPackages/react-test-renderer/component/web.ts +2 -1
  128. package/src/Types.ts +138 -29
  129. package/src/Web.ts +32 -2
  130. package/src/esbuildConfigs/index.ts +1 -0
  131. package/src/esbuildConfigs/inputFilesPlugin.ts +67 -0
  132. package/src/esbuildConfigs/node.ts +4 -2
  133. package/src/esbuildConfigs/report.ts +13 -13
  134. package/src/esbuildConfigs/web.ts +4 -0
  135. package/src/lib/abstractBase.ts +366 -36
  136. package/src/lib/basebuilder.ts +26 -52
  137. package/src/lib/classBuilder.ts +14 -2
  138. package/src/lib/core.ts +18 -7
  139. package/src/lib/index.ts +115 -7
  140. package/src/lib/types.ts +143 -37
  141. package/src/utils.ts +15 -0
  142. package/testeranto.ts +13 -0
  143. package/tsconfig.common.json +12 -4
  144. package/tsconfig.json +9 -3
  145. package/tsconfig.module.json +2 -3
  146. package/tsconfig.types.json +1 -2
  147. package/dist/common/Features.js +0 -84
  148. package/dist/common/PM/index.js +0 -71
  149. package/dist/common/Reporter.js +0 -119
  150. package/dist/common/Scheduler.js +0 -1
  151. package/dist/common/SubPackages/react-dom/jsx/web.js +0 -93
  152. package/dist/common/esbuildConfigs/report.js +0 -13
  153. package/dist/common/lib/abstractBase.js +0 -348
  154. package/dist/common/preload.js +0 -15
  155. package/dist/common/report.html.js +0 -31
  156. package/dist/module/Features.js +0 -73
  157. package/dist/module/PM/index.js +0 -67
  158. package/dist/module/PM/main.js +0 -340
  159. package/dist/module/Reporter.js +0 -114
  160. package/dist/module/Scheduler.js +0 -1
  161. package/dist/module/SubPackages/react-dom/jsx/web.js +0 -65
  162. package/dist/module/Types.js +0 -3
  163. package/dist/module/esbuildConfigs/report.js +0 -11
  164. package/dist/module/lib/abstractBase.js +0 -340
  165. package/dist/module/preload.js +0 -15
  166. package/dist/module/report.html.js +0 -29
  167. package/dist/prebuild/Report.css +0 -11358
  168. package/dist/prebuild/Report.js +0 -37585
  169. package/dist/types/Features.d.ts +0 -68
  170. package/dist/types/Node.d.ts +0 -6
  171. package/dist/types/SubPackages/puppeteer.d.ts +0 -6
  172. package/dist/types/SubPackages/react/jsx/node.d.ts +0 -4
  173. package/dist/types/SubPackages/react/jsx/web.d.ts +0 -4
  174. package/dist/types/SubPackages/react-dom/component/web.d.ts +0 -5
  175. package/dist/types/SubPackages/react-dom/jsx/node.d.ts +0 -6
  176. package/dist/types/SubPackages/react-dom/jsx/web.d.ts +0 -5
  177. package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -5
  178. package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +0 -4
  179. package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +0 -5
  180. package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +0 -5
  181. package/dist/types/Types.d.ts +0 -50
  182. package/dist/types/Web.d.ts +0 -6
  183. package/dist/types/esbuildConfigs/report.d.ts +0 -4
  184. package/dist/types/preload.d.ts +0 -0
  185. package/dist/types/report.html.d.ts +0 -2
  186. package/electronBuild.ts +0 -32
  187. package/src/Features.ts +0 -118
  188. package/src/Report.tsx +0 -521
  189. package/src/Reporter.ts +0 -134
  190. package/src/Scheduler.ts +0 -0
  191. package/src/preload.ts +0 -17
  192. package/src/report.html.ts +0 -29
  193. package/tests/Rectangle.test.ts +0 -189
  194. /package/dist/common/{SubPackages → src/SubPackages}/puppeteer.js +0 -0
  195. /package/dist/common/{SubPackages → src/SubPackages}/react/component/node.js +0 -0
  196. /package/dist/common/{SubPackages → src/SubPackages}/react/component/web.js +0 -0
  197. /package/dist/common/{SubPackages → src/SubPackages}/react/jsx/index.js +0 -0
  198. /package/dist/common/{SubPackages → src/SubPackages}/react/jsx/node.js +0 -0
  199. /package/dist/common/{SubPackages → src/SubPackages}/react/jsx/web.js +0 -0
  200. /package/dist/common/{SubPackages → src/SubPackages}/react-dom/component/node.js +0 -0
  201. /package/dist/common/{SubPackages → src/SubPackages}/react-dom/jsx/index.js +0 -0
  202. /package/dist/common/{SubPackages → src/SubPackages}/react-dom/jsx/node.js +0 -0
  203. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/MemoExoticComponent/node.js +0 -0
  204. /package/dist/common/{lib/types.js → src/SubPackages/react-test-renderer/component/index.js} +0 -0
  205. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/fc/node.js +0 -0
  206. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/fc/web.js +0 -0
  207. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx/index.js +0 -0
  208. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx/node.js +0 -0
  209. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx/web.js +0 -0
  210. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/index.js +0 -0
  211. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/node.js +0 -0
  212. /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
  213. /package/dist/common/{Web.js → src/Web.js} +0 -0
  214. /package/dist/common/{esbuildConfigs → src/esbuildConfigs}/features.js +0 -0
  215. /package/dist/common/{esbuildConfigs → src/esbuildConfigs}/tests.js +0 -0
  216. /package/dist/common/{lib → src/lib}/index.js +0 -0
  217. /package/dist/common/{puppeteerConfiger.js → src/puppeteerConfiger.js} +0 -0
  218. /package/dist/common/{web.html.js → src/web.html.js} +0 -0
  219. /package/dist/module/{SubPackages → src/SubPackages}/puppeteer.js +0 -0
  220. /package/dist/module/{SubPackages → src/SubPackages}/react/component/node.js +0 -0
  221. /package/dist/module/{SubPackages → src/SubPackages}/react/component/web.js +0 -0
  222. /package/dist/module/{SubPackages → src/SubPackages}/react/jsx/index.js +0 -0
  223. /package/dist/module/{SubPackages → src/SubPackages}/react/jsx/node.js +0 -0
  224. /package/dist/module/{SubPackages → src/SubPackages}/react/jsx/web.js +0 -0
  225. /package/dist/module/{SubPackages → src/SubPackages}/react-dom/component/node.js +0 -0
  226. /package/dist/module/{SubPackages → src/SubPackages}/react-dom/jsx/index.js +0 -0
  227. /package/dist/module/{SubPackages → src/SubPackages}/react-dom/jsx/node.js +0 -0
  228. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/MemoExoticComponent/node.js +0 -0
  229. /package/dist/module/{lib/types.js → src/SubPackages/react-test-renderer/component/index.js} +0 -0
  230. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/fc/node.js +0 -0
  231. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/fc/web.js +0 -0
  232. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx/index.js +0 -0
  233. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx/node.js +0 -0
  234. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx/web.js +0 -0
  235. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/index.js +0 -0
  236. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/node.js +0 -0
  237. /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
  238. /package/dist/{types/Puppeteer.d.ts → module/src/Types.js} +0 -0
  239. /package/dist/module/{Web.js → src/Web.js} +0 -0
  240. /package/dist/module/{esbuildConfigs → src/esbuildConfigs}/features.js +0 -0
  241. /package/dist/module/{esbuildConfigs → src/esbuildConfigs}/tests.js +0 -0
  242. /package/dist/module/{lib → src/lib}/index.js +0 -0
  243. /package/dist/{types/Reporter.d.ts → module/src/lib/types.js} +0 -0
  244. /package/dist/module/{puppeteerConfiger.js → src/puppeteerConfiger.js} +0 -0
  245. /package/dist/module/{web.html.js → src/web.html.js} +0 -0
  246. /package/dist/types/{SubPackages → src/SubPackages}/react/jsx/index.d.ts +0 -0
  247. /package/dist/types/{SubPackages → src/SubPackages}/react-dom/jsx/index.d.ts +0 -0
  248. /package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/jsx/index.d.ts +0 -0
  249. /package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/index.d.ts +0 -0
  250. /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/features.d.ts +0 -0
  251. /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/index.d.ts +0 -0
  252. /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/node.d.ts +0 -0
  253. /package/dist/types/{Scheduler.d.ts → src/esbuildConfigs/report.d.ts} +0 -0
  254. /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/tests.d.ts +0 -0
  255. /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/web.d.ts +0 -0
  256. /package/dist/types/{puppeteerConfiger.d.ts → src/puppeteerConfiger.d.ts} +0 -0
  257. /package/dist/types/{web.html.d.ts → src/web.html.d.ts} +0 -0
package/src/Project.ts CHANGED
@@ -6,11 +6,7 @@ import { glob } from "glob";
6
6
 
7
7
  import esbuildNodeConfiger from "./esbuildConfigs/node.js";
8
8
  import esbuildWebConfiger from "./esbuildConfigs/web.js";
9
- import esbuildFeaturesConfiger from "./esbuildConfigs/features.js";
10
-
11
9
  import webHtmlFrame from "./web.html.js";
12
- import reportHtmlFrame from "./report.html.js";
13
-
14
10
  import { ITestTypes, IBaseConfig, IRunTime } from "./lib/types.js";
15
11
 
16
12
  var mode: "DEV" | "PROD" = process.argv[2] === "-dev" ? "DEV" : "PROD";
@@ -26,18 +22,9 @@ process.stdin.on("keypress", (str, key) => {
26
22
  }
27
23
  });
28
24
 
29
- // setInterval(() => {
30
- // const memoryUsage = process.memoryUsage();
31
- // console.log("Memory usage:", memoryUsage);
32
- // }, 10000); // Check every 10 seconds
33
-
34
- let featuresDone,
35
- nodeDone,
25
+ let nodeDone,
36
26
  webDone = false;
37
- const onFeaturesDone = () => {
38
- featuresDone = true;
39
- onDone();
40
- };
27
+
41
28
  const onNodeDone = () => {
42
29
  nodeDone = true;
43
30
  onDone();
@@ -51,7 +38,6 @@ const onDone = () => {
51
38
  console.log(
52
39
  JSON.stringify(
53
40
  {
54
- featuresDone,
55
41
  nodeDone,
56
42
  webDone,
57
43
  mode,
@@ -60,7 +46,7 @@ const onDone = () => {
60
46
  2
61
47
  )
62
48
  );
63
- if (featuresDone && nodeDone && webDone && mode === "PROD") {
49
+ if (nodeDone && webDone && mode === "PROD") {
64
50
  console.log("Testeranto-EsBuild is all done. Goodbye!");
65
51
  process.exit();
66
52
  } else {
@@ -72,8 +58,20 @@ export class ITProject {
72
58
  config: IBaseConfig;
73
59
  mode: `up` | `down` = `up`;
74
60
 
75
- constructor(config: IBaseConfig) {
76
- this.config = config;
61
+ constructor(configs: IBaseConfig) {
62
+ this.config = configs;
63
+
64
+ fs.writeFileSync(
65
+ `${this.config.outdir}/testeranto.json`,
66
+ JSON.stringify(
67
+ {
68
+ ...this.config,
69
+ buildDir: process.cwd() + "/" + this.config.outdir,
70
+ },
71
+ null,
72
+ 2
73
+ )
74
+ );
77
75
 
78
76
  Promise.resolve(
79
77
  Promise.all(
@@ -88,7 +86,7 @@ export class ITProject {
88
86
  .join(".");
89
87
 
90
88
  const htmlFilePath = path.normalize(
91
- `${process.cwd()}/${config.outdir}/web/${sourceDir.join(
89
+ `${process.cwd()}/${this.config.outdir}/web/${sourceDir.join(
92
90
  "/"
93
91
  )}/${sourceFileNameMinusJs}.html`
94
92
  );
@@ -109,72 +107,22 @@ export class ITProject {
109
107
 
110
108
  const [nodeEntryPoints, webEntryPoints] = getRunnables(this.config.tests);
111
109
 
112
- // nodeEntryPoints.forEach((nep) => {
113
- // const f = `${process.cwd()}/${nep}`;
114
- // console.log("nep", f);
115
- // import(f).then((module) => {
116
- // return module.default.then((defaultModule) => {
117
- // console.log("defaultModule", defaultModule);
118
- // // defaultModule
119
- // // .receiveTestResourceConfig(argz)
120
- // // .then((x) => {
121
- // // console.log("then", x);
122
- // // return x;
123
- // // })
124
- // // .catch((e) => {
125
- // // console.log("catch", e);
126
- // // });
127
- // });
128
- // });
129
- // });
130
-
131
- glob(`./${config.outdir}/chunk-*.mjs`, { ignore: "node_modules/**" }).then(
132
- (chunks) => {
133
- chunks.forEach((chunk) => {
134
- fs.unlinkSync(chunk);
135
- });
136
- }
137
- );
138
-
139
- fs.copyFileSync(
140
- "./node_modules/testeranto/dist/prebuild/Report.js",
141
- "./docs/Report.js"
142
- );
143
- fs.copyFileSync(
144
- "./node_modules/testeranto/dist/prebuild/Report.css",
145
- "./docs/Report.css"
110
+ console.log(
111
+ `this.getSecondaryEndpointsPoints("web")`,
112
+ this.getSecondaryEndpointsPoints("web")
146
113
  );
147
114
 
148
- fs.writeFileSync(`${config.outdir}/report.html`, reportHtmlFrame());
115
+ glob(`./${this.config.outdir}/chunk-*.mjs`, {
116
+ ignore: "node_modules/**",
117
+ }).then((chunks) => {
118
+ chunks.forEach((chunk) => {
119
+ fs.unlinkSync(chunk);
120
+ });
121
+ });
149
122
 
150
123
  Promise.all([
151
- fs.promises.writeFile(
152
- `${config.outdir}/testeranto.json`,
153
- JSON.stringify(
154
- {
155
- ...config,
156
- buildDir: process.cwd() + "/" + config.outdir,
157
- },
158
- null,
159
- 2
160
- )
161
- ),
162
- esbuild
163
- .context(esbuildFeaturesConfiger(config))
164
- .then(async (featuresContext) => {
165
- if (mode == "DEV") {
166
- await featuresContext.watch();
167
- onFeaturesDone();
168
- } else {
169
- featuresContext.rebuild().then((v) => {
170
- onFeaturesDone();
171
- });
172
- }
173
-
174
- return featuresContext;
175
- }),
176
124
  esbuild
177
- .context(esbuildNodeConfiger(config, nodeEntryPoints))
125
+ .context(esbuildNodeConfiger(this.config, nodeEntryPoints))
178
126
  .then(async (nodeContext) => {
179
127
  if (mode == "DEV") {
180
128
  await nodeContext.watch().then((v) => {
@@ -189,7 +137,7 @@ export class ITProject {
189
137
  return nodeContext;
190
138
  }),
191
139
  esbuild
192
- .context(esbuildWebConfiger(config, webEntryPoints))
140
+ .context(esbuildWebConfiger(this.config, webEntryPoints))
193
141
  .then(async (webContext) => {
194
142
  if (mode == "DEV") {
195
143
  await webContext.watch().then((v) => {
@@ -208,11 +156,12 @@ export class ITProject {
208
156
  public getSecondaryEndpointsPoints(runtime?: IRunTime): string[] {
209
157
  const meta = (ts: ITestTypes[], st: Set<string>): Set<string> => {
210
158
  ts.forEach((t) => {
159
+ console.log("getSecondaryEndpointsPoints", t);
211
160
  if (t[1] === runtime) {
212
161
  st.add(t[0]);
213
162
  }
214
- if (Array.isArray(t[2])) {
215
- meta(t[2], st);
163
+ if (Array.isArray(t[3])) {
164
+ meta(t[3], st);
216
165
  }
217
166
  });
218
167
  return st;
package/src/Puppeteer.ts CHANGED
@@ -1,12 +1,10 @@
1
1
  import readline from "readline";
2
2
  import fs from "fs";
3
- import path from "path";
4
- import { jsonc } from "jsonc";
5
- import { v4 as uuidv4 } from "uuid";
6
-
7
- import { IBuiltConfig, IRunTime } from "./lib/types";
3
+ import watch from "recursive-watch";
8
4
 
9
5
  import { PM_Main } from "./PM/main.js";
6
+ import { destinationOfRuntime } from "./utils.js";
7
+ import { timeout } from "puppeteer-core/lib/esm/puppeteer/index.js";
10
8
 
11
9
  var mode: "DEV" | "PROD" = process.argv[2] === "-dev" ? "DEV" : "PROD";
12
10
 
@@ -17,6 +15,8 @@ const childProcesses: Record<string, "loaded" | "running" | "done"> = {};
17
15
  readline.emitKeypressEvents(process.stdin);
18
16
  if (process.stdin.isTTY) process.stdin.setRawMode(true);
19
17
 
18
+ // console.log("hello Puppeteer", process.env);
19
+
20
20
  console.log("\n Puppeteer is running. Press 'q' to quit\n");
21
21
  process.stdin.on("keypress", (str, key) => {
22
22
  if (key.name === "q") {
@@ -24,30 +24,51 @@ process.stdin.on("keypress", (str, key) => {
24
24
  }
25
25
  });
26
26
 
27
- const main = async () => {
28
- const configs = jsonc.parse(
29
- (await fs.readFileSync("./docs/testeranto.json")).toString()
30
- ) as IBuiltConfig;
27
+ export default async (partialConfig) => {
28
+ const config = {
29
+ ...partialConfig,
30
+ buildDir: process.cwd() + "/" + partialConfig.outdir,
31
+ };
32
+
33
+ fs.writeFileSync(
34
+ `${config.outdir}/testeranto.json`,
35
+ JSON.stringify(
36
+ {
37
+ ...config,
38
+ buildDir: process.cwd() + "/" + config.outdir,
39
+ },
40
+ null,
41
+ 2
42
+ )
43
+ );
31
44
 
32
- const pm = new PM_Main(configs);
45
+ const pm = new PM_Main(config);
33
46
 
34
47
  await pm.startPuppeteer(
35
48
  {
49
+ // timeout: 1,
36
50
  waitForInitialPage: false,
37
- executablePath: "/opt/homebrew/bin/chromium",
51
+ executablePath:
52
+ // process.env.CHROMIUM_PATH || "/opt/homebrew/bin/chromium",
53
+ "/opt/homebrew/bin/chromium",
38
54
  headless: true,
39
55
  dumpio: true,
56
+ // timeout: 0,
40
57
  args: [
58
+ // "--auto-open-devtools-for-tabs",
59
+
60
+ "--disable-features=IsolateOrigins,site-per-process",
61
+ "--disable-site-isolation-trials",
62
+ "--allow-insecure-localhost",
41
63
  "--allow-file-access-from-files",
42
64
  "--allow-running-insecure-content",
43
- "--auto-open-devtools-for-tabs",
65
+
44
66
  "--disable-dev-shm-usage",
45
67
  "--disable-extensions",
46
68
  "--disable-gpu",
47
69
  "--disable-setuid-sandbox",
48
70
  "--disable-site-isolation-trials",
49
71
  "--disable-web-security",
50
- "--disable-web-security",
51
72
  "--no-first-run",
52
73
  "--no-sandbox",
53
74
  "--no-startup-window",
@@ -70,62 +91,94 @@ const main = async () => {
70
91
  "."
71
92
  );
72
93
 
73
- const destinationOfRuntime = (f: string, r: IRunTime) => {
74
- return path
75
- .normalize(`${configs.buildDir}/${r}/${f}`)
76
- .split(".")
77
- .slice(0, -1)
78
- .join(".");
79
- };
80
-
81
- configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
94
+ config.tests.forEach(([test, runtime, tr, sidecars]) => {
82
95
  if (runtime === "node") {
83
- pm.launchNode(test, destinationOfRuntime(test, "node"));
96
+ pm.launchNode(test, destinationOfRuntime(test, "node", config));
84
97
  } else if (runtime === "web") {
85
- pm.launchWeb(test, destinationOfRuntime(test, "web"));
98
+ pm.launchWeb(test, destinationOfRuntime(test, "web", config), sidecars);
86
99
  } else {
87
100
  console.error("runtime makes no sense", runtime);
88
101
  }
89
102
  });
90
103
 
91
- console.log("ready and watching for changes...", configs.buildDir);
92
- fs.watch(
93
- configs.buildDir,
94
- {
95
- recursive: true,
96
- },
97
- (eventType, changedFile) => {
98
- if (changedFile) {
99
- configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
100
- if (eventType === "change" || eventType === "rename") {
101
- if (
102
- changedFile ===
103
- test
104
- .replace("./", "node/")
105
- .split(".")
106
- .slice(0, -1)
107
- .concat("mjs")
108
- .join(".")
109
- ) {
110
- pm.launchNode(test, destinationOfRuntime(test, "node"));
111
- }
112
-
113
- if (
114
- changedFile ===
115
- test
116
- .replace("./", "web/")
117
- .split(".")
118
- .slice(0, -1)
119
- .concat("mjs")
120
- .join(".")
121
- ) {
122
- pm.launchWeb(test, destinationOfRuntime(test, "web"));
123
- }
104
+ console.log("ready and watching for changes...", config.buildDir);
105
+
106
+ watch(config.buildDir, (eventType, changedFile) => {
107
+ if (changedFile) {
108
+ config.tests.forEach(([test, runtime, tr, sidecars]) => {
109
+ if (eventType === "change" || eventType === "rename") {
110
+ if (
111
+ changedFile ===
112
+ test
113
+ .replace("./", "node/")
114
+ .split(".")
115
+ .slice(0, -1)
116
+ .concat("mjs")
117
+ .join(".")
118
+ ) {
119
+ pm.launchNode(test, destinationOfRuntime(test, "node", config));
120
+ }
121
+
122
+ if (
123
+ changedFile ===
124
+ test
125
+ .replace("./", "web/")
126
+ .split(".")
127
+ .slice(0, -1)
128
+ .concat("mjs")
129
+ .join(".")
130
+ ) {
131
+ pm.launchWeb(
132
+ test,
133
+ destinationOfRuntime(test, "web", config),
134
+ sidecars
135
+ );
124
136
  }
125
- });
126
- }
137
+ }
138
+ });
127
139
  }
128
- );
129
- };
140
+ });
130
141
 
131
- main();
142
+ // does not work on linux
143
+ // fs.watch(
144
+ // config.buildDir,
145
+ // {
146
+ // recursive: true,
147
+ // },
148
+ // (eventType, changedFile) => {
149
+ // if (changedFile) {
150
+ // config.tests.forEach(([test, runtime, tr, sidecars]) => {
151
+ // if (eventType === "change" || eventType === "rename") {
152
+ // if (
153
+ // changedFile ===
154
+ // test
155
+ // .replace("./", "node/")
156
+ // .split(".")
157
+ // .slice(0, -1)
158
+ // .concat("mjs")
159
+ // .join(".")
160
+ // ) {
161
+ // pm.launchNode(test, destinationOfRuntime(test, "node", config));
162
+ // }
163
+
164
+ // if (
165
+ // changedFile ===
166
+ // test
167
+ // .replace("./", "web/")
168
+ // .split(".")
169
+ // .slice(0, -1)
170
+ // .concat("mjs")
171
+ // .join(".")
172
+ // ) {
173
+ // pm.launchWeb(
174
+ // test,
175
+ // destinationOfRuntime(test, "web", config),
176
+ // sidecars
177
+ // );
178
+ // }
179
+ // }
180
+ // });
181
+ // }
182
+ // }
183
+ // );
184
+ };
@@ -4,6 +4,8 @@ import ReactDom from "react-dom/client";
4
4
  import Testeranto from "../../../Web.js";
5
5
  import {
6
6
  IBaseTest,
7
+ IPartialInterface,
8
+ IPartialWebInterface,
7
9
  ITestImplementation,
8
10
  ITestSpecification,
9
11
  } from "../../../Types";
@@ -15,7 +17,7 @@ type ISelection = {
15
17
  reactElement: any; //CElement<any, any>;
16
18
  };
17
19
 
18
- type IStore = {
20
+ export type IStore = {
19
21
  htmlElement: HTMLElement;
20
22
  reactElement: any; //CElement<any, any>,
21
23
  domRoot: ReactDom.Root;
@@ -30,7 +32,8 @@ type ISubject = {
30
32
  export default <ITestShape extends IBaseTest, IWhen, IGiven>(
31
33
  testInput: IInput,
32
34
  testSpecifications: ITestSpecification<ITestShape>,
33
- testImplementations: ITestImplementation<ITestShape, any>
35
+ testImplementations: ITestImplementation<ITestShape, any>,
36
+ testInterface?: IPartialWebInterface<any>
34
37
  ) => {
35
38
  class TesterantoComponent extends testInput {
36
39
  done: (t: TesterantoComponent) => void;
@@ -50,7 +53,6 @@ export default <ITestShape extends IBaseTest, IWhen, IGiven>(
50
53
  testImplementations,
51
54
  {
52
55
  beforeAll: async (initialProps, artificer): Promise<ISubject> => {
53
- console.log("mark5", initialProps);
54
56
  return await new Promise((resolve, rej) => {
55
57
  const htmlElement = document.getElementById("root");
56
58
  if (htmlElement) {
@@ -113,34 +115,12 @@ export default <ITestShape extends IBaseTest, IWhen, IGiven>(
113
115
  butThen: async function (s: IStore, thenCB): Promise<ISelection> {
114
116
  return thenCB(s);
115
117
  },
116
- afterEach: async function (store: IStore, ndx, artificer, utils) {
117
- console.log("afterEach", store);
118
- utils.writeFileSync("aftereachlog", store.toString());
118
+ afterEach:
119
+ testInterface?.afterEach ||
120
+ async function (store: IStore, ndx, artificer, utils) {
121
+ return store;
122
+ },
119
123
 
120
- const page = (await utils.browser.pages()).filter((x) => {
121
- const parsedUrl = new URL(x.url());
122
- parsedUrl.search = "";
123
- const strippedUrl = parsedUrl.toString();
124
-
125
- return (
126
- strippedUrl ===
127
- "file:///Users/adam/Code/kokomoBay/docs/web/src/ClassicalComponent/react-dom/client.web.test.html"
128
- );
129
- // return true;
130
- })[0];
131
-
132
- const x = await page.screenshot({
133
- path: "afterEachLog.jpg",
134
- });
135
- console.log("x", x);
136
- // debugger;
137
- // const div_root = document.getElementById("root");
138
- // store.domRoot && store.domRoot.unmount(); //React 18
139
- // store.remove();
140
- // store.htmlElement.remove();
141
- // store.htmlElement = document.createElement("root");
142
- return store;
143
- },
144
124
  afterAll: async (store: IStore, artificer, utils) => {
145
125
  // setTimeout(() => {
146
126
  // console.log("This will run after 1 second");