testeranto 0.134.0 → 0.135.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 (71) hide show
  1. package/.aider.chat.history.md +601 -0
  2. package/.aider.input.history +36 -0
  3. package/.aider.tags.cache.v3/{18/8b/7dfca822129dad10b5cacadf7728.val → 8e/ec/2d4659a1589a0187a757ab1cbefa.val} +0 -0
  4. package/.aider.tags.cache.v3/cache.db +0 -0
  5. package/.aider.tags.cache.v3/{8d/fa/12860238755bcfab9af8a93c52ab.val → d8/b0/a8966fcd65890fd9f70d7afe8141.val} +0 -0
  6. package/README.md +60 -347
  7. package/dist/common/src/CoreTypes.js +2 -0
  8. package/dist/common/src/PM/PM_WithEslintAndTsc.js +10 -8
  9. package/dist/common/src/PM/main.js +12 -7
  10. package/dist/common/src/PM/node.js +10 -3
  11. package/dist/common/src/build.js +3 -2
  12. package/dist/common/src/esbuildConfigs/eslint-formatter-testeranto.js +16 -1
  13. package/dist/common/src/esbuildConfigs/node.js +2 -16
  14. package/dist/common/src/esbuildConfigs/pure.js +2 -16
  15. package/dist/common/src/esbuildConfigs/rebuildPlugin.js +22 -0
  16. package/dist/common/src/esbuildConfigs/web.js +2 -16
  17. package/dist/common/src/lib/abstractBase.js +6 -1
  18. package/dist/common/src/lib/classBuilder.js +2 -3
  19. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  20. package/dist/module/src/CoreTypes.js +1 -0
  21. package/dist/module/src/PM/PM_WithEslintAndTsc.js +10 -8
  22. package/dist/module/src/PM/main.js +12 -7
  23. package/dist/module/src/PM/node.js +10 -3
  24. package/dist/module/src/build.js +3 -2
  25. package/dist/module/src/esbuildConfigs/eslint-formatter-testeranto.js +16 -1
  26. package/dist/module/src/esbuildConfigs/node.js +2 -16
  27. package/dist/module/src/esbuildConfigs/pure.js +2 -16
  28. package/dist/module/src/esbuildConfigs/rebuildPlugin.js +17 -0
  29. package/dist/module/src/esbuildConfigs/web.js +2 -16
  30. package/dist/module/src/lib/abstractBase.js +6 -1
  31. package/dist/module/src/lib/classBuilder.js +2 -3
  32. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  33. package/dist/prebuild/Project.js +15 -16
  34. package/dist/prebuild/TestReport.js +12 -14
  35. package/dist/prebuild/build.mjs +39 -61
  36. package/dist/prebuild/esbuildConfigs/eslint-formatter-testeranto.mjs +14 -1
  37. package/dist/prebuild/run.mjs +50 -31
  38. package/dist/types/src/CoreTypes.d.ts +51 -0
  39. package/dist/types/src/Node.d.ts +2 -2
  40. package/dist/types/src/PM/__tests__/nodeSidecar.testeranto.d.ts +1 -19
  41. package/dist/types/src/PM/__tests__/pureSidecar.testeranto.d.ts +1 -19
  42. package/dist/types/src/PM/__tests__/webSidecar.testeranto.d.ts +1 -19
  43. package/dist/types/src/PM/index.d.ts +1 -1
  44. package/dist/types/src/Types.d.ts +13 -57
  45. package/dist/types/src/Web.d.ts +1 -1
  46. package/dist/types/src/esbuildConfigs/rebuildPlugin.d.ts +6 -0
  47. package/dist/types/src/lib/abstractBase.d.ts +2 -8
  48. package/dist/types/src/lib/core.d.ts +1 -1
  49. package/dist/types/src/mothership/test.d.ts +1 -20
  50. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  51. package/docs/index.md +277 -0
  52. package/package.json +6 -1
  53. package/src/CoreTypes.ts +171 -0
  54. package/src/Node.ts +25 -11
  55. package/src/PM/PM_WithEslintAndTsc.ts +46 -15
  56. package/src/PM/index.ts +1 -1
  57. package/src/PM/main.ts +17 -16
  58. package/src/PM/node.ts +10 -10
  59. package/src/Types.ts +166 -150
  60. package/src/Web.ts +0 -3
  61. package/src/build.ts +3 -2
  62. package/src/esbuildConfigs/eslint-formatter-testeranto.ts +17 -1
  63. package/src/esbuildConfigs/node.ts +2 -18
  64. package/src/esbuildConfigs/pure.ts +2 -18
  65. package/src/esbuildConfigs/rebuildPlugin.ts +23 -0
  66. package/src/esbuildConfigs/web.ts +2 -18
  67. package/src/lib/abstractBase.ts +6 -1
  68. package/src/lib/classBuilder.ts +5 -4
  69. package/src/lib/core.ts +5 -9
  70. package/.aider.tags.cache.v3/cache.db-shm +0 -0
  71. package/.aider.tags.cache.v3/cache.db-wal +0 -0
@@ -0,0 +1 @@
1
+ export {};
@@ -66,8 +66,12 @@ export class PM_WithEslintAndTsc extends PM_Base {
66
66
  this.makePrompt = async (entryPoint, addableFiles, platform) => {
67
67
  this.summary[entryPoint].prompt = "?";
68
68
  const promptPath = promptPather(entryPoint, platform, this.name);
69
- const testPaths = path.join("testeranto", "reports", this.name, platform, entryPoint.split(".").slice(0, -1).join("."), `tests.json`);
69
+ const testPaths = path.join("testeranto", "reports", this.name, entryPoint.split(".").slice(0, -1).join("."), platform, `tests.json`);
70
70
  const featuresPath = path.join("testeranto", "reports", this.name, platform, entryPoint.split(".").slice(0, -1).join("."), `featurePrompt.txt`);
71
+ const logPath = path.join("testeranto", "reports", this.name, entryPoint.split(".").slice(0, -1).join("."), platform, `console_log.txt`);
72
+ const lintPath = path.join("testeranto", "reports", this.name, entryPoint.split(".").slice(0, -1).join("."), platform, `lint_errors.json`);
73
+ const typePath = path.join("testeranto", "reports", this.name, entryPoint.split(".").slice(0, -1).join("."), platform, `type_errors.txt`);
74
+ const messagePath = path.join("testeranto", "reports", this.name, entryPoint.split(".").slice(0, -1).join("."), platform, `message`);
71
75
  fs.writeFileSync(promptPath, `
72
76
  ${addableFiles
73
77
  .map((x) => {
@@ -75,14 +79,12 @@ ${addableFiles
75
79
  })
76
80
  .join("\n")}
77
81
 
78
- /read ${lintPather(entryPoint, platform, this.name)}
79
- /read ${tscPather(entryPoint, platform, this.name)}
80
82
  /read ${testPaths}
81
-
82
- /load ${featuresPath}
83
-
84
- /code Fix the failing tests described in ${testPaths}. Correct any type signature errors described in the files ${tscPather(entryPoint, platform, this.name)}. Implement any method which throws "Function not implemented. Resolve the lint errors described in ${lintPather(entryPoint, platform, this.name)}"
85
- `);
83
+ /read ${logPath}
84
+ /read ${typePath}
85
+ /read ${lintPath}
86
+ `);
87
+ fs.writeFileSync(messagePath, `Fix the failing tests described in ${testPaths} and ${logPath}. DO NOT refactor beyond what is necessary. Always prefer minimal changes, focusing mostly on keeping the BDD tests passing`);
86
88
  this.summary[entryPoint].prompt = `aider --model deepseek/deepseek-chat --load testeranto/${this.name}/reports/${platform}/${entryPoint
87
89
  .split(".")
88
90
  .slice(0, -1)
@@ -273,7 +273,9 @@ export class PM_Main extends PM_WithEslintAndTsc {
273
273
  const builtfile = dest;
274
274
  let haltReturns = false;
275
275
  const ipcfile = "/tmp/tpipe_" + Math.random();
276
- const child = spawn("node", [builtfile, testResources, ipcfile], {
276
+ const child = spawn("node",
277
+ // "node --inspect-brk ",
278
+ [builtfile, testResources, ipcfile], {
277
279
  stdio: ["pipe", "pipe", "pipe", "ipc"],
278
280
  });
279
281
  let buffer = new Buffer("");
@@ -328,7 +330,6 @@ export class PM_Main extends PM_WithEslintAndTsc {
328
330
  oStream.write(`stdout > ${data}`);
329
331
  });
330
332
  child.on("close", (code) => {
331
- console.log("close");
332
333
  oStream.close();
333
334
  server.close();
334
335
  // this.receiveFeaturesV2(reportDest, src, "node");
@@ -347,14 +348,12 @@ export class PM_Main extends PM_WithEslintAndTsc {
347
348
  haltReturns = true;
348
349
  });
349
350
  child.on("exit", (code) => {
350
- console.log("exit");
351
351
  haltReturns = true;
352
352
  for (let i = 0; i <= portsToUse.length; i++) {
353
353
  if (portsToUse[i]) {
354
354
  this.ports[portsToUse[i]] = true; //port is open again
355
355
  }
356
356
  }
357
- console.log("exitthis.ports", this.ports);
358
357
  });
359
358
  child.on("error", (e) => {
360
359
  console.log("error");
@@ -390,7 +389,10 @@ export class PM_Main extends PM_WithEslintAndTsc {
390
389
  files[src] = new Set();
391
390
  }
392
391
  // files[t].add(filepath);
393
- fs.writeFileSync(destFolder + "/manifest.json", JSON.stringify(Array.from(files[src])));
392
+ // fs.writeFileSync(
393
+ // destFolder + "/manifest.json",
394
+ // JSON.stringify(Array.from(files[src]))
395
+ // );
394
396
  delete files[src];
395
397
  Promise.all(screenshots[src] || []).then(() => {
396
398
  delete screenshots[src];
@@ -710,7 +712,10 @@ export class PM_Main extends PM_WithEslintAndTsc {
710
712
  files[src] = new Set();
711
713
  }
712
714
  // files[t].add(filepath);
713
- fs.writeFileSync(destFolder + "/manifest.json", JSON.stringify(Array.from(files[src])));
715
+ // fs.writeFileSync(
716
+ // destFolder + "/manifest.json",
717
+ // JSON.stringify(Array.from(files[src]))
718
+ // );
714
719
  delete files[src];
715
720
  Promise.all(screenshots[src] || []).then(() => {
716
721
  delete screenshots[src];
@@ -931,7 +936,7 @@ export class PM_Main extends PM_WithEslintAndTsc {
931
936
  slowMo: 1,
932
937
  waitForInitialPage: false,
933
938
  executablePath,
934
- headless: false,
939
+ headless: true,
935
940
  dumpio: false,
936
941
  devtools: false,
937
942
  args: [
@@ -144,9 +144,16 @@ export class PM_Node extends PM {
144
144
  if (error) {
145
145
  console.error(`❗️testArtiFactory failed`, targetDir, error);
146
146
  }
147
- fs.writeFileSync(path.resolve(targetDir.split("/").slice(0, -1).join("/"), "manifest"), fPaths.join(`\n`), {
148
- encoding: "utf-8",
149
- });
147
+ // fs.writeFileSync(
148
+ // path.resolve(
149
+ // targetDir.split("/").slice(0, -1).join("/"),
150
+ // "manifest"
151
+ // ),
152
+ // fPaths.join(`\n`),
153
+ // {
154
+ // encoding: "utf-8",
155
+ // }
156
+ // );
150
157
  if (Buffer.isBuffer(value)) {
151
158
  fs.writeFileSync(fPath, value, "binary");
152
159
  res();
@@ -141,13 +141,14 @@ import(process.cwd() + "/" + "testeranto.config.ts").then(async (module) => {
141
141
  <title>${pckge.name} - testeranto</title>
142
142
  <meta name="viewport" content="width=device-width, initial-scale=1" />
143
143
  <meta name="author" content="" />
144
+ <base href="https://adamwong246.github.io/spacetrash_v8" target="_blank">
144
145
 
145
146
  <script type="application/json" id="bigConfig">
146
147
  ${JSON.stringify(Object.keys(bigConfig.projects))}
147
148
  </script>
148
149
 
149
- <link rel="stylesheet" href="Project.css" />
150
- <script type="module" src="Project.js"></script>
150
+ <link rel="stylesheet" href="/reports/Project.css" />
151
+ <script type="module" src="/reports/Project.js"></script>
151
152
 
152
153
  </head>
153
154
 
@@ -1,3 +1,18 @@
1
1
  export default function (results) {
2
- return JSON.stringify(results, null, 2);
2
+ return results
3
+ .filter((r) => r.messages.length)
4
+ .map((r) => {
5
+ const path = r.filePath.replace(process.cwd() + "/", "");
6
+ return [
7
+ path,
8
+ ...r.messages.map((m) => {
9
+ var _a;
10
+ return [
11
+ `${m.line}:${m.column} ${m.message} (${m.ruleId || ""})`,
12
+ ...(((_a = m.suggestions) === null || _a === void 0 ? void 0 : _a.map((s) => `- ${s.message}${s.fix ? " (fix)" : ""}`)) || []),
13
+ ].join("\n");
14
+ }),
15
+ ].join("\n");
16
+ })
17
+ .join("\n\n");
3
18
  }
@@ -1,6 +1,7 @@
1
1
  import baseEsBuildConfig from "./index.js";
2
2
  import inputFilesPlugin from "./inputFilesPlugin.js";
3
3
  import featuresPlugin from "./featuresPlugin";
4
+ import rebuildPlugin from "./rebuildPlugin.js";
4
5
  export default (config, entryPoints, testName) => {
5
6
  const { inputFilesPluginFactory, register } = inputFilesPlugin("node", testName);
6
7
  return Object.assign(Object.assign({}, baseEsBuildConfig(config)), { splitting: true, outdir: `testeranto/bundles/node/${testName}/`,
@@ -14,22 +15,7 @@ export default (config, entryPoints, testName) => {
14
15
  }, platform: "node", external: ["react", ...config.externals], entryPoints: [...entryPoints], plugins: [
15
16
  featuresPlugin,
16
17
  inputFilesPluginFactory,
17
- {
18
- name: "rebuild-notify",
19
- setup: (build) => {
20
- build.onStart(() => {
21
- console.log(`> node build starting...`);
22
- });
23
- build.onEnd((result) => {
24
- console.log(`> node build ended with ${result.errors.length} errors`);
25
- if (result.errors.length > 0) {
26
- console.log(result);
27
- }
28
- // console.log(result);
29
- // result.errors.length !== 0 && process.exit(-1);
30
- });
31
- },
32
- },
18
+ rebuildPlugin("node"),
33
19
  ...(config.nodePlugins.map((p) => p(register, entryPoints)) || []),
34
20
  ] });
35
21
  };
@@ -3,6 +3,7 @@ import inputFilesPlugin from "./inputFilesPlugin.js";
3
3
  import featuresPlugin from "./featuresPlugin.js";
4
4
  import { isBuiltin } from "node:module";
5
5
  import { consoleDetectorPlugin } from "./consoleDetectorPlugin.js";
6
+ import rebuildPlugin from "./rebuildPlugin.js";
6
7
  export default (config, entryPoints, testName) => {
7
8
  const { inputFilesPluginFactory, register } = inputFilesPlugin("pure", testName);
8
9
  return Object.assign(Object.assign({}, baseEsBuildConfig(config)), { drop: [], splitting: true, outdir: `testeranto/bundles/pure/${testName}/`,
@@ -28,22 +29,7 @@ export default (config, entryPoints, testName) => {
28
29
  });
29
30
  },
30
31
  },
31
- {
32
- name: "rebuild-notify",
33
- setup: (build) => {
34
- build.onStart(() => {
35
- console.log(`> pure build starting...`);
36
- });
37
- build.onEnd((result) => {
38
- console.log(`> pure build ended with ${result.errors.length} errors`);
39
- if (result.errors.length > 0) {
40
- console.log(result);
41
- }
42
- // console.log(result);
43
- // result.errors.length !== 0 && process.exit(-1);
44
- });
45
- },
46
- },
32
+ rebuildPlugin("pure"),
47
33
  ...((config.nodePlugins || []).map((p) => p(register, entryPoints)) ||
48
34
  []),
49
35
  ] });
@@ -0,0 +1,17 @@
1
+ import fs from "fs";
2
+ export default (r) => {
3
+ return {
4
+ name: "rebuild-notify",
5
+ setup: (build) => {
6
+ build.onStart(() => {
7
+ console.log(`> web build starting...`);
8
+ });
9
+ build.onEnd((result) => {
10
+ console.log(`> web build ended with ${result.errors.length} errors`);
11
+ if (result.errors.length > 0) {
12
+ fs.writeFileSync(`./testeranto/reports${r}_build_errors`, JSON.stringify(result, null, 2));
13
+ }
14
+ });
15
+ },
16
+ };
17
+ };
@@ -3,6 +3,7 @@ import path from "path";
3
3
  import baseEsBuildConfig from "./index.js";
4
4
  import inputFilesPlugin from "./inputFilesPlugin.js";
5
5
  import featuresPlugin from "./featuresPlugin.js";
6
+ import rebuildPlugin from "./rebuildPlugin.js";
6
7
  export default (config, entryPoints, testName) => {
7
8
  const { inputFilesPluginFactory, register } = inputFilesPlugin("web", testName);
8
9
  return Object.assign(Object.assign({}, baseEsBuildConfig(config)), { treeShaking: true, outdir: `testeranto/bundles/web/${testName}`, alias: {
@@ -36,22 +37,7 @@ export default (config, entryPoints, testName) => {
36
37
  // 'fs': false,
37
38
  // }
38
39
  }),
39
- {
40
- name: "rebuild-notify",
41
- setup: (build) => {
42
- build.onStart(() => {
43
- console.log(`> web build starting...`);
44
- });
45
- build.onEnd((result) => {
46
- console.log(`> web build ended with ${result.errors.length} errors`);
47
- if (result.errors.length > 0) {
48
- console.log(result);
49
- }
50
- // console.log(result);
51
- // result.errors.length !== 0 && process.exit(-1);
52
- });
53
- },
54
- },
40
+ rebuildPlugin("web"),
55
41
  ...((config.webPlugins || []).map((p) => p(register, entryPoints)) || []),
56
42
  ] });
57
43
  };
@@ -101,7 +101,12 @@ export class BaseGiven {
101
101
  return {
102
102
  key: this.key,
103
103
  name: this.name,
104
- whens: this.whens.map((w) => w.toObj()),
104
+ whens: this.whens.map((w) => {
105
+ if (w && w.toObj)
106
+ return w.toObj();
107
+ console.error("w is not as expected!", w);
108
+ return {};
109
+ }),
105
110
  thens: this.thens.map((t) => t.toObj()),
106
111
  error: this.error ? [this.error, this.error.stack] : null,
107
112
  failed: this.failed,
@@ -9,14 +9,13 @@ export class ClassBuilder extends BaseBuilder {
9
9
  }, {});
10
10
  const classyGivens = Object.entries(testImplementation.givens).reduce((a, [key, g]) => {
11
11
  a[key] = (features, whens, thens, ...initialValues) => {
12
- // console.log("givEn", givEn.toString());
13
12
  return new givenKlasser.prototype.constructor(key, features, whens, thens, testImplementation.givens[key], initialValues);
14
13
  };
15
14
  return a;
16
15
  }, {});
17
16
  const classyWhens = Object.entries(testImplementation.whens).reduce((a, [key, whEn]) => {
18
- a[key] = (payload) => {
19
- return new whenKlasser.prototype.constructor(`${whEn.name}: ${payload && payload.toString()}`, whEn(payload));
17
+ a[key] = (...payload) => {
18
+ return new whenKlasser.prototype.constructor(`${whEn.name}: ${payload && payload.toString()}`, whEn(...payload));
20
19
  };
21
20
  return a;
22
21
  }, {});