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/README.md CHANGED
@@ -14,7 +14,9 @@ example repo: [kokomo bay](https://github.com/ChromaPDX/kokomoBay)
14
14
 
15
15
  ## Demo
16
16
 
17
- <iframe width="560" height="315" src="https://www.youtube.com/embed/WvU5xMqGi6Q" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
17
+ <div align="center">
18
+ <a href="https://www.youtube.com/watch?v=WvU5xMqGi6Q"><img src="https://img.youtube.com/vi/WvU5xMqGi6Q/0.jpg" alt="IMAGE ALT TEXT"></a>
19
+ </div>
18
20
 
19
21
  ## What is testeranto?
20
22
 
@@ -12,10 +12,10 @@ class NodeTesteranto extends core_js_1.default {
12
12
  }
13
13
  async receiveTestResourceConfig(partialTestResource) {
14
14
  const t = JSON.parse(partialTestResource);
15
- console.log("receiveTestResourceConfig", t);
16
15
  const pm = new node_js_1.PM_Node(t);
17
- const { failed, artifacts, logPromise } = await this.testJobs[0].receiveTestResourceConfig(pm);
16
+ const { failed, artifacts, logPromise, features } = await this.testJobs[0].receiveTestResourceConfig(pm);
18
17
  pm.customclose();
18
+ return features;
19
19
  }
20
20
  }
21
21
  exports.default = async (input, testSpecification, testImplementation, testInterface, testResourceRequirement = index_js_1.defaultTestResourceRequirement) => {
@@ -123,6 +123,18 @@ class PM_Main extends index_js_1.PM {
123
123
  return module.default.then((defaultModule) => {
124
124
  defaultModule
125
125
  .receiveTestResourceConfig(argz)
126
+ .then(async (features) => {
127
+ Object.keys(features)
128
+ .reduce(async (mm, lm) => {
129
+ const accum = await mm;
130
+ const x = await this.configs.featureIngestor(features[lm]);
131
+ accum[lm] = x;
132
+ return accum;
133
+ }, Promise.resolve({}))
134
+ .then((x) => {
135
+ fs_1.default.writeFileSync(`${destFolder}/features.json`, JSON.stringify(x, null, 2));
136
+ });
137
+ })
126
138
  .catch((e) => {
127
139
  console.log("catch", e);
128
140
  })
@@ -368,7 +380,7 @@ class PM_Main extends index_js_1.PM {
368
380
  import('${dest}.mjs').then(async (x) => {
369
381
  console.log("imported", x.default);
370
382
  try {
371
- await (await x.default).receiveTestResourceConfig(${webArgz})
383
+ return await (await x.default).receiveTestResourceConfig(${webArgz})
372
384
  } catch (e) {
373
385
  console.log("fail", e)
374
386
  }
@@ -488,8 +500,20 @@ class PM_Main extends index_js_1.PM {
488
500
  .then(async (page) => {
489
501
  page.on("console", (log) => console.debug(`Log from client: [${log.text()}] `));
490
502
  await page.goto(`file://${`${dest}.html`}`, {});
491
- page
503
+ await page
492
504
  .evaluate(evaluation)
505
+ .then(async (features) => {
506
+ Object.keys(features)
507
+ .reduce(async (mm, lm) => {
508
+ const accum = await mm;
509
+ const x = await this.configs.featureIngestor(features[lm]);
510
+ accum[lm] = x;
511
+ return accum;
512
+ }, Promise.resolve({}))
513
+ .then((x) => {
514
+ fs_1.default.writeFileSync(`${destFolder}/features.json`, JSON.stringify(x, null, 2));
515
+ });
516
+ })
493
517
  .catch((e) => {
494
518
  console.log("evaluation failed.", dest);
495
519
  console.log(e);
@@ -28,7 +28,6 @@ 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);
32
31
  return globalThis["writeFileSync"](this.testResourceConfiguration.fs + "/" + filepath, contents, this.testResourceConfiguration.name);
33
32
  }
34
33
  createWriteStream(filepath) {
@@ -13,8 +13,12 @@ class WebTesteranto extends core_js_1.default {
13
13
  async receiveTestResourceConfig(partialTestResource) {
14
14
  const t = partialTestResource; //JSON.parse(partialTestResource);
15
15
  const pm = new web_1.PM_Web(t);
16
- const { failed, artifacts, logPromise } = await this.testJobs[0].receiveTestResourceConfig(pm);
16
+ const { failed, artifacts, logPromise, features } = await this.testJobs[0].receiveTestResourceConfig(pm);
17
17
  pm.customclose();
18
+ return new Promise((res, rej) => {
19
+ res(features);
20
+ });
21
+ // return features;
18
22
  // Promise.all([...artifacts, logPromise]).then(async () => {
19
23
  // console.log("hello world");
20
24
  // pm.customclose();
@@ -15,6 +15,7 @@ exports.default = (platform, entryPoints) => {
15
15
  const filePath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `inputFiles.json`);
16
16
  const promptPath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `prompt.txt`);
17
17
  const testPaths = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `tests.json`);
18
+ const featuresPath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `features.json`);
18
19
  const dirName = path_1.default.dirname(filePath);
19
20
  if (!fs_1.default.existsSync(dirName)) {
20
21
  fs_1.default.mkdirSync(dirName, { recursive: true });
@@ -36,14 +37,7 @@ exports.default = (platform, entryPoints) => {
36
37
  const passes = (matches === null || matches === void 0 ? void 0 : matches.length) === 1;
37
38
  return passes;
38
39
  });
39
- // .filter((f: string) => {
40
- // const regex = /.*\.test\..*/g;
41
- // const matches = f.match(regex);
42
- // const passes = matches?.length === 1;
43
- // return !passes;
44
- // })
45
- const jsonContent = JSON.stringify(j);
46
- fs_1.default.writeFileSync(filePath, jsonContent);
40
+ fs_1.default.writeFileSync(filePath, JSON.stringify(j));
47
41
  fs_1.default.writeFileSync(promptPath, `
48
42
  ${j
49
43
  .map((x) => {
@@ -51,26 +45,9 @@ ${j
51
45
  })
52
46
  .join("\n")}
53
47
  /read ${testPaths}
54
-
55
- /code fix the failing tests described in ${filePath}.
48
+ /read ${featuresPath}
49
+ /code fix the failing tests described in ${testPaths}.
56
50
  `);
57
- // fs.writeFileSync(
58
- // promptPath,
59
- // `
60
- // from aider.coders import Coder
61
- // from aider.models import Model
62
- // import os
63
- // model = Model("deepseek")
64
- // coder = Coder.create(main_model=model)
65
- // coder.run("/read-only", "${testPaths}")
66
- // ${j
67
- // .map((x) => {
68
- // return `coder.run("/add", "${x}")`;
69
- // })
70
- // .join("\n")}
71
- // coder.run("fix the failing tests described in ${filePath}.")
72
- // `
73
- // );
74
51
  });
75
52
  }
76
53
  });
@@ -9,8 +9,7 @@ class BaseSuite {
9
9
  this.checks = checks;
10
10
  this.fails = [];
11
11
  }
12
- toObj() {
13
- const givens = Object.keys(this.givens).map((k) => this.givens[k].toObj());
12
+ features() {
14
13
  const features = Object.keys(this.givens)
15
14
  .map((k) => this.givens[k].features)
16
15
  .flat()
@@ -21,11 +20,15 @@ class BaseSuite {
21
20
  mm[lm] = lm;
22
21
  return mm;
23
22
  }, {});
23
+ return features;
24
+ }
25
+ toObj() {
26
+ const givens = Object.keys(this.givens).map((k) => this.givens[k].toObj());
24
27
  return {
25
28
  name: this.name,
26
29
  givens,
27
30
  fails: this.fails,
28
- features,
31
+ features: this.features(),
29
32
  };
30
33
  }
31
34
  setup(s, artifactory, tr, pm) {
@@ -14,6 +14,7 @@ class BaseBuilder {
14
14
  this.checkOverides = checkOverides;
15
15
  this.testSpecification = testSpecification;
16
16
  this.specs = testSpecification(this.Suites(), this.Given(), this.When(), this.Then(), this.Check());
17
+ // const f = this.specs[0].features;
17
18
  this.testJobs = this.specs.map((suite) => {
18
19
  const suiteRunner = (suite) => async (puppetMaster, tLog) => {
19
20
  const puppeteerBrowser = await puppetMaster.startPuppeteer({
@@ -34,7 +35,6 @@ class BaseBuilder {
34
35
  },
35
36
  runner,
36
37
  receiveTestResourceConfig: async function (puppetMaster) {
37
- // await puppetMaster.mkdirSync();
38
38
  const logFilePath = "log.txt";
39
39
  const access = await puppetMaster.createWriteStream(logFilePath);
40
40
  const tLog = (...l) => {
@@ -63,6 +63,7 @@ class BaseBuilder {
63
63
  failed: numberOfFailures,
64
64
  artifacts: this.artifacts || [],
65
65
  logPromise,
66
+ features: suiteDone.features(),
66
67
  };
67
68
  },
68
69
  };