testeranto 0.81.2 → 0.82.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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "testeranto",
3
3
  "description": "teeny tiny tightly-typed typescript tests",
4
- "version": "0.81.2",
4
+ "version": "0.82.0",
5
5
  "engines": {
6
6
  "node": "18.18.0"
7
7
  },
@@ -256,10 +256,6 @@
256
256
  "ipc": "^0.0.1",
257
257
  "iterm-tab": "^0.4.0",
258
258
  "jsonc": "^2.0.0",
259
- "mongodb": "^6.13.0",
260
- "mongoose": "^8.10.0",
261
- "mongoose-auto-number": "2.0.0",
262
- "mongoose-rest-query": "^0.1.29",
263
259
  "npm-watch": "^0.11.0",
264
260
  "octokit": "^4.1.2",
265
261
  "passport": "^0.7.0",
package/src/Node.ts CHANGED
@@ -48,11 +48,11 @@ class NodeTesteranto<
48
48
 
49
49
  async receiveTestResourceConfig(partialTestResource: string) {
50
50
  const t: ITTestResourceConfiguration = JSON.parse(partialTestResource);
51
- console.log("receiveTestResourceConfig", t);
52
51
  const pm = new PM_Node(t);
53
- const { failed, artifacts, logPromise } =
52
+ const { failed, artifacts, logPromise, features } =
54
53
  await this.testJobs[0].receiveTestResourceConfig(pm);
55
54
  pm.customclose();
55
+ return features;
56
56
  }
57
57
  }
58
58
 
package/src/PM/main.ts CHANGED
@@ -250,6 +250,21 @@ export class PM_Main extends PM {
250
250
  return module.default.then((defaultModule) => {
251
251
  defaultModule
252
252
  .receiveTestResourceConfig(argz)
253
+ .then(async (features: string[]) => {
254
+ Object.keys(features)
255
+ .reduce(async (mm, lm) => {
256
+ const accum = await mm;
257
+ const x = await this.configs.featureIngestor(features[lm]);
258
+ accum[lm] = x;
259
+ return accum;
260
+ }, Promise.resolve({}))
261
+ .then((x) => {
262
+ fs.writeFileSync(
263
+ `${destFolder}/features.json`,
264
+ JSON.stringify(x, null, 2)
265
+ );
266
+ });
267
+ })
253
268
  .catch((e) => {
254
269
  console.log("catch", e);
255
270
  })
@@ -576,7 +591,7 @@ export class PM_Main extends PM {
576
591
  import('${dest}.mjs').then(async (x) => {
577
592
  console.log("imported", x.default);
578
593
  try {
579
- await (await x.default).receiveTestResourceConfig(${webArgz})
594
+ return await (await x.default).receiveTestResourceConfig(${webArgz})
580
595
  } catch (e) {
581
596
  console.log("fail", e)
582
597
  }
@@ -741,8 +756,23 @@ export class PM_Main extends PM {
741
756
  );
742
757
  await page.goto(`file://${`${dest}.html`}`, {});
743
758
 
744
- page
759
+ await page
745
760
  .evaluate(evaluation)
761
+ .then(async (features: string[]) => {
762
+ Object.keys(features)
763
+ .reduce(async (mm, lm) => {
764
+ const accum = await mm;
765
+ const x = await this.configs.featureIngestor(features[lm]);
766
+ accum[lm] = x;
767
+ return accum;
768
+ }, Promise.resolve({}))
769
+ .then((x) => {
770
+ fs.writeFileSync(
771
+ `${destFolder}/features.json`,
772
+ JSON.stringify(x, null, 2)
773
+ );
774
+ });
775
+ })
746
776
  .catch((e) => {
747
777
  console.log("evaluation failed.", dest);
748
778
  console.log(e);
package/src/PM/node.ts CHANGED
@@ -42,7 +42,6 @@ export class PM_Node extends PM {
42
42
  }
43
43
 
44
44
  writeFileSync(filepath: string, contents: string) {
45
- // console.log("pm_node-writeFileSync", this.testResourceConfiguration);
46
45
  return globalThis["writeFileSync"](
47
46
  this.testResourceConfiguration.fs + "/" + filepath,
48
47
  contents,
package/src/Web.ts CHANGED
@@ -47,9 +47,13 @@ class WebTesteranto<
47
47
  async receiveTestResourceConfig(partialTestResource: any) {
48
48
  const t: ITTestResourceConfiguration = partialTestResource; //JSON.parse(partialTestResource);
49
49
  const pm = new PM_Web(t);
50
- const { failed, artifacts, logPromise } =
50
+ const { failed, artifacts, logPromise, features } =
51
51
  await this.testJobs[0].receiveTestResourceConfig(pm);
52
52
  pm.customclose();
53
+ return new Promise<string[]>((res, rej) => {
54
+ res(features);
55
+ });
56
+ // return features;
53
57
  // Promise.all([...artifacts, logPromise]).then(async () => {
54
58
  // console.log("hello world");
55
59
  // pm.customclose();
@@ -29,6 +29,12 @@ export default (
29
29
  entryPoint.split(".").slice(0, -1).join("."),
30
30
  `tests.json`
31
31
  );
32
+ const featuresPath = path.join(
33
+ "./docs/",
34
+ platform,
35
+ entryPoint.split(".").slice(0, -1).join("."),
36
+ `features.json`
37
+ );
32
38
 
33
39
  const dirName = path.dirname(filePath);
34
40
 
@@ -57,16 +63,8 @@ export default (
57
63
  const passes = matches?.length === 1;
58
64
  return passes;
59
65
  });
60
- // .filter((f: string) => {
61
- // const regex = /.*\.test\..*/g;
62
- // const matches = f.match(regex);
63
- // const passes = matches?.length === 1;
64
- // return !passes;
65
- // })
66
-
67
- const jsonContent = JSON.stringify(j);
68
66
 
69
- fs.writeFileSync(filePath, jsonContent);
67
+ fs.writeFileSync(filePath, JSON.stringify(j));
70
68
 
71
69
  fs.writeFileSync(
72
70
  promptPath,
@@ -77,33 +75,10 @@ ${j
77
75
  })
78
76
  .join("\n")}
79
77
  /read ${testPaths}
80
-
81
- /code fix the failing tests described in ${filePath}.
78
+ /read ${featuresPath}
79
+ /code fix the failing tests described in ${testPaths}.
82
80
  `
83
81
  );
84
-
85
- // fs.writeFileSync(
86
- // promptPath,
87
- // `
88
- // from aider.coders import Coder
89
- // from aider.models import Model
90
- // import os
91
-
92
- // model = Model("deepseek")
93
-
94
- // coder = Coder.create(main_model=model)
95
-
96
- // coder.run("/read-only", "${testPaths}")
97
-
98
- // ${j
99
- // .map((x) => {
100
- // return `coder.run("/add", "${x}")`;
101
- // })
102
- // .join("\n")}
103
-
104
- // coder.run("fix the failing tests described in ${filePath}.")
105
- // `
106
- // );
107
82
  });
108
83
  }
109
84
  });
@@ -57,8 +57,7 @@ export abstract class BaseSuite<
57
57
  this.fails = [];
58
58
  }
59
59
 
60
- public toObj() {
61
- const givens = Object.keys(this.givens).map((k) => this.givens[k].toObj());
60
+ public features() {
62
61
  const features = Object.keys(this.givens)
63
62
  .map((k) => this.givens[k].features)
64
63
  .flat()
@@ -69,11 +68,17 @@ export abstract class BaseSuite<
69
68
  mm[lm] = lm;
70
69
  return mm;
71
70
  }, {});
71
+ return features;
72
+ }
73
+
74
+ public toObj() {
75
+ const givens = Object.keys(this.givens).map((k) => this.givens[k].toObj());
76
+
72
77
  return {
73
78
  name: this.name,
74
79
  givens,
75
80
  fails: this.fails,
76
- features,
81
+ features: this.features(),
77
82
  };
78
83
  }
79
84
 
@@ -82,6 +82,7 @@ export abstract class BaseBuilder<
82
82
  this.Check()
83
83
  );
84
84
 
85
+ // const f = this.specs[0].features;
85
86
  this.testJobs = this.specs.map((suite: BaseSuite<ITestShape>) => {
86
87
  const suiteRunner =
87
88
  (suite: BaseSuite<ITestShape>) =>
@@ -128,8 +129,6 @@ export abstract class BaseBuilder<
128
129
  runner,
129
130
 
130
131
  receiveTestResourceConfig: async function (puppetMaster: PM) {
131
- // await puppetMaster.mkdirSync();
132
-
133
132
  const logFilePath = "log.txt";
134
133
  const access = await puppetMaster.createWriteStream(logFilePath);
135
134
  const tLog = (...l: string[]) => {
@@ -170,6 +169,7 @@ export abstract class BaseBuilder<
170
169
  failed: numberOfFailures,
171
170
  artifacts: this.artifacts || [],
172
171
  logPromise,
172
+ features: suiteDone.features(),
173
173
  };
174
174
  },
175
175
  };
package/src/lib/core.ts CHANGED
@@ -262,5 +262,7 @@ export default abstract class Testeranto<
262
262
  );
263
263
  }
264
264
 
265
- abstract receiveTestResourceConfig(partialTestResource: string);
265
+ abstract receiveTestResourceConfig(
266
+ partialTestResource: string
267
+ ): Promise<string[]>;
266
268
  }
package/src/lib/index.ts CHANGED
@@ -183,6 +183,7 @@ export type ITestJob<T = PM> = {
183
183
  failed: number;
184
184
  artifacts: Promise<unknown>[];
185
185
  logPromise: Promise<unknown>;
186
+ features: string[];
186
187
  }>;
187
188
  };
188
189
 
package/src/lib/types.ts CHANGED
@@ -34,7 +34,7 @@ export type IBaseConfig = {
34
34
  ports: string[];
35
35
  tests: ITestTypes[];
36
36
  webPlugins: any[];
37
- botEmail: string;
37
+ featureIngestor: (s: string) => Promise<string>;
38
38
  };
39
39
 
40
40
  export type IBuiltConfig = { buildDir: string } & IBaseConfig;
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }
@@ -1,3 +0,0 @@
1
- {
2
- "type": "module"
3
- }