testeranto 0.81.3 → 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/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/common/src/Node.js
CHANGED
|
@@ -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) {
|
package/dist/common/src/Web.js
CHANGED
|
@@ -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
|
-
|
|
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 ${
|
|
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
|
-
|
|
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
|
};
|