testeranto 0.100.0 → 0.111.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 (226) hide show
  1. package/README.md +1 -0
  2. package/bundle.js +80 -30
  3. package/package.json +40 -32
  4. package/src/Footer.tsx +4 -0
  5. package/src/Init.ts +48 -0
  6. package/src/Node.ts +23 -17
  7. package/src/PM/index.ts +1 -1
  8. package/src/PM/main.ts +524 -156
  9. package/src/PM/node.ts +2 -2
  10. package/src/PM/web.ts +1 -1
  11. package/src/ReportClient.tsx +163 -0
  12. package/src/ReportServer.ts +21 -0
  13. package/src/SubPackages/react/component/node.ts +68 -24
  14. package/src/SubPackages/react/component/web.ts +68 -25
  15. package/src/SubPackages/react/jsx/index.ts +39 -18
  16. package/src/SubPackages/react/jsx/node.ts +12 -10
  17. package/src/SubPackages/react/jsx/web.ts +27 -14
  18. package/src/SubPackages/react-dom/component/node.ts +42 -50
  19. package/src/SubPackages/react-dom/component/web.ts +28 -10
  20. package/src/SubPackages/react-dom/jsx/node.ts +54 -56
  21. package/src/SubPackages/react-dom/jsx/web.ts +55 -42
  22. package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +23 -7
  23. package/src/SubPackages/react-test-renderer/component/index.ts +38 -5
  24. package/src/SubPackages/react-test-renderer/component/node.ts +24 -5
  25. package/src/SubPackages/react-test-renderer/component/web.ts +22 -5
  26. package/src/SubPackages/react-test-renderer/fc/node.ts +41 -7
  27. package/src/SubPackages/react-test-renderer/fc/web.ts +43 -11
  28. package/src/SubPackages/react-test-renderer/jsx/index.ts +39 -16
  29. package/src/SubPackages/react-test-renderer/jsx/node.ts +8 -6
  30. package/src/SubPackages/react-test-renderer/jsx/web.ts +22 -5
  31. package/src/SubPackages/react-test-renderer/jsx-promised/index.ts +39 -6
  32. package/src/SubPackages/react-test-renderer/jsx-promised/node.ts +27 -10
  33. package/src/SubPackages/react-test-renderer/jsx-promised/web.ts +26 -12
  34. package/src/TestReport.tsx +176 -0
  35. package/src/Types.ts +63 -309
  36. package/src/Web.ts +24 -18
  37. package/src/build.ts +240 -0
  38. package/src/defaultConfig.ts +2 -1
  39. package/src/esbuildConfigs/eslint-formatter-testeranto.ts +5 -0
  40. package/src/esbuildConfigs/featuresPlugin.ts +0 -1
  41. package/src/esbuildConfigs/index.ts +1 -1
  42. package/src/esbuildConfigs/inputFilesPlugin.ts +2 -135
  43. package/src/esbuildConfigs/node.ts +4 -13
  44. package/src/esbuildConfigs/web.ts +3 -19
  45. package/src/init-docs.ts +2 -1
  46. package/src/lib/abstractBase.ts +82 -80
  47. package/src/lib/basebuilder.ts +57 -45
  48. package/src/lib/classBuilder.ts +15 -15
  49. package/src/lib/core.ts +44 -35
  50. package/src/lib/index.ts +47 -98
  51. package/src/lib/readme.md +12 -0
  52. package/src/lib/types.ts +53 -70
  53. package/src/run.ts +31 -0
  54. package/src/style.css +8 -0
  55. package/src/utils.ts +74 -2
  56. package/tsc.log +108 -0
  57. package/Bundle.Dockerfile +0 -52
  58. package/bin/init-docs.js +0 -24
  59. package/dist/common/dist/module/src/Init.js +0 -40
  60. package/dist/common/package.json +0 -3
  61. package/dist/common/src/Init.js +0 -40
  62. package/dist/common/src/Node.js +0 -27
  63. package/dist/common/src/PM/index.js +0 -7
  64. package/dist/common/src/PM/main.js +0 -941
  65. package/dist/common/src/PM/node.js +0 -128
  66. package/dist/common/src/PM/web.js +0 -121
  67. package/dist/common/src/SubPackages/puppeteer.js +0 -21
  68. package/dist/common/src/SubPackages/react/component/node.js +0 -19
  69. package/dist/common/src/SubPackages/react/component/web.js +0 -19
  70. package/dist/common/src/SubPackages/react/jsx/index.js +0 -33
  71. package/dist/common/src/SubPackages/react/jsx/node.js +0 -10
  72. package/dist/common/src/SubPackages/react/jsx/web.js +0 -10
  73. package/dist/common/src/SubPackages/react-dom/component/node.js +0 -101
  74. package/dist/common/src/SubPackages/react-dom/component/web.js +0 -67
  75. package/dist/common/src/SubPackages/react-dom/jsx/index.js +0 -2
  76. package/dist/common/src/SubPackages/react-dom/jsx/node.js +0 -39
  77. package/dist/common/src/SubPackages/react-dom/jsx/web.js +0 -117
  78. package/dist/common/src/SubPackages/react-test-renderer/MemoExoticComponent/node.js +0 -44
  79. package/dist/common/src/SubPackages/react-test-renderer/component/index.js +0 -2
  80. package/dist/common/src/SubPackages/react-test-renderer/component/interface.js +0 -60
  81. package/dist/common/src/SubPackages/react-test-renderer/component/node.js +0 -8
  82. package/dist/common/src/SubPackages/react-test-renderer/component/web.js +0 -8
  83. package/dist/common/src/SubPackages/react-test-renderer/fc/node.js +0 -50
  84. package/dist/common/src/SubPackages/react-test-renderer/fc/web.js +0 -50
  85. package/dist/common/src/SubPackages/react-test-renderer/jsx/index.js +0 -63
  86. package/dist/common/src/SubPackages/react-test-renderer/jsx/node.js +0 -10
  87. package/dist/common/src/SubPackages/react-test-renderer/jsx/web.js +0 -10
  88. package/dist/common/src/SubPackages/react-test-renderer/jsx-promised/index.js +0 -42
  89. package/dist/common/src/SubPackages/react-test-renderer/jsx-promised/node.js +0 -10
  90. package/dist/common/src/SubPackages/react-test-renderer/jsx-promised/web.js +0 -10
  91. package/dist/common/src/Types.js +0 -2
  92. package/dist/common/src/Web.js +0 -49
  93. package/dist/common/src/cli.js +0 -439
  94. package/dist/common/src/cli2.js +0 -144
  95. package/dist/common/src/defaultConfig.js +0 -19
  96. package/dist/common/src/esbuildConfigs/featuresPlugin.js +0 -39
  97. package/dist/common/src/esbuildConfigs/index.js +0 -21
  98. package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +0 -99
  99. package/dist/common/src/esbuildConfigs/node.js +0 -45
  100. package/dist/common/src/esbuildConfigs/web.js +0 -61
  101. package/dist/common/src/init-docs.js +0 -43
  102. package/dist/common/src/lib/abstractBase.js +0 -324
  103. package/dist/common/src/lib/basebuilder.js +0 -85
  104. package/dist/common/src/lib/classBuilder.js +0 -42
  105. package/dist/common/src/lib/core.js +0 -101
  106. package/dist/common/src/lib/index.js +0 -22
  107. package/dist/common/src/lib/types.js +0 -3
  108. package/dist/common/src/puppeteerConfiger.js +0 -24
  109. package/dist/common/src/utils.js +0 -16
  110. package/dist/common/src/web.html.js +0 -22
  111. package/dist/common/testeranto.js +0 -15
  112. package/dist/common/tsconfig.common.tsbuildinfo +0 -1
  113. package/dist/module/package.json +0 -3
  114. package/dist/module/src/Init.js +0 -35
  115. package/dist/module/src/Node.js +0 -20
  116. package/dist/module/src/PM/index.js +0 -3
  117. package/dist/module/src/PM/main.js +0 -911
  118. package/dist/module/src/PM/node.js +0 -121
  119. package/dist/module/src/PM/web.js +0 -117
  120. package/dist/module/src/SubPackages/puppeteer.js +0 -16
  121. package/dist/module/src/SubPackages/react/component/node.js +0 -14
  122. package/dist/module/src/SubPackages/react/component/web.js +0 -14
  123. package/dist/module/src/SubPackages/react/jsx/index.js +0 -27
  124. package/dist/module/src/SubPackages/react/jsx/node.js +0 -5
  125. package/dist/module/src/SubPackages/react/jsx/web.js +0 -5
  126. package/dist/module/src/SubPackages/react-dom/component/node.js +0 -93
  127. package/dist/module/src/SubPackages/react-dom/component/web.js +0 -62
  128. package/dist/module/src/SubPackages/react-dom/jsx/index.js +0 -1
  129. package/dist/module/src/SubPackages/react-dom/jsx/node.js +0 -31
  130. package/dist/module/src/SubPackages/react-dom/jsx/web.js +0 -89
  131. package/dist/module/src/SubPackages/react-test-renderer/MemoExoticComponent/node.js +0 -16
  132. package/dist/module/src/SubPackages/react-test-renderer/component/index.js +0 -1
  133. package/dist/module/src/SubPackages/react-test-renderer/component/interface.js +0 -31
  134. package/dist/module/src/SubPackages/react-test-renderer/component/node.js +0 -3
  135. package/dist/module/src/SubPackages/react-test-renderer/component/web.js +0 -3
  136. package/dist/module/src/SubPackages/react-test-renderer/fc/node.js +0 -22
  137. package/dist/module/src/SubPackages/react-test-renderer/fc/web.js +0 -22
  138. package/dist/module/src/SubPackages/react-test-renderer/jsx/index.js +0 -34
  139. package/dist/module/src/SubPackages/react-test-renderer/jsx/node.js +0 -5
  140. package/dist/module/src/SubPackages/react-test-renderer/jsx/web.js +0 -5
  141. package/dist/module/src/SubPackages/react-test-renderer/jsx-promised/index.js +0 -16
  142. package/dist/module/src/SubPackages/react-test-renderer/jsx-promised/node.js +0 -5
  143. package/dist/module/src/SubPackages/react-test-renderer/jsx-promised/web.js +0 -5
  144. package/dist/module/src/Types.js +0 -1
  145. package/dist/module/src/Web.js +0 -42
  146. package/dist/module/src/cli.js +0 -411
  147. package/dist/module/src/cli2.js +0 -116
  148. package/dist/module/src/defaultConfig.js +0 -17
  149. package/dist/module/src/esbuildConfigs/featuresPlugin.js +0 -34
  150. package/dist/module/src/esbuildConfigs/index.js +0 -19
  151. package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +0 -94
  152. package/dist/module/src/esbuildConfigs/node.js +0 -40
  153. package/dist/module/src/esbuildConfigs/web.js +0 -56
  154. package/dist/module/src/init-docs.js +0 -15
  155. package/dist/module/src/lib/abstractBase.js +0 -316
  156. package/dist/module/src/lib/basebuilder.js +0 -81
  157. package/dist/module/src/lib/classBuilder.js +0 -38
  158. package/dist/module/src/lib/core.js +0 -98
  159. package/dist/module/src/lib/index.js +0 -18
  160. package/dist/module/src/lib/types.js +0 -2
  161. package/dist/module/src/puppeteerConfiger.js +0 -19
  162. package/dist/module/src/utils.js +0 -9
  163. package/dist/module/src/web.html.js +0 -20
  164. package/dist/module/testeranto.js +0 -13
  165. package/dist/module/tsconfig.module.tsbuildinfo +0 -1
  166. package/dist/prebuild/cli.mjs +0 -1491
  167. package/dist/prebuild/cli2.mjs +0 -918
  168. package/dist/prebuild/init-docs.mjs +0 -48
  169. package/dist/types/dist/module/src/Init.d.ts +0 -2
  170. package/dist/types/src/Init.d.ts +0 -2
  171. package/dist/types/src/Node.d.ts +0 -13
  172. package/dist/types/src/PM/index.d.ts +0 -34
  173. package/dist/types/src/PM/main.d.ts +0 -56
  174. package/dist/types/src/PM/node.d.ts +0 -42
  175. package/dist/types/src/PM/web.d.ts +0 -40
  176. package/dist/types/src/SubPackages/puppeteer.d.ts +0 -6
  177. package/dist/types/src/SubPackages/react/component/node.d.ts +0 -7
  178. package/dist/types/src/SubPackages/react/component/web.d.ts +0 -7
  179. package/dist/types/src/SubPackages/react/jsx/index.d.ts +0 -12
  180. package/dist/types/src/SubPackages/react/jsx/node.d.ts +0 -4
  181. package/dist/types/src/SubPackages/react/jsx/web.d.ts +0 -4
  182. package/dist/types/src/SubPackages/react-dom/component/node.d.ts +0 -12
  183. package/dist/types/src/SubPackages/react-dom/component/web.d.ts +0 -11
  184. package/dist/types/src/SubPackages/react-dom/jsx/index.d.ts +0 -7
  185. package/dist/types/src/SubPackages/react-dom/jsx/node.d.ts +0 -6
  186. package/dist/types/src/SubPackages/react-dom/jsx/web.d.ts +0 -5
  187. package/dist/types/src/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -5
  188. package/dist/types/src/SubPackages/react-test-renderer/component/index.d.ts +0 -13
  189. package/dist/types/src/SubPackages/react-test-renderer/component/interface.d.ts +0 -9
  190. package/dist/types/src/SubPackages/react-test-renderer/component/node.d.ts +0 -8
  191. package/dist/types/src/SubPackages/react-test-renderer/component/web.d.ts +0 -3
  192. package/dist/types/src/SubPackages/react-test-renderer/fc/node.d.ts +0 -8
  193. package/dist/types/src/SubPackages/react-test-renderer/fc/web.d.ts +0 -8
  194. package/dist/types/src/SubPackages/react-test-renderer/jsx/index.d.ts +0 -17
  195. package/dist/types/src/SubPackages/react-test-renderer/jsx/node.d.ts +0 -9
  196. package/dist/types/src/SubPackages/react-test-renderer/jsx/web.d.ts +0 -8
  197. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/index.d.ts +0 -16
  198. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/node.d.ts +0 -4
  199. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/web.d.ts +0 -4
  200. package/dist/types/src/Types.d.ts +0 -90
  201. package/dist/types/src/Web.d.ts +0 -10
  202. package/dist/types/src/cli.d.ts +0 -1
  203. package/dist/types/src/cli2.d.ts +0 -1
  204. package/dist/types/src/defaultConfig.d.ts +0 -3
  205. package/dist/types/src/esbuildConfigs/featuresPlugin.d.ts +0 -5
  206. package/dist/types/src/esbuildConfigs/index.d.ts +0 -4
  207. package/dist/types/src/esbuildConfigs/inputFilesPlugin.d.ts +0 -7
  208. package/dist/types/src/esbuildConfigs/node.d.ts +0 -4
  209. package/dist/types/src/esbuildConfigs/web.d.ts +0 -4
  210. package/dist/types/src/init-docs.d.ts +0 -1
  211. package/dist/types/src/lib/abstractBase.d.ts +0 -110
  212. package/dist/types/src/lib/basebuilder.d.ts +0 -27
  213. package/dist/types/src/lib/classBuilder.d.ts +0 -7
  214. package/dist/types/src/lib/core.d.ts +0 -8
  215. package/dist/types/src/lib/index.d.ts +0 -60
  216. package/dist/types/src/lib/types.d.ts +0 -40
  217. package/dist/types/src/puppeteerConfiger.d.ts +0 -4
  218. package/dist/types/src/utils.d.ts +0 -2
  219. package/dist/types/src/web.html.d.ts +0 -2
  220. package/dist/types/testeranto.d.ts +0 -16
  221. package/dist/types/tsconfig.types.tsbuildinfo +0 -1
  222. package/docker-compose.yml +0 -37
  223. package/src/SubPackages/puppeteer.ts +0 -51
  224. package/src/cli.ts +0 -535
  225. package/src/cli2.ts +0 -157
  226. package/testeranto.ts +0 -13
package/src/PM/main.ts CHANGED
@@ -1,5 +1,7 @@
1
+ import ts from "typescript";
2
+
1
3
  import { CdpPage, Page } from "puppeteer-core/lib/esm/puppeteer";
2
- import fs from "fs";
4
+ import fs, { watch } from "fs";
3
5
  import path from "path";
4
6
  import puppeteer, {
5
7
  Browser,
@@ -9,35 +11,121 @@ import puppeteer, {
9
11
  ScreenshotOptions,
10
12
  } from "puppeteer-core";
11
13
  import { PassThrough } from "stream";
12
- import crypto from "crypto";
13
-
14
- import { IBuiltConfig, IFinalResults, ITestTypes } from "../lib/types";
15
- import { ITLog } from "../lib/index.js";
14
+ import ansiC from "ansi-colors";
15
+ import crypto from "node:crypto";
16
+ import { ESLint } from "eslint";
17
+ import tsc from "tsc-prog";
18
+ import {
19
+ IBuiltConfig,
20
+ IFinalResults,
21
+ IRunnables,
22
+ ITestTypes,
23
+ ITLog,
24
+ } from "../lib/index.js";
25
+ import {
26
+ bddExitCodePather,
27
+ lintExitCodePather,
28
+ lintPather,
29
+ tscExitCodePather,
30
+ tscPather,
31
+ } from "../utils";
16
32
 
17
33
  import { PM } from "./index.js";
18
34
 
35
+ type IOutputs = Record<
36
+ string,
37
+ {
38
+ entryPoint: string;
39
+ inputs: Record<string, string>;
40
+ }
41
+ >;
42
+ const eslint = new ESLint();
43
+ const formatter = await eslint.loadFormatter(
44
+ "./node_modules/testeranto/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs"
45
+ );
46
+ const changes: Record<string, string> = {};
47
+ const fileHashes = {};
19
48
  const fileStreams3: fs.WriteStream[] = [];
20
-
21
49
  type IFPaths = string[];
22
-
23
50
  const fPaths: IFPaths = [];
24
-
25
51
  const files: Record<string, Set<string>> = {};
26
52
  const recorders: Record<string, ScreenRecorder> = {};
27
53
  const screenshots: Record<string, Promise<Uint8Array>[]> = {};
28
54
 
29
- const red = "\x1b[31m";
30
- const green = "\x1b[32m";
31
- const reset = "\x1b[0m"; // Resets to default color
55
+ async function fileHash(filePath, algorithm = "md5") {
56
+ return new Promise<string>((resolve, reject) => {
57
+ const hash = crypto.createHash(algorithm);
58
+ const fileStream = fs.createReadStream(filePath);
59
+
60
+ fileStream.on("data", (data) => {
61
+ hash.update(data);
62
+ });
63
+
64
+ fileStream.on("end", () => {
65
+ const fileHash = hash.digest("hex");
66
+ resolve(fileHash);
67
+ });
68
+
69
+ fileStream.on("error", (error) => {
70
+ reject(`Error reading file: ${error.message}`);
71
+ });
72
+ });
73
+ }
74
+
75
+ const getRunnables = (
76
+ tests: ITestTypes[],
77
+ payload = {
78
+ nodeEntryPoints: {},
79
+ webEntryPoints: {},
80
+ }
81
+ ): IRunnables => {
82
+ return tests.reduce((pt, cv, cndx, cry) => {
83
+ if (cv[1] === "node") {
84
+ pt.nodeEntryPoints[cv[0]] = path.resolve(
85
+ `./docs/node/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`
86
+ );
87
+ } else if (cv[1] === "web") {
88
+ pt.webEntryPoints[cv[0]] = path.resolve(
89
+ `./docs/web/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`
90
+ );
91
+ }
92
+
93
+ if (cv[3].length) {
94
+ getRunnables(cv[3], payload);
95
+ }
96
+
97
+ return pt;
98
+ }, payload as IRunnables);
99
+ };
32
100
 
33
101
  const statusMessagePretty = (failures: number, test: string) => {
34
102
  if (failures === 0) {
35
- console.log(green + `${test} completed successfully` + reset);
103
+ console.log(ansiC.green(ansiC.inverse(`> ${test} completed successfully`)));
36
104
  } else {
37
- console.log(red + `${test} failed ${failures} times` + reset);
105
+ console.log(ansiC.red(ansiC.inverse(`> ${test} failed ${failures} times`)));
38
106
  }
39
107
  };
40
108
 
109
+ async function writeFileAndCreateDir(filePath, data) {
110
+ const dirPath = path.dirname(filePath);
111
+
112
+ try {
113
+ await fs.promises.mkdir(dirPath, { recursive: true });
114
+ await fs.appendFileSync(filePath, data);
115
+ } catch (error) {
116
+ console.error(`Error writing file: ${error}`);
117
+ }
118
+ }
119
+
120
+ function isValidUrl(string) {
121
+ try {
122
+ new URL(string);
123
+ return true;
124
+ } catch (err) {
125
+ return false;
126
+ }
127
+ }
128
+
41
129
  export class PM_Main extends PM {
42
130
  browser: Browser;
43
131
 
@@ -45,21 +133,61 @@ export class PM_Main extends PM {
45
133
  configs: IBuiltConfig;
46
134
  ports: Record<number, boolean>;
47
135
  queue: any[];
48
- registry: Record<string, boolean>;
136
+
137
+ mode: "DEV" | "PROD";
138
+
139
+ bigBoard: Record<
140
+ string,
141
+ {
142
+ // status: "?" | "running" | "waiting";
143
+ runTimeError?: number | "?";
144
+ typeErrors?: number | "?";
145
+ staticErrors?: number | "?";
146
+ prompt?: string | "?";
147
+ }
148
+ > = {};
149
+ webMetafileWatcher: fs.FSWatcher;
150
+ nodeMetafileWatcher: fs.FSWatcher;
49
151
 
50
152
  constructor(configs: IBuiltConfig) {
51
153
  super();
154
+
155
+ this.mode = configs.devMode ? "DEV" : "PROD";
156
+
157
+ process.stdin.on("keypress", (str, key) => {
158
+ if (key.name === "q") {
159
+ console.log(
160
+ ansiC.inverse("Testeranto-Run is shutting down gracefully...")
161
+ );
162
+ this.mode = "PROD";
163
+ // onDone();
164
+ this.nodeMetafileWatcher.close();
165
+ this.webMetafileWatcher.close();
166
+ this.shutDown();
167
+ }
168
+ });
169
+
52
170
  this.server = {};
53
171
  this.configs = configs;
54
172
  this.ports = {};
55
- this.registry = {};
173
+
174
+ this.configs.tests.forEach(([t]) => {
175
+ this.bigBoard[t] = {
176
+ // status: "?",
177
+ runTimeError: "?",
178
+ typeErrors: "?",
179
+ staticErrors: "?",
180
+ prompt: "?",
181
+ };
182
+ });
183
+
56
184
  this.configs.ports.forEach((element) => {
57
185
  this.ports[element] = "true"; // set ports as open
58
186
  });
59
187
 
60
188
  globalThis["waitForSelector"] = async (pageKey: string, sel: string) => {
61
- console.log("waitForSelector", pageKey, sel);
62
189
  const page = (await this.browser.pages()).find(
190
+ /* @ts-ignore:next-line */
63
191
  (p) => p.mainFrame()._id === pageKey
64
192
  );
65
193
  await page?.waitForSelector(sel);
@@ -71,18 +199,16 @@ export class PM_Main extends PM {
71
199
 
72
200
  globalThis["closePage"] = async (pageKey) => {
73
201
  const page = (await this.browser.pages()).find(
202
+ /* @ts-ignore:next-line */
74
203
  (p) => p.mainFrame()._id === pageKey
75
204
  );
205
+ /* @ts-ignore:next-line */
76
206
  return page.close();
77
207
  };
78
208
 
79
- // globalThis["closePage"] = (p) => {
80
- // console.log("closePage", p);
81
- // return p.close();
82
- // };
83
-
84
209
  globalThis["goto"] = async (pageKey: string, url: string) => {
85
210
  const page = (await this.browser.pages()).find(
211
+ /* @ts-ignore:next-line */
86
212
  (p) => p.mainFrame()._id === pageKey
87
213
  );
88
214
  await page?.goto(url);
@@ -111,19 +237,9 @@ export class PM_Main extends PM {
111
237
  contents: string,
112
238
  testName: string
113
239
  ) => {
114
- // console.log(testName, "writeFileSync", filepath, testName);
115
-
116
- // Create directories if they don't exist
117
- const dir = path.dirname(filepath);
118
-
119
- // console.log(testName, "mkdirSync", dir);
120
-
121
- fs.mkdirSync(dir, {
240
+ fs.mkdirSync(path.dirname(filepath), {
122
241
  recursive: true,
123
242
  });
124
-
125
- // console.log(testName, "mkdirSync2");
126
-
127
243
  if (!files[testName]) {
128
244
  files[testName] = new Set();
129
245
  }
@@ -153,38 +269,13 @@ export class PM_Main extends PM {
153
269
  fileStreams3[uid].end();
154
270
  };
155
271
 
156
- // async (ssOpts: ScreenshotOptions, testName: string) => {
157
- // const p = ssOpts.path as string;
158
- // const dir = path.dirname(p);
159
- // fs.mkdirSync(dir, {
160
- // recursive: true,
161
- // });
162
- // if (!files[testName]) {
163
- // files[testName] = new Set();
164
- // }
165
- // files[testName].add(ssOpts.path as string);
166
-
167
- // const sPromise = page.screenshot({
168
- // ...ssOpts,
169
- // path: p,
170
- // });
171
-
172
- // if (!screenshots[testName]) {
173
- // screenshots[testName] = [];
174
- // }
175
- // screenshots[testName].push(sPromise);
176
- // // sPromise.then(())
177
- // await sPromise;
178
- // return sPromise;
179
- // // page.evaluate(`window["screenshot done"]`);
180
- // };
181
-
182
272
  globalThis["customScreenShot"] = async (
183
273
  opts: { path: string },
184
274
  pageKey: string,
185
275
  testName: string
186
276
  ) => {
187
277
  const page = (await this.browser.pages()).find(
278
+ /* @ts-ignore:next-line */
188
279
  (p) => p.mainFrame()._id === pageKey
189
280
  );
190
281
 
@@ -217,6 +308,7 @@ export class PM_Main extends PM {
217
308
  pageKey: string
218
309
  ) => {
219
310
  const page = (await this.browser.pages()).find(
311
+ /* @ts-ignore:next-line */
220
312
  (p) => p.mainFrame()._id === pageKey
221
313
  );
222
314
 
@@ -235,20 +327,18 @@ export class PM_Main extends PM {
235
327
 
236
328
  return opts.path;
237
329
  };
238
-
239
- // globalThis["customclose"] = (p: string, testName: string) => {
240
- // if (!files[testName]) {
241
- // files[testName] = new Set();
242
- // }
243
-
244
- // fs.writeFileSync(
245
- // p + "/manifest.json",
246
- // JSON.stringify(Array.from(files[testName]))
247
- // );
248
- // delete files[testName];
249
- // };
250
330
  }
251
331
 
332
+ filesHash = async (files: string[], algorithm = "md5") => {
333
+ return new Promise<string>((resolve, reject) => {
334
+ resolve(
335
+ files.reduce(async (mm: Promise<string>, f) => {
336
+ return (await mm) + (await fileHash(f));
337
+ }, Promise.resolve(""))
338
+ );
339
+ });
340
+ };
341
+
252
342
  customclose() {
253
343
  throw new Error("Method not implemented.");
254
344
  }
@@ -264,7 +354,6 @@ export class PM_Main extends PM {
264
354
  goto(p, url: string): any {
265
355
  throw new Error("Method not implemented.");
266
356
  }
267
-
268
357
  $(selector: string): boolean {
269
358
  throw new Error("Method not implemented.");
270
359
  }
@@ -274,11 +363,9 @@ export class PM_Main extends PM {
274
363
  customScreenShot(opts: object, cdpPage?: CdpPage) {
275
364
  throw new Error("Method not implemented.");
276
365
  }
277
-
278
366
  end(accessObject: { uid: number }): boolean {
279
367
  throw new Error("Method not implemented.");
280
368
  }
281
-
282
369
  existsSync(destFolder: string): boolean {
283
370
  return fs.existsSync(destFolder);
284
371
  }
@@ -372,7 +459,7 @@ export class PM_Main extends PM {
372
459
  getAttribute(selector: string, attribute: string) {
373
460
  throw new Error("Method not implemented.");
374
461
  }
375
- isDisabled(selector: string): boolean {
462
+ isDisabled(selector: string): Promise<boolean> {
376
463
  throw new Error("Method not implemented.");
377
464
  }
378
465
  screencastStop(s: string) {
@@ -380,47 +467,354 @@ export class PM_Main extends PM {
380
467
  }
381
468
  ////////////////////////////////////////////////////////////////////////////////
382
469
 
383
- async startPuppeteer(
384
- options: LaunchOptions,
385
- destfolder: string
386
- ): Promise<any> {
387
- this.browser = (await puppeteer.launch(options)) as any;
470
+ async metafileOutputs(platform: "web" | "node") {
471
+ const metafile = JSON.parse(
472
+ fs.readFileSync(`docs/${platform}/metafile.json`).toString()
473
+ ).metafile;
474
+
475
+ if (!metafile) return;
476
+
477
+ const outputs: IOutputs = metafile.outputs;
478
+
479
+ Object.keys(outputs).forEach(async (k) => {
480
+ const addableFiles = Object.keys(outputs[k].inputs).filter((i) => {
481
+ if (!fs.existsSync(i)) return false;
482
+ if (i.startsWith("node_modules")) return false;
483
+ return true;
484
+ });
485
+
486
+ const f = `${k.split(".").slice(0, -1).join(".")}/`;
487
+ if (!fs.existsSync(f)) {
488
+ fs.mkdirSync(f);
489
+ }
490
+
491
+ const entrypoint = outputs[k].entryPoint;
492
+
493
+ if (entrypoint) {
494
+ const changeDigest = await this.filesHash(addableFiles);
495
+
496
+ if (changeDigest === changes[entrypoint]) {
497
+ // skip
498
+ } else {
499
+ changes[entrypoint] = changeDigest;
500
+ this.tscCheck({
501
+ platform,
502
+ addableFiles,
503
+ entrypoint: "./" + entrypoint,
504
+ });
505
+ this.eslintCheck("./" + entrypoint, platform, addableFiles);
506
+ this.makePrompt("./" + entrypoint, addableFiles, platform);
507
+ }
508
+ }
509
+ });
388
510
  }
389
511
 
390
- ////////////////////////////////////////////////////////////////////////////////
512
+ async start(): Promise<any> {
513
+ this.browser = (await puppeteer.launch({
514
+ slowMo: 1,
515
+ // timeout: 1,
516
+ waitForInitialPage: false,
517
+ executablePath:
518
+ // process.env.CHROMIUM_PATH || "/opt/homebrew/bin/chromium",
519
+ "/opt/homebrew/bin/chromium",
520
+ headless: true,
521
+ dumpio: true,
522
+ // timeout: 0,
523
+ devtools: true,
524
+
525
+ args: [
526
+ "--auto-open-devtools-for-tabs",
527
+ `--remote-debugging-port=3234`,
528
+
529
+ // "--disable-features=IsolateOrigins,site-per-process",
530
+ "--disable-site-isolation-trials",
531
+ "--allow-insecure-localhost",
532
+ "--allow-file-access-from-files",
533
+ "--allow-running-insecure-content",
534
+
535
+ "--disable-dev-shm-usage",
536
+ "--disable-extensions",
537
+ "--disable-gpu",
538
+ "--disable-setuid-sandbox",
539
+ "--disable-site-isolation-trials",
540
+ "--disable-web-security",
541
+ "--no-first-run",
542
+ "--no-sandbox",
543
+ "--no-startup-window",
544
+ // "--no-zygote",
545
+ "--reduce-security-for-testing",
546
+ "--remote-allow-origins=*",
547
+ "--unsafely-treat-insecure-origin-as-secure=*",
548
+ // "--disable-features=IsolateOrigins",
549
+ // "--remote-allow-origins=ws://localhost:3234",
550
+ // "--single-process",
551
+ // "--unsafely-treat-insecure-origin-as-secure",
552
+ // "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
553
+
554
+ // "--disk-cache-dir=/dev/null",
555
+ // "--disk-cache-size=1",
556
+ // "--start-maximized",
557
+ ],
558
+ })) as any;
559
+
560
+ const { nodeEntryPoints, webEntryPoints } = getRunnables(
561
+ this.configs.tests
562
+ );
563
+
564
+ Object.entries(nodeEntryPoints).forEach(
565
+ ([k, outputFile]: [string, string]) => {
566
+ this.launchNode(k, outputFile);
567
+ try {
568
+ watch(outputFile, async (e, filename) => {
569
+ const hash = await fileHash(outputFile);
570
+ if (fileHashes[k] !== hash) {
571
+ fileHashes[k] = hash;
572
+ console.log(ansiC.green(ansiC.inverse(`< ${e} ${filename}`)));
573
+ this.launchNode(k, outputFile);
574
+ }
575
+ });
576
+ } catch (e) {
577
+ console.error(e);
578
+ }
579
+ }
580
+ );
581
+
582
+ Object.entries(webEntryPoints).forEach(
583
+ ([k, outputFile]: [string, string]) => {
584
+ this.launchWeb(k, outputFile);
585
+ watch(outputFile, async (e, filename) => {
586
+ const hash = await fileHash(outputFile);
587
+ if (fileHashes[k] !== hash) {
588
+ fileHashes[k] = hash;
589
+ console.log(ansiC.green(ansiC.inverse(`< ${e} ${filename}`)));
590
+ this.launchWeb(k, outputFile);
591
+ }
592
+ });
593
+ }
594
+ );
595
+
596
+ this.metafileOutputs("node");
597
+ this.nodeMetafileWatcher = watch(
598
+ "docs/node/metafile.json",
599
+ async (e, filename) => {
600
+ console.log(ansiC.green(ansiC.inverse(`< ${e} ${filename} (node)`)));
601
+ this.metafileOutputs("node");
602
+ }
603
+ );
604
+
605
+ this.metafileOutputs("web");
606
+ this.webMetafileWatcher = watch(
607
+ "docs/web/metafile.json",
608
+ async (e, filename) => {
609
+ console.log(ansiC.green(ansiC.inverse(`< ${e} ${filename} (web)`)));
610
+ this.metafileOutputs("web");
611
+ }
612
+ );
613
+ }
614
+
615
+ // goodbye = () => {
616
+ // this.browser.disconnect().then(() => {
617
+
618
+ // console.log("Goodbye");
619
+ // process.exit();
620
+ // });
621
+ // };
622
+
623
+ tscCheck = async ({
624
+ entrypoint,
625
+ addableFiles,
626
+ platform,
627
+ }: {
628
+ platform: "web" | "node";
629
+ entrypoint: string;
630
+ addableFiles: string[];
631
+ }) => {
632
+ console.log(ansiC.green(ansiC.inverse(`tsc < ${entrypoint}`)));
633
+ console.log(JSON.stringify(this.bigBoard));
634
+ this.bigBoard[entrypoint].typeErrors = "?";
635
+
636
+ const program = tsc.createProgramFromConfig({
637
+ basePath: process.cwd(), // always required, used for relative paths
638
+ configFilePath: "tsconfig.json", // config to inherit from (optional)
639
+ compilerOptions: {
640
+ rootDir: "src",
641
+ outDir: tscPather(entrypoint, platform),
642
+ // declaration: true,
643
+ // skipLibCheck: true,
644
+ noEmit: true,
645
+ },
646
+ include: addableFiles, //["src/**/*"],
647
+ // exclude: ["**/*.test.ts", "**/*.spec.ts"],
648
+ });
649
+ const tscPath = tscPather(entrypoint, platform);
650
+
651
+ let allDiagnostics = program.getSemanticDiagnostics();
652
+
653
+ const d: string[] = [];
654
+ allDiagnostics.forEach((diagnostic) => {
655
+ if (diagnostic.file) {
656
+ let { line, character } = ts.getLineAndCharacterOfPosition(
657
+ diagnostic.file,
658
+ diagnostic.start!
659
+ );
660
+ let message = ts.flattenDiagnosticMessageText(
661
+ diagnostic.messageText,
662
+ "\n"
663
+ );
664
+ d.push(
665
+ `${diagnostic.file.fileName} (${line + 1},${
666
+ character + 1
667
+ }): ${message}`
668
+ );
669
+ } else {
670
+ d.push(ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n"));
671
+ }
672
+ });
673
+
674
+ fs.writeFileSync(tscPath, d.join("\n"));
675
+ this.bigBoard[entrypoint].typeErrors = d.length;
676
+ if (this.shutdownMode) {
677
+ this.checkForShutdown();
678
+ }
679
+ // fs.writeFileSync(
680
+ // tscExitCodePather(entrypoint, platform),
681
+ // d.length.toString()
682
+ // );
683
+ };
684
+
685
+ eslintCheck = async (
686
+ entrypoint: string,
687
+ platform: "web" | "node",
688
+ addableFiles: string[]
689
+ ) => {
690
+ this.bigBoard[entrypoint].staticErrors = "?";
691
+ console.log(ansiC.green(ansiC.inverse(`eslint < ${entrypoint}`)));
692
+ const results = (await eslint.lintFiles(addableFiles))
693
+ .filter((r) => r.messages.length)
694
+ .filter((r) => {
695
+ return r.messages[0].ruleId !== null;
696
+ })
697
+ .map((r) => {
698
+ delete r.source;
699
+ return r;
700
+ });
701
+
702
+ fs.writeFileSync(
703
+ lintPather(entrypoint, platform),
704
+ await formatter.format(results)
705
+ );
706
+ this.bigBoard[entrypoint].staticErrors = results.length;
707
+ if (this.shutdownMode) {
708
+ this.checkForShutdown();
709
+ }
710
+ // fs.writeFileSync(
711
+ // lintExitCodePather(entrypoint, platform),
712
+ // results.length.toString()
713
+ // );
714
+ };
715
+
716
+ makePrompt = async (
717
+ entryPoint: string,
718
+ addableFiles: string[],
719
+ platform: "web" | "node"
720
+ ) => {
721
+ this.bigBoard[entryPoint].prompt = "?";
722
+ const promptPath = path.join(
723
+ "./docs/",
724
+ platform,
725
+ entryPoint.split(".").slice(0, -1).join("."),
726
+ `prompt.txt`
727
+ );
728
+
729
+ const testPaths = path.join(
730
+ "./docs/",
731
+ platform,
732
+ entryPoint.split(".").slice(0, -1).join("."),
733
+ `tests.json`
734
+ );
735
+
736
+ const featuresPath = path.join(
737
+ "./docs/",
738
+ platform,
739
+ entryPoint.split(".").slice(0, -1).join("."),
740
+ `featurePrompt.txt`
741
+ );
742
+
743
+ fs.writeFileSync(
744
+ promptPath,
745
+ `
746
+ ${addableFiles
747
+ .map((x) => {
748
+ return `/add ${x}`;
749
+ })
750
+ .join("\n")}
751
+
752
+ /read ${lintPather(entryPoint, platform)}
753
+ /read ${tscPather(entryPoint, platform)}
754
+ /read ${testPaths}
755
+
756
+ /load ${featuresPath}
757
+
758
+ /code Fix the failing tests described in ${testPaths}. Correct any type signature errors described in the files ${tscPather(
759
+ entryPoint,
760
+ platform
761
+ )}. Implement any method which throws "Function not implemented. Resolve the lint errors described in ${lintPather(
762
+ entryPoint,
763
+ platform
764
+ )}"
765
+ `
766
+ );
767
+ this.bigBoard[entryPoint].prompt =
768
+ "aider --model deepseek/deepseek-chat --load docs/web/./src/Rectangle/Rectangle.test.web/prompt.txt";
769
+ if (this.shutdownMode) {
770
+ this.checkForShutdown();
771
+ }
772
+ };
391
773
 
392
774
  shutDown() {
393
- console.log("shutting down...");
394
775
  this.shutdownMode = true;
395
776
  this.checkForShutdown();
396
777
  }
397
778
 
398
779
  checkForShutdown = () => {
399
780
  const anyRunning: boolean =
400
- Object.values(this.registry).filter((x) => x === false).length > 0;
781
+ Object.values(this.bigBoard).filter((x) => x.prompt === "?").length +
782
+ Object.values(this.bigBoard).filter((x) => x.runTimeError === "?")
783
+ .length +
784
+ Object.values(this.bigBoard).filter((x) => x.staticErrors === "?")
785
+ .length +
786
+ Object.values(this.bigBoard).filter((x) => x.typeErrors === "?")
787
+ .length >
788
+ 0;
401
789
  if (anyRunning) {
790
+ console.log(ansiC.inverse("Shutting down. Please wait"));
402
791
  } else {
403
792
  this.browser.disconnect().then(() => {
404
- console.log("Goodbye");
793
+ fs.writeFileSync(
794
+ "docs/summary.json",
795
+ JSON.stringify(this.bigBoard, null, 2)
796
+ );
797
+ console.log(ansiC.inverse("Goodbye"));
405
798
  process.exit();
406
799
  });
407
800
  }
408
801
  };
409
802
 
410
- register = (src: string) => {
411
- this.registry[src] = false;
803
+ testIsNowRunning = (src: string) => {
804
+ this.bigBoard[src].status = "running";
412
805
  };
413
806
 
414
- deregister = (src: string) => {
415
- this.registry[src] = true;
807
+ testIsNowDone = (src: string) => {
808
+ this.bigBoard[src].status = "waiting";
416
809
  if (this.shutdownMode) {
417
810
  this.checkForShutdown();
418
811
  }
419
812
  };
420
813
 
421
814
  launchNode = async (src: string, dest: string) => {
422
- console.log("! node", src);
423
- this.register(src);
815
+ // console.log(ansiC.yellow(`! node, ${src}`));
816
+ console.log(ansiC.green(ansiC.inverse(`! node, ${src}`)));
817
+ this.testIsNowRunning(src);
424
818
 
425
819
  const destFolder = dest.replace(".mjs", "");
426
820
 
@@ -431,7 +825,7 @@ export class PM_Main extends PM {
431
825
  });
432
826
 
433
827
  if (!testConfig) {
434
- console.error("missing test config");
828
+ console.log(ansiC.inverse("missing test config! Exiting ungracefully!"));
435
829
  process.exit(-1);
436
830
  }
437
831
  const testConfigResource = testConfig[2];
@@ -510,13 +904,15 @@ export class PM_Main extends PM {
510
904
  this.receiveFeatures(features, destFolder, src);
511
905
  // console.log(`${src} completed with ${failed} errors`);
512
906
  statusMessagePretty(failed, src);
907
+ this.receiveExitCode(src, failed);
513
908
  })
514
909
  .catch((e) => {
515
- console.log(`${src} errored with`, e);
910
+ console.log(ansiC.red(ansiC.inverse(`${src} errored with: ${e}`)));
911
+ // console.log(reset, `${src} errored with`, e);
516
912
  })
517
913
  .finally(() => {
518
914
  webSideCares.forEach((webSideCar) => webSideCar.close());
519
- this.deregister(src);
915
+ this.testIsNowDone(src);
520
916
  });
521
917
  });
522
918
  });
@@ -535,14 +931,8 @@ export class PM_Main extends PM {
535
931
  testConfig: ITestTypes
536
932
  ): Promise<Page> => {
537
933
  const d = dest + ".mjs";
538
- console.log("launchWebSideCar", src, dest, d);
539
- const destFolder = dest.replace(".mjs", "");
540
- // const webArgz = JSON.stringify({
541
- // name: dest,
542
- // ports: [].toString(),
543
- // fs: destFolder,
544
- // browserWSEndpoint: this.browser.wsEndpoint(),
545
- // });
934
+
935
+ console.log(ansiC.green(ansiC.inverse(`launchWebSideCar ${src}`)));
546
936
 
547
937
  const fileStreams2: fs.WriteStream[] = [];
548
938
  const doneFileStream2: Promise<any>[] = [];
@@ -673,6 +1063,7 @@ export class PM_Main extends PM {
673
1063
  })
674
1064
  .then(async (page) => {
675
1065
  await page.goto(`file://${`${dest}.html`}`, {});
1066
+
676
1067
  res(page);
677
1068
  });
678
1069
  });
@@ -684,7 +1075,7 @@ export class PM_Main extends PM {
684
1075
  testConfig: ITestTypes
685
1076
  ) => {
686
1077
  const d = dest + ".mjs";
687
- console.log("launchNodeSideCar", src, dest, d);
1078
+ console.log(ansiC.green(ansiC.inverse(`launchNodeSideCar ${src}`)));
688
1079
 
689
1080
  const destFolder = dest.replace(".mjs", "");
690
1081
 
@@ -732,10 +1123,6 @@ export class PM_Main extends PM {
732
1123
 
733
1124
  const builtfile = dest + ".mjs";
734
1125
 
735
- // console.log(
736
- // "node builtfile",
737
- // (await import(`${builtfile}?cacheBust=${Date.now()}`)).default
738
- // );
739
1126
  this.server[builtfile] = await import(
740
1127
  `${builtfile}?cacheBust=${Date.now()}`
741
1128
  ).then((module) => {
@@ -757,7 +1144,6 @@ export class PM_Main extends PM {
757
1144
  });
758
1145
  });
759
1146
 
760
- // console.log("portsToUse", portsToUse);
761
1147
  for (let i = 0; i <= portsToUse.length; i++) {
762
1148
  if (portsToUse[i]) {
763
1149
  this.ports[portsToUse[i]] = "true"; //port is open again
@@ -766,8 +1152,9 @@ export class PM_Main extends PM {
766
1152
  };
767
1153
 
768
1154
  launchWeb = (t: string, dest: string) => {
769
- console.log("! web", t);
770
- this.register(t);
1155
+ // console.log(green, "! web", t);
1156
+ console.log(ansiC.green(ansiC.inverse(`! web ${t}`)));
1157
+ this.testIsNowRunning(t);
771
1158
 
772
1159
  // sidecars.map((sidecar) => {
773
1160
  // if (sidecar[1] === "node") {
@@ -791,9 +1178,9 @@ export class PM_Main extends PM {
791
1178
  const d = `${dest}?cacheBust=${Date.now()}`;
792
1179
 
793
1180
  const evaluation = `
794
- console.log("importing ${d}");
1181
+
795
1182
  import('${d}').then(async (x) => {
796
- console.log("imported", (await x.default));
1183
+
797
1184
  try {
798
1185
  return await (await x.default).receiveTestResourceConfig(${webArgz})
799
1186
  } catch (e) {
@@ -982,7 +1369,7 @@ export class PM_Main extends PM {
982
1369
  // });
983
1370
 
984
1371
  page.exposeFunction("page", () => {
985
- return page.mainFrame()._id;
1372
+ return (page.mainFrame() as unknown as { _id: string })._id;
986
1373
  });
987
1374
 
988
1375
  page.exposeFunction("click", (sel) => {
@@ -1048,7 +1435,7 @@ export class PM_Main extends PM {
1048
1435
  delete screenshots[t];
1049
1436
  page.close();
1050
1437
 
1051
- this.deregister(t);
1438
+ this.testIsNowDone(t);
1052
1439
  stderrStream.close();
1053
1440
  stdoutStream.close();
1054
1441
  });
@@ -1070,7 +1457,7 @@ export class PM_Main extends PM {
1070
1457
 
1071
1458
  console.debug(`Error from message ${t}: [${err.message}] `);
1072
1459
  stderrStream.write(err.message);
1073
- // close();
1460
+ close();
1074
1461
  });
1075
1462
  page.on("console", (log: ConsoleMessage) => {
1076
1463
  // console.debug(`Log from ${t}: [${log.text()}] `);
@@ -1090,11 +1477,14 @@ export class PM_Main extends PM {
1090
1477
  this.receiveFeatures(features, destFolder, t);
1091
1478
  // console.log(`${t} completed with ${failed} errors`);
1092
1479
  statusMessagePretty(failed, t);
1480
+ this.receiveExitCode(t, failed);
1093
1481
  })
1094
1482
  .catch((e) => {
1095
- console.log(`${t} errored with`, e);
1483
+ // console.log(red, `${t} errored with`, e);
1484
+ console.log(ansiC.red(ansiC.inverse(`${t} errored with: ${e}`)));
1096
1485
  })
1097
1486
  .finally(() => {
1487
+ // this.testIsNowDone(t);
1098
1488
  close();
1099
1489
  });
1100
1490
 
@@ -1141,13 +1531,13 @@ export class PM_Main extends PM {
1141
1531
  }
1142
1532
  }
1143
1533
 
1144
- fs.symlink(u.pathname, newPath, (err) => {
1145
- if (err) {
1146
- // console.error("Error creating symlink:", err);
1147
- } else {
1148
- // console.log("Symlink created successfully");
1149
- }
1150
- });
1534
+ // fs.symlink(u.pathname, newPath, (err) => {
1535
+ // if (err) {
1536
+ // // console.error("Error creating symlink:", err);
1537
+ // } else {
1538
+ // // console.log("Symlink created successfully");
1539
+ // }
1540
+ // });
1151
1541
  accum.files.push(newPath);
1152
1542
  } else if (u.protocol === "http:" || u.protocol === "https:") {
1153
1543
  const newPath = `${process.cwd()}/docs/features/external${
@@ -1161,13 +1551,7 @@ export class PM_Main extends PM {
1161
1551
  await fs.promises.mkdir(path.dirname(featureDestination), {
1162
1552
  recursive: true,
1163
1553
  });
1164
- // const newPath = `${process.cwd()}/docs/features/plain/${await sha256(
1165
- // featureStringKey
1166
- // )}`;
1167
- // writeFileAndCreateDir(
1168
- // `${featureDestination}/${await sha256(featureStringKey)}`,
1169
- // featureStringKey
1170
- // );
1554
+
1171
1555
  accum.strings.push(featureStringKey);
1172
1556
  }
1173
1557
 
@@ -1186,35 +1570,19 @@ export class PM_Main extends PM {
1186
1570
  .join("\n")
1187
1571
  );
1188
1572
  });
1189
- };
1190
- }
1191
1573
 
1192
- async function writeFileAndCreateDir(filePath, data) {
1193
- const dirPath = path.dirname(filePath);
1194
-
1195
- try {
1196
- await fs.promises.mkdir(dirPath, { recursive: true });
1197
- await fs.appendFileSync(filePath, data);
1198
- } catch (error) {
1199
- console.error(`Error writing file: ${error}`);
1200
- }
1201
- }
1202
-
1203
- async function sha256(rawData) {
1204
- const data =
1205
- typeof rawData === "object" ? JSON.stringify(rawData) : String(rawData);
1574
+ // this.writeBigBoard();
1575
+ };
1206
1576
 
1207
- const msgBuffer = new TextEncoder().encode(data);
1208
- const hashBuffer = await crypto.subtle.digest("SHA-256", msgBuffer);
1209
- const hashArray = Array.from(new Uint8Array(hashBuffer));
1210
- return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
1211
- }
1577
+ receiveExitCode = (srcTest: string, failures: number) => {
1578
+ this.bigBoard[srcTest].runTimeError = failures;
1579
+ this.writeBigBoard();
1580
+ };
1212
1581
 
1213
- function isValidUrl(string) {
1214
- try {
1215
- new URL(string);
1216
- return true;
1217
- } catch (err) {
1218
- return false;
1219
- }
1582
+ writeBigBoard = () => {
1583
+ fs.writeFileSync(
1584
+ "./docs/summary.json",
1585
+ JSON.stringify(this.bigBoard, null, 2)
1586
+ );
1587
+ };
1220
1588
  }