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 +3 -1
- package/dist/common/src/Node.js +2 -2
- package/dist/common/src/PM/main.js +26 -2
- package/dist/common/src/PM/node.js +0 -1
- package/dist/common/src/Web.js +5 -1
- package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +4 -27
- package/dist/common/src/lib/abstractBase.js +6 -3
- package/dist/common/src/lib/basebuilder.js +2 -1
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/src/Node.js +2 -2
- package/dist/module/src/PM/main.js +26 -2
- package/dist/module/src/PM/node.js +0 -1
- package/dist/module/src/Web.js +5 -1
- package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +4 -27
- package/dist/module/src/lib/abstractBase.js +6 -3
- package/dist/module/src/lib/basebuilder.js +2 -1
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/types/src/lib/abstractBase.d.ts +1 -0
- package/dist/types/src/lib/core.d.ts +1 -1
- package/dist/types/src/lib/index.d.ts +1 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +1 -5
- package/src/Node.ts +2 -2
- package/src/PM/main.ts +32 -2
- package/src/PM/node.ts +0 -1
- package/src/Web.ts +5 -1
- package/src/esbuildConfigs/inputFilesPlugin.ts +9 -34
- package/src/lib/abstractBase.ts +8 -3
- package/src/lib/basebuilder.ts +2 -2
- package/src/lib/core.ts +3 -1
- package/src/lib/index.ts +1 -0
- package/src/lib/types.ts +1 -1
- package/dist/common/package.json +0 -3
- package/dist/module/package.json +0 -3
package/dist/module/src/Node.js
CHANGED
|
@@ -7,10 +7,10 @@ class NodeTesteranto extends Testeranto {
|
|
|
7
7
|
}
|
|
8
8
|
async receiveTestResourceConfig(partialTestResource) {
|
|
9
9
|
const t = JSON.parse(partialTestResource);
|
|
10
|
-
console.log("receiveTestResourceConfig", t);
|
|
11
10
|
const pm = new PM_Node(t);
|
|
12
|
-
const { failed, artifacts, logPromise } = await this.testJobs[0].receiveTestResourceConfig(pm);
|
|
11
|
+
const { failed, artifacts, logPromise, features } = await this.testJobs[0].receiveTestResourceConfig(pm);
|
|
13
12
|
pm.customclose();
|
|
13
|
+
return features;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
export default async (input, testSpecification, testImplementation, testInterface, testResourceRequirement = defaultTestResourceRequirement) => {
|
|
@@ -94,6 +94,18 @@ export class PM_Main extends PM {
|
|
|
94
94
|
return module.default.then((defaultModule) => {
|
|
95
95
|
defaultModule
|
|
96
96
|
.receiveTestResourceConfig(argz)
|
|
97
|
+
.then(async (features) => {
|
|
98
|
+
Object.keys(features)
|
|
99
|
+
.reduce(async (mm, lm) => {
|
|
100
|
+
const accum = await mm;
|
|
101
|
+
const x = await this.configs.featureIngestor(features[lm]);
|
|
102
|
+
accum[lm] = x;
|
|
103
|
+
return accum;
|
|
104
|
+
}, Promise.resolve({}))
|
|
105
|
+
.then((x) => {
|
|
106
|
+
fs.writeFileSync(`${destFolder}/features.json`, JSON.stringify(x, null, 2));
|
|
107
|
+
});
|
|
108
|
+
})
|
|
97
109
|
.catch((e) => {
|
|
98
110
|
console.log("catch", e);
|
|
99
111
|
})
|
|
@@ -339,7 +351,7 @@ export class PM_Main extends PM {
|
|
|
339
351
|
import('${dest}.mjs').then(async (x) => {
|
|
340
352
|
console.log("imported", x.default);
|
|
341
353
|
try {
|
|
342
|
-
await (await x.default).receiveTestResourceConfig(${webArgz})
|
|
354
|
+
return await (await x.default).receiveTestResourceConfig(${webArgz})
|
|
343
355
|
} catch (e) {
|
|
344
356
|
console.log("fail", e)
|
|
345
357
|
}
|
|
@@ -459,8 +471,20 @@ export class PM_Main extends PM {
|
|
|
459
471
|
.then(async (page) => {
|
|
460
472
|
page.on("console", (log) => console.debug(`Log from client: [${log.text()}] `));
|
|
461
473
|
await page.goto(`file://${`${dest}.html`}`, {});
|
|
462
|
-
page
|
|
474
|
+
await page
|
|
463
475
|
.evaluate(evaluation)
|
|
476
|
+
.then(async (features) => {
|
|
477
|
+
Object.keys(features)
|
|
478
|
+
.reduce(async (mm, lm) => {
|
|
479
|
+
const accum = await mm;
|
|
480
|
+
const x = await this.configs.featureIngestor(features[lm]);
|
|
481
|
+
accum[lm] = x;
|
|
482
|
+
return accum;
|
|
483
|
+
}, Promise.resolve({}))
|
|
484
|
+
.then((x) => {
|
|
485
|
+
fs.writeFileSync(`${destFolder}/features.json`, JSON.stringify(x, null, 2));
|
|
486
|
+
});
|
|
487
|
+
})
|
|
464
488
|
.catch((e) => {
|
|
465
489
|
console.log("evaluation failed.", dest);
|
|
466
490
|
console.log(e);
|
|
@@ -22,7 +22,6 @@ export class PM_Node extends PM {
|
|
|
22
22
|
return globalThis["write"](writeObject.uid, contents);
|
|
23
23
|
}
|
|
24
24
|
writeFileSync(filepath, contents) {
|
|
25
|
-
// console.log("pm_node-writeFileSync", this.testResourceConfiguration);
|
|
26
25
|
return globalThis["writeFileSync"](this.testResourceConfiguration.fs + "/" + filepath, contents, this.testResourceConfiguration.name);
|
|
27
26
|
}
|
|
28
27
|
createWriteStream(filepath) {
|
package/dist/module/src/Web.js
CHANGED
|
@@ -8,8 +8,12 @@ class WebTesteranto extends Testeranto {
|
|
|
8
8
|
async receiveTestResourceConfig(partialTestResource) {
|
|
9
9
|
const t = partialTestResource; //JSON.parse(partialTestResource);
|
|
10
10
|
const pm = new PM_Web(t);
|
|
11
|
-
const { failed, artifacts, logPromise } = await this.testJobs[0].receiveTestResourceConfig(pm);
|
|
11
|
+
const { failed, artifacts, logPromise, features } = await this.testJobs[0].receiveTestResourceConfig(pm);
|
|
12
12
|
pm.customclose();
|
|
13
|
+
return new Promise((res, rej) => {
|
|
14
|
+
res(features);
|
|
15
|
+
});
|
|
16
|
+
// return features;
|
|
13
17
|
// Promise.all([...artifacts, logPromise]).then(async () => {
|
|
14
18
|
// console.log("hello world");
|
|
15
19
|
// pm.customclose();
|
|
@@ -10,6 +10,7 @@ export default (platform, entryPoints) => {
|
|
|
10
10
|
const filePath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `inputFiles.json`);
|
|
11
11
|
const promptPath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `prompt.txt`);
|
|
12
12
|
const testPaths = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `tests.json`);
|
|
13
|
+
const featuresPath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `features.json`);
|
|
13
14
|
const dirName = path.dirname(filePath);
|
|
14
15
|
if (!fs.existsSync(dirName)) {
|
|
15
16
|
fs.mkdirSync(dirName, { recursive: true });
|
|
@@ -31,14 +32,7 @@ export default (platform, entryPoints) => {
|
|
|
31
32
|
const passes = (matches === null || matches === void 0 ? void 0 : matches.length) === 1;
|
|
32
33
|
return passes;
|
|
33
34
|
});
|
|
34
|
-
|
|
35
|
-
// const regex = /.*\.test\..*/g;
|
|
36
|
-
// const matches = f.match(regex);
|
|
37
|
-
// const passes = matches?.length === 1;
|
|
38
|
-
// return !passes;
|
|
39
|
-
// })
|
|
40
|
-
const jsonContent = JSON.stringify(j);
|
|
41
|
-
fs.writeFileSync(filePath, jsonContent);
|
|
35
|
+
fs.writeFileSync(filePath, JSON.stringify(j));
|
|
42
36
|
fs.writeFileSync(promptPath, `
|
|
43
37
|
${j
|
|
44
38
|
.map((x) => {
|
|
@@ -46,26 +40,9 @@ ${j
|
|
|
46
40
|
})
|
|
47
41
|
.join("\n")}
|
|
48
42
|
/read ${testPaths}
|
|
49
|
-
|
|
50
|
-
/code fix the failing tests described in ${
|
|
43
|
+
/read ${featuresPath}
|
|
44
|
+
/code fix the failing tests described in ${testPaths}.
|
|
51
45
|
`);
|
|
52
|
-
// fs.writeFileSync(
|
|
53
|
-
// promptPath,
|
|
54
|
-
// `
|
|
55
|
-
// from aider.coders import Coder
|
|
56
|
-
// from aider.models import Model
|
|
57
|
-
// import os
|
|
58
|
-
// model = Model("deepseek")
|
|
59
|
-
// coder = Coder.create(main_model=model)
|
|
60
|
-
// coder.run("/read-only", "${testPaths}")
|
|
61
|
-
// ${j
|
|
62
|
-
// .map((x) => {
|
|
63
|
-
// return `coder.run("/add", "${x}")`;
|
|
64
|
-
// })
|
|
65
|
-
// .join("\n")}
|
|
66
|
-
// coder.run("fix the failing tests described in ${filePath}.")
|
|
67
|
-
// `
|
|
68
|
-
// );
|
|
69
46
|
});
|
|
70
47
|
}
|
|
71
48
|
});
|
|
@@ -6,8 +6,7 @@ export class BaseSuite {
|
|
|
6
6
|
this.checks = checks;
|
|
7
7
|
this.fails = [];
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
const givens = Object.keys(this.givens).map((k) => this.givens[k].toObj());
|
|
9
|
+
features() {
|
|
11
10
|
const features = Object.keys(this.givens)
|
|
12
11
|
.map((k) => this.givens[k].features)
|
|
13
12
|
.flat()
|
|
@@ -18,11 +17,15 @@ export class BaseSuite {
|
|
|
18
17
|
mm[lm] = lm;
|
|
19
18
|
return mm;
|
|
20
19
|
}, {});
|
|
20
|
+
return features;
|
|
21
|
+
}
|
|
22
|
+
toObj() {
|
|
23
|
+
const givens = Object.keys(this.givens).map((k) => this.givens[k].toObj());
|
|
21
24
|
return {
|
|
22
25
|
name: this.name,
|
|
23
26
|
givens,
|
|
24
27
|
fails: this.fails,
|
|
25
|
-
features,
|
|
28
|
+
features: this.features(),
|
|
26
29
|
};
|
|
27
30
|
}
|
|
28
31
|
setup(s, artifactory, tr, pm) {
|
|
@@ -11,6 +11,7 @@ export class BaseBuilder {
|
|
|
11
11
|
this.checkOverides = checkOverides;
|
|
12
12
|
this.testSpecification = testSpecification;
|
|
13
13
|
this.specs = testSpecification(this.Suites(), this.Given(), this.When(), this.Then(), this.Check());
|
|
14
|
+
// const f = this.specs[0].features;
|
|
14
15
|
this.testJobs = this.specs.map((suite) => {
|
|
15
16
|
const suiteRunner = (suite) => async (puppetMaster, tLog) => {
|
|
16
17
|
const puppeteerBrowser = await puppetMaster.startPuppeteer({
|
|
@@ -31,7 +32,6 @@ export class BaseBuilder {
|
|
|
31
32
|
},
|
|
32
33
|
runner,
|
|
33
34
|
receiveTestResourceConfig: async function (puppetMaster) {
|
|
34
|
-
// await puppetMaster.mkdirSync();
|
|
35
35
|
const logFilePath = "log.txt";
|
|
36
36
|
const access = await puppetMaster.createWriteStream(logFilePath);
|
|
37
37
|
const tLog = (...l) => {
|
|
@@ -60,6 +60,7 @@ export class BaseBuilder {
|
|
|
60
60
|
failed: numberOfFailures,
|
|
61
61
|
artifacts: this.artifacts || [],
|
|
62
62
|
logPromise,
|
|
63
|
+
features: suiteDone.features(),
|
|
63
64
|
};
|
|
64
65
|
},
|
|
65
66
|
};
|