testeranto 0.80.0 → 0.81.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 (50) hide show
  1. package/.aider.chat.history.md +980 -0
  2. package/.aider.input.history +87 -0
  3. package/.aider.tags.cache.v3/1c/30/af1de2ad7a137afeddb1b01e0c27.val +0 -0
  4. package/.aider.tags.cache.v3/1d/63/88318b65ce58b6bb0487e8ce2656.val +0 -0
  5. package/.aider.tags.cache.v3/2e/67/16ae65530b40038e48e00d666c63.val +0 -0
  6. package/.aider.tags.cache.v3/6f/94/80488a232866fcce7ee657da488b.val +0 -0
  7. package/.aider.tags.cache.v3/cache.db +0 -0
  8. package/README.md +10 -6
  9. package/dist/common/src/Aider.js +116 -69
  10. package/dist/common/src/PM/main.js +49 -46
  11. package/dist/common/src/PM/node.js +1 -1
  12. package/dist/common/src/Project.js +46 -38
  13. package/dist/common/src/Puppeteer.js +44 -37
  14. package/dist/common/src/SubPackages/react-test-renderer/jsx/index.js +17 -2
  15. package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +39 -12
  16. package/dist/common/src/esbuildConfigs/web.js +3 -3
  17. package/dist/common/src/lib/abstractBase.js +41 -13
  18. package/dist/common/src/lib/basebuilder.js +6 -3
  19. package/dist/common/src/lib/core.js +47 -3
  20. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  21. package/dist/module/src/Aider.js +116 -69
  22. package/dist/module/src/PM/main.js +49 -46
  23. package/dist/module/src/PM/node.js +1 -1
  24. package/dist/module/src/Project.js +46 -38
  25. package/dist/module/src/Puppeteer.js +44 -37
  26. package/dist/module/src/SubPackages/react-test-renderer/jsx/index.js +17 -2
  27. package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +39 -12
  28. package/dist/module/src/esbuildConfigs/web.js +3 -3
  29. package/dist/module/src/lib/abstractBase.js +41 -13
  30. package/dist/module/src/lib/basebuilder.js +6 -3
  31. package/dist/module/src/lib/core.js +47 -3
  32. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  33. package/dist/types/src/PM/main.d.ts +7 -1
  34. package/dist/types/src/Project.d.ts +6 -1
  35. package/dist/types/src/lib/abstractBase.d.ts +1 -0
  36. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  37. package/package.json +10 -14
  38. package/secret +1 -0
  39. package/secret.env +2 -0
  40. package/src/Aider.ts +140 -97
  41. package/src/PM/main.ts +60 -56
  42. package/src/PM/node.ts +1 -1
  43. package/src/Project.ts +55 -48
  44. package/src/Puppeteer.ts +56 -49
  45. package/src/SubPackages/react-test-renderer/jsx/index.ts +25 -2
  46. package/src/esbuildConfigs/inputFilesPlugin.ts +77 -32
  47. package/src/esbuildConfigs/web.ts +3 -3
  48. package/src/lib/abstractBase.ts +48 -17
  49. package/src/lib/basebuilder.ts +8 -3
  50. package/src/lib/core.ts +55 -13
@@ -0,0 +1,87 @@
1
+
2
+ # 2025-03-02 06:47:48.104216
3
+ +y
4
+
5
+ # 2025-03-02 06:51:16.536602
6
+ +make a text file with a filename which is also a fruit
7
+
8
+ # 2025-03-02 06:53:21.037663
9
+ +make a text file in the root of the repo with a filename which is also a fruit
10
+
11
+ # 2025-03-02 06:53:53.958525
12
+ +y
13
+
14
+ # 2025-03-02 07:06:36.699284
15
+ +aider src/LoginButton.tsx
16
+
17
+ # 2025-03-02 07:06:40.633909
18
+ +y
19
+
20
+ # 2025-03-02 07:09:52.770402
21
+ +docs/web/src/LoginButton.test/log.txt
22
+
23
+ # 2025-03-02 07:09:54.976990
24
+ +y
25
+
26
+ # 2025-03-02 07:30:48.606018
27
+ +n
28
+
29
+ # 2025-03-02 07:46:19.985990
30
+ +fix this bug
31
+
32
+ # 2025-03-02 07:46:19.986163
33
+ +fix this bug
34
+
35
+ # 2025-03-02 08:01:01.656853
36
+ +d
37
+
38
+ # 2025-03-02 11:28:10.700252
39
+ +0:{"name":"my first feature","body":"Initialize the project. Create a new git repo and yarn package"}
40
+
41
+ # 2025-03-02 11:28:10.700442
42
+ +0:{"name":"my first feature","body":"Initialize the project. Create a new git repo and yarn package"}
43
+
44
+ # 2025-03-02 11:30:08.411326
45
+ +0:{"name":"my first feature","body":"Initialize the project. Create a new git repo and yarn package"}
46
+
47
+ # 2025-03-02 11:30:08.411515
48
+ +0:{"name":"my first feature","body":"Initialize the project. Create a new git repo and yarn package"}
49
+
50
+ # 2025-03-02 11:30:38.350786
51
+ +0:{"name":"my first feature","body":"Initialize the project. Create a new git repo and yarn package"}
52
+
53
+ # 2025-03-02 11:30:38.350951
54
+ +0:{"name":"my first feature","body":"Initialize the project. Create a new git repo and yarn package"}
55
+
56
+ # 2025-03-02 11:30:46.645487
57
+ +0:{"name":"my first feature","body":"Initialize the project. Create a new git repo and yarn package"}
58
+
59
+ # 2025-03-02 11:30:46.645711
60
+ +0:{"name":"my first feature","body":"Initialize the project. Create a new git repo and yarn package"}
61
+
62
+ # 2025-03-02 11:32:12.271324
63
+ +n
64
+
65
+ # 2025-03-02 11:35:00.822199
66
+ +0:{"name":"my first feature","body":"Initialize the project. Create a new git repo and yarn package"}
67
+
68
+ # 2025-03-02 11:35:00.822378
69
+ +0:{"name":"my first feature","body":"Initialize the project. Create a new git repo and yarn package"}
70
+
71
+ # 2025-03-02 11:38:40.364494
72
+ +Fix the failing tests
73
+
74
+ # 2025-03-02 11:38:40.364761
75
+ +Fix the failing tests
76
+
77
+ # 2025-03-02 11:47:31.505518
78
+ +"Fix
79
+
80
+ # 2025-03-02 11:47:31.505814
81
+ +"Fix
82
+
83
+ # 2025-03-02 11:50:27.903159
84
+ +"Fix
85
+
86
+ # 2025-03-02 11:50:27.903469
87
+ +"Fix
Binary file
package/README.md CHANGED
@@ -12,13 +12,17 @@ dev: [github.dev/adamwong246/testeranto](https://github.dev/adamwong246/testeran
12
12
 
13
13
  example repo: [kokomo bay](https://github.com/ChromaPDX/kokomoBay)
14
14
 
15
- ## about
15
+ ## Demo
16
16
 
17
- 1. Testeranto.ts an AI-first, Acceptance Test Driven Development ([ATDD](https://en.wikipedia.org/wiki/Acceptance_test-driven_development)) framework for typescript.
18
- 2. Testeranto includes a library of common patterns to help write your tests and a test runner to schedule the tests.
19
- 3. Testeranto tests are specified in a strongly-typed gherkin-like syntax. Rather than testing your code directly, Testeranto requires you wrap your code with a semantic interface which is based on TS type signatures. These interfaces can be shared and your code is tested through the gherkin-ish directives provided by that interface.
20
- 4. Testeranto can be run in the browser frontend or the node backend, or both, and Testeranto can be used to test _anything_ that can be bundled with esbuild. Testeranto leverages puppeteer to provide both of these runtimes.
21
- 5. Testeranto produces test results which can be fed to Aider.ai to automatically fix failing tests
17
+ <video src="demo.mov" width="1200" height="600" controls></video>
18
+
19
+ ## What is testeranto?
20
+
21
+ - Testeranto.ts an AI-first, Acceptance Test Driven Development ([ATDD](https://en.wikipedia.org/wiki/Acceptance_test-driven_development)) framework for typescript projects.
22
+ - Testeranto produces test results which can be fed to Aider.ai to automatically fix failing tests.
23
+ - Testeranto tests are specified in a strongly-typed gherkin-like syntax. Rather than testing your code directly, Testeranto requires you wrap your code with a semantic interface which is based on TS type signatures.
24
+ - Testeranto can be run in the frontend or the backend, or both.
25
+ - Testeranto can be used to test anything that can be bundled with esbuild.
22
26
 
23
27
  ## tech of note
24
28
 
@@ -7,27 +7,39 @@ exports.execCommand = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
8
  const child_process_1 = require("child_process");
9
9
  const execCommand = async (command) => {
10
- return new Promise((resolve, reject) => {
11
- const [cmd, ...args] = command.split(" ");
12
- const childProcess = (0, child_process_1.spawn)(cmd, args);
13
- childProcess.stdout.on("data", (data) => {
14
- process.stdout.write(data.toString());
15
- });
16
- childProcess.stderr.on("data", (data) => {
17
- process.stderr.write(data.toString());
18
- });
19
- childProcess.on("error", (error) => {
20
- reject(error);
21
- });
22
- childProcess.on("exit", (code) => {
23
- if (code === 0) {
24
- resolve();
25
- }
26
- else {
27
- reject(new Error(`Command exited with code ${code}.`));
28
- }
29
- });
10
+ const ls = (0, child_process_1.spawn)(command.split(" ")[0], command.split(" ").slice(1, -1));
11
+ process.stdin.pipe(ls.stdin);
12
+ ls.stdout.pipe(process.stdout);
13
+ ls.stderr.pipe(process.stdout);
14
+ // ls.stdout.on("data", function (data) {
15
+ // console.log("stdout: " + data.toString());
16
+ // });
17
+ // ls.stderr.on("data", function (data) {
18
+ // console.log("stderr: " + data.toString());
19
+ // });
20
+ ls.on("exit", function (code) {
21
+ console.log("child process exited with code " + (code === null || code === void 0 ? void 0 : code.toString()) || -1);
30
22
  });
23
+ // return new Promise<void>((resolve, reject) => {
24
+ // const [cmd, ...args] = command.split(" ");
25
+ // const childProcess = spawn(cmd, args);
26
+ // childProcess.stdout.on("data", (data) => {
27
+ // process.stdout.write(data.toString());
28
+ // });
29
+ // childProcess.stderr.on("data", (data) => {
30
+ // process.stderr.write(data.toString());
31
+ // });
32
+ // childProcess.on("error", (error) => {
33
+ // reject(error);
34
+ // });
35
+ // childProcess.on("exit", (code) => {
36
+ // if (code === 0) {
37
+ // resolve();
38
+ // } else {
39
+ // reject(new Error(`Command exited with code ${code}.`));
40
+ // }
41
+ // });
42
+ // });
31
43
  };
32
44
  exports.execCommand = execCommand;
33
45
  const key = process.argv[2];
@@ -38,55 +50,90 @@ console.log("exitcode", exitcode);
38
50
  if (exitcode != "0") {
39
51
  const inputFiles = JSON.parse(fs_1.default.readFileSync(`${key}/inputFiles.json`).toString());
40
52
  inputFiles.push(`${key}/tests.json`);
41
- const features = await (await Promise.all(Array.from(new Set(JSON.parse(fs_1.default.readFileSync(`${key}/tests.json`).toString())
42
- .givens.reduce((mm, lm) => {
43
- mm.push(lm.features.reduce((mm2, lm2) => {
44
- mm2.push(lm2);
45
- return mm2;
46
- }, []));
47
- return mm;
48
- }, [])
49
- .flat()
50
- .flat()))))
51
- .reduce(async (mm, feature) => {
52
- const req = await octokit.request(`GET /repos/adamwong246/kokomobay-taskman/contents/Task/${feature}.json`, {
53
- owner: "adamwong246",
54
- repo: "kokomoBay-taskman",
55
- path: `Task/${feature}.json`,
56
- headers: {
57
- "X-GitHub-Api-Version": "2022-11-28",
58
- },
59
- });
60
- const j = JSON.parse(atob(req.data.content));
61
- (await mm).push([
62
- feature,
63
- JSON.stringify({
64
- name: j.name,
65
- body: j.body,
66
- }),
67
- ]);
68
- return mm;
69
- }, Promise.resolve([]))
70
- .then((z) => {
71
- const final = z.reduce((mm, [k, v], ndx) => {
72
- mm[k] = v;
73
- return mm;
74
- }, {});
75
- const as = JSON.stringify(final);
76
- fs_1.default.writeFile(`./${key}/features.json`, as, () => {
77
- inputFiles.push(`./${key}/features.json`);
78
- const scriptCommand = `aider --model deepseek --api-key deepseek=${process.env.DEEPSEEK_KEY} --message "Fix the failing tests" ${inputFiles.join(" ")}`;
79
- console.log("scriptCommand", scriptCommand);
80
- (0, exports.execCommand)(scriptCommand);
81
- // itermTab(scriptCommand).then(() => console.log("yay"));
82
- // const child = spawn("xterm -e", scriptCommand.split(" "), {
83
- // detached: true,
84
- // stdio: "ignore",
85
- // });
86
- // runCommandInITerm(scriptCommand);
87
- });
88
- //
89
- });
53
+ // const features = await await Promise.all(
54
+ // Array.from(
55
+ // new Set(
56
+ // JSON.parse(fs.readFileSync(`${key}/tests.json`).toString())
57
+ // .givens.reduce((mm: any[], lm: { features: any[] }) => {
58
+ // mm.push(
59
+ // lm.features.reduce((mm2: any[], lm2: any) => {
60
+ // mm2.push(lm2);
61
+ // return mm2;
62
+ // }, [])
63
+ // );
64
+ // return mm;
65
+ // }, [])
66
+ // .flat()
67
+ // .flat()
68
+ // )
69
+ // ) as string[]
70
+ // );
71
+ // const final = features.reduce((mm, [k, v], ndx) => {
72
+ // mm[k] = v;
73
+ // return mm;
74
+ // }, {});
75
+ // const as = JSON.stringify(final);
76
+ // const scriptCommand = `aider --model deepseek --api-key deepseek=${
77
+ // process.env.DEEPSEEK_KEY
78
+ // } --message "Fix the failing tests" --read ${key}/inputFiles.json ${inputFiles
79
+ // .map((i) => `--file ${i}`)
80
+ // .join(" ")}`;
81
+ const scriptCommand = `aider --message "Fix the failing tests" --model deepseek --api-key deepseek=${process.env.DEEPSEEK_KEY} --file ./${inputFiles.join(" ./")}`;
82
+ console.log("scriptCommand", scriptCommand);
83
+ (0, exports.execCommand)(scriptCommand);
84
+ // fs.writeFile(`./${key}/features.json`, as, () => {
85
+ // inputFiles.push(`./${key}/features.json`);
86
+ // // itermTab(scriptCommand).then(() => console.log("yay"));
87
+ // // const child = spawn("xterm -e", scriptCommand.split(" "), {
88
+ // // detached: true,
89
+ // // stdio: "ignore",
90
+ // // });
91
+ // // runCommandInITerm(scriptCommand);
92
+ // });
93
+ // .reduce(async (mm, feature) => {
94
+ // const req = await octokit.request(
95
+ // `GET /repos/adamwong246/kokomobay-taskman/contents/Task/${feature}.json`,
96
+ // {
97
+ // owner: "adamwong246",
98
+ // repo: "kokomoBay-taskman",
99
+ // path: `Task/${feature}.json`,
100
+ // headers: {
101
+ // "X-GitHub-Api-Version": "2022-11-28",
102
+ // },
103
+ // }
104
+ // );
105
+ // const j = JSON.parse(atob(req.data.content));
106
+ // (await mm).push([
107
+ // feature,
108
+ // JSON.stringify({
109
+ // name: j.name,
110
+ // body: j.body,
111
+ // }),
112
+ // ]);
113
+ // return mm;
114
+ // }, Promise.resolve<[string, string][]>([]))
115
+ // .then((z) => {
116
+ // const final = z.reduce((mm, [k, v], ndx) => {
117
+ // mm[k] = v;
118
+ // return mm;
119
+ // }, {});
120
+ // const as = JSON.stringify(final);
121
+ // fs.writeFile(`./${key}/features.json`, as, () => {
122
+ // inputFiles.push(`./${key}/features.json`);
123
+ // const scriptCommand = `aider --model deepseek --api-key deepseek=${
124
+ // process.env.DEEPSEEK_KEY
125
+ // } --message "Fix the failing tests" ${inputFiles.join(" ")}`;
126
+ // console.log("scriptCommand", scriptCommand);
127
+ // execCommand(scriptCommand);
128
+ // // itermTab(scriptCommand).then(() => console.log("yay"));
129
+ // // const child = spawn("xterm -e", scriptCommand.split(" "), {
130
+ // // detached: true,
131
+ // // stdio: "ignore",
132
+ // // });
133
+ // // runCommandInITerm(scriptCommand);
134
+ // });
135
+ // //
136
+ // });
90
137
  // features.then((x) => {
91
138
  // console.log("done", x);
92
139
  // });
@@ -39,8 +39,32 @@ const screenshots = {};
39
39
  class PM_Main extends index_js_1.PM {
40
40
  constructor(configs) {
41
41
  super();
42
+ this.shutdownMode = false;
43
+ this.checkForShutdown = () => {
44
+ const anyRunning = Object.values(this.registry).filter((x) => x === false).length > 0;
45
+ if (anyRunning) {
46
+ }
47
+ else {
48
+ this.browser.disconnect().then(() => {
49
+ console.log("Goodbye");
50
+ process.exit();
51
+ });
52
+ }
53
+ };
54
+ this.register = (src) => {
55
+ // console.log("register", src);
56
+ this.registry[src] = false;
57
+ };
58
+ this.deregister = (src) => {
59
+ // console.log("deregister", src, this.shutdownMode);
60
+ this.registry[src] = true;
61
+ if (this.shutdownMode) {
62
+ this.checkForShutdown();
63
+ }
64
+ };
42
65
  this.launchNode = async (src, dest) => {
43
66
  console.log("launchNode", src);
67
+ this.register(src);
44
68
  const destFolder = dest.replace(".mjs", "");
45
69
  let argz = "";
46
70
  const testConfig = this.configs.tests.find((t) => {
@@ -63,7 +87,6 @@ class PM_Main extends index_js_1.PM {
63
87
  }
64
88
  else if (testConfigResource.ports > 0) {
65
89
  const openPorts = Object.entries(this.ports).filter(([portnumber, portopen]) => portopen);
66
- console.log("openPorts", openPorts);
67
90
  if (openPorts.length >= testConfigResource.ports) {
68
91
  for (let i = 0; i < testConfigResource.ports; i++) {
69
92
  portsToUse.push(openPorts[i][0]);
@@ -100,16 +123,15 @@ class PM_Main extends index_js_1.PM {
100
123
  return module.default.then((defaultModule) => {
101
124
  defaultModule
102
125
  .receiveTestResourceConfig(argz)
103
- .then((x) => {
104
- console.log("then", x);
105
- return x;
106
- })
107
126
  .catch((e) => {
108
127
  console.log("catch", e);
128
+ })
129
+ .finally(() => {
130
+ this.deregister(src);
109
131
  });
110
132
  });
111
133
  });
112
- console.log("portsToUse", portsToUse);
134
+ // console.log("portsToUse", portsToUse);
113
135
  for (let i = 0; i <= portsToUse.length; i++) {
114
136
  if (portsToUse[i]) {
115
137
  this.ports[portsToUse[i]] = "true"; //port is open again
@@ -143,7 +165,7 @@ class PM_Main extends index_js_1.PM {
143
165
  // console.log(`${i}: ${msg._args[i]}`);
144
166
  });
145
167
  page.exposeFunction("custom-screenshot", async (ssOpts, testName) => {
146
- console.log("main.ts browser custom-screenshot", testName);
168
+ // console.log("main.ts browser custom-screenshot", testName);
147
169
  const p = ssOpts.path;
148
170
  const dir = path_1.default.dirname(p);
149
171
  fs_1.default.mkdirSync(dir, {
@@ -214,7 +236,7 @@ class PM_Main extends index_js_1.PM {
214
236
  delete files[testName];
215
237
  Promise.all(screenshots[testName] || []).then(() => {
216
238
  delete screenshots[testName];
217
- page.close();
239
+ // page.close();
218
240
  });
219
241
  // globalThis["writeFileSync"](
220
242
  // p + "/manifest.json",
@@ -248,7 +270,6 @@ class PM_Main extends index_js_1.PM {
248
270
  });
249
271
  });
250
272
  };
251
- // launchNodeSideCar = async (src: string, dest: string) => {};
252
273
  this.launchNodeSideCar = async (src, dest, testConfig) => {
253
274
  const d = dest + ".mjs";
254
275
  console.log("launchNodeSideCar", src, dest, d);
@@ -274,7 +295,7 @@ class PM_Main extends index_js_1.PM {
274
295
  }
275
296
  else if (testConfigResource.ports > 0) {
276
297
  const openPorts = Object.entries(this.ports).filter(([portnumber, portopen]) => portopen);
277
- console.log("openPorts", openPorts);
298
+ // console.log("openPorts", openPorts);
278
299
  if (openPorts.length >= testConfigResource.ports) {
279
300
  for (let i = 0; i < testConfigResource.ports; i++) {
280
301
  portsToUse.push(openPorts[i][0]);
@@ -305,7 +326,7 @@ class PM_Main extends index_js_1.PM {
305
326
  // );
306
327
  this.server[builtfile] = await Promise.resolve().then(() => __importStar(require(`${builtfile}?cacheBust=${Date.now()}`))).then((module) => {
307
328
  return module.default.then((defaultModule) => {
308
- console.log("defaultModule", defaultModule);
329
+ // console.log("defaultModule", defaultModule);
309
330
  const s = new defaultModule();
310
331
  s.receiveTestResourceConfig(argz);
311
332
  // Object.create(defaultModule);
@@ -320,7 +341,7 @@ class PM_Main extends index_js_1.PM {
320
341
  // });
321
342
  });
322
343
  });
323
- console.log("portsToUse", portsToUse);
344
+ // console.log("portsToUse", portsToUse);
324
345
  for (let i = 0; i <= portsToUse.length; i++) {
325
346
  if (portsToUse[i]) {
326
347
  this.ports[portsToUse[i]] = "true"; //port is open again
@@ -329,6 +350,7 @@ class PM_Main extends index_js_1.PM {
329
350
  };
330
351
  this.launchWeb = (t, dest, sidecars) => {
331
352
  console.log("launchWeb", t, dest);
353
+ this.register(t);
332
354
  sidecars.map((sidecar) => {
333
355
  if (sidecar[1] === "node") {
334
356
  return this.launchNodeSideCar(sidecar[0], (0, utils_js_1.destinationOfRuntime)(sidecar[0], "node", this.configs), sidecar);
@@ -362,7 +384,7 @@ class PM_Main extends index_js_1.PM {
362
384
  // console.log(`${i}: ${msg._args[i]}`);
363
385
  });
364
386
  page.exposeFunction("customScreenShot", async (ssOpts, testName) => {
365
- console.log("main.ts browser custom-screenshot", testName);
387
+ // console.log("main.ts browser custom-screenshot", testName);
366
388
  const p = ssOpts.path;
367
389
  const dir = path_1.default.dirname(p);
368
390
  fs_1.default.mkdirSync(dir, {
@@ -432,12 +454,15 @@ class PM_Main extends index_js_1.PM {
432
454
  return fileStreams2[uid].end();
433
455
  });
434
456
  page.exposeFunction("customclose", (p, testName) => {
435
- console.log("\t closing", p);
457
+ // console.log("closing", p);
436
458
  fs_1.default.writeFileSync(p + "/manifest.json", JSON.stringify(Array.from(files[testName])));
437
459
  delete files[testName];
460
+ // console.log("screenshots[testName]", screenshots[testName]);
438
461
  Promise.all(screenshots[testName] || []).then(() => {
439
462
  delete screenshots[testName];
440
463
  // page.close();
464
+ // console.log("\t GOODBYE");
465
+ // whyIsNodeRunning();
441
466
  });
442
467
  // globalThis["writeFileSync"](
443
468
  // p + "/manifest.json",
@@ -471,6 +496,9 @@ class PM_Main extends index_js_1.PM {
471
496
  })
472
497
  .finally(() => {
473
498
  console.log("evaluation complete.", dest);
499
+ // page.close();
500
+ this.deregister(t);
501
+ // whyIsNodeRunning();
474
502
  });
475
503
  return page;
476
504
  });
@@ -478,6 +506,7 @@ class PM_Main extends index_js_1.PM {
478
506
  this.server = {};
479
507
  this.configs = configs;
480
508
  this.ports = {};
509
+ this.registry = {};
481
510
  this.configs.ports.forEach((element) => {
482
511
  this.ports[element] = "true"; // set ports as open
483
512
  });
@@ -490,7 +519,7 @@ class PM_Main extends index_js_1.PM {
490
519
  return false;
491
520
  };
492
521
  globalThis["writeFileSync"] = (filepath, contents, testName) => {
493
- console.log("globalThis-writeFileSync", filepath);
522
+ // console.log("globalThis-writeFileSync", filepath);
494
523
  // Create directories if they don't exist
495
524
  const dir = path_1.default.dirname(filepath.split("/").slice(0, -1).join("/"));
496
525
  fs_1.default.mkdirSync(dir, {
@@ -519,15 +548,6 @@ class PM_Main extends index_js_1.PM {
519
548
  fileStreams3[uid].end();
520
549
  };
521
550
  globalThis["customScreenShot"] = async (opts, page) => {
522
- // // fileStreams3[uid].write(contents);
523
- // // console.log("asd", opts.path.split("/").slice(0, -1).join("/"));
524
- // // const dir = path.dirname(opts.path.split("/").slice(0, -1).join("/"));
525
- // // console.log("dir", dir);
526
- // fs.mkdirSync(opts.path.split("/").slice(0, -1).join("/"), {
527
- // recursive: true,
528
- // });
529
- // return page.screenshot(opts);
530
- console.log("main.ts node custom-screenshot", page);
531
551
  const p = opts.path;
532
552
  const dir = path_1.default.dirname(p);
533
553
  fs_1.default.mkdirSync(dir, {
@@ -551,29 +571,12 @@ class PM_Main extends index_js_1.PM {
551
571
  }
552
572
  fs_1.default.writeFileSync(p + "/manifest.json", JSON.stringify(Array.from(files[testName])));
553
573
  delete files[testName];
554
- // globalThis["writeFileSync"](
555
- // p + "/manifest.json",
556
- // // files.entries()
557
- // JSON.stringify(Array.from(files[testName]))
558
- // );
559
- // fileStreams3[uid].end();
560
574
  };
561
- // page.exposeFunction("customclose", () => {
562
- // console.log("closing doneFileStream2", doneFileStream2);
563
- // // console.log("closing doneFileStream2", doneFileStream2);
564
- // Promise.all([...doneFileStream2, ...screenshots2]).then(() => {
565
- // page.close();
566
- // });
567
- // // page.close();
568
- // // Promise.all(screenshots).then(() => {
569
- // // page.close();
570
- // // });
571
- // // setTimeout(() => {
572
- // // console.log("Delayed for 1 second.");
573
- // // page.close();
574
- // // }, 5000);
575
- // // return page.close();
576
- // });
575
+ }
576
+ shutDown() {
577
+ console.log("shutting down...");
578
+ this.shutdownMode = true;
579
+ this.checkForShutdown();
577
580
  }
578
581
  customScreenShot(opts) {
579
582
  throw new Error("Method not implemented.");
@@ -28,7 +28,7 @@ class PM_Node extends index_js_1.PM {
28
28
  return globalThis["write"](writeObject.uid, contents);
29
29
  }
30
30
  writeFileSync(filepath, contents) {
31
- console.log("pm_node-writeFileSync", this.testResourceConfiguration);
31
+ // console.log("pm_node-writeFileSync", this.testResourceConfiguration);
32
32
  return globalThis["writeFileSync"](this.testResourceConfiguration.fs + "/" + filepath, contents, this.testResourceConfiguration.name);
33
33
  }
34
34
  createWriteStream(filepath) {