testeranto 0.80.0 → 0.81.1
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/.aider.chat.history.md +980 -0
- package/.aider.input.history +87 -0
- package/.aider.tags.cache.v3/1c/30/af1de2ad7a137afeddb1b01e0c27.val +0 -0
- package/.aider.tags.cache.v3/1d/63/88318b65ce58b6bb0487e8ce2656.val +0 -0
- package/.aider.tags.cache.v3/2e/67/16ae65530b40038e48e00d666c63.val +0 -0
- package/.aider.tags.cache.v3/6f/94/80488a232866fcce7ee657da488b.val +0 -0
- package/.aider.tags.cache.v3/cache.db +0 -0
- package/.gitattributes +1 -0
- package/README.md +10 -6
- package/dist/common/src/Aider.js +116 -69
- package/dist/common/src/PM/main.js +49 -46
- package/dist/common/src/PM/node.js +1 -1
- package/dist/common/src/Project.js +46 -38
- package/dist/common/src/Puppeteer.js +44 -37
- package/dist/common/src/SubPackages/react-test-renderer/jsx/index.js +17 -2
- package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +39 -12
- package/dist/common/src/esbuildConfigs/web.js +3 -3
- package/dist/common/src/lib/abstractBase.js +41 -13
- package/dist/common/src/lib/basebuilder.js +6 -3
- package/dist/common/src/lib/core.js +47 -3
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/src/Aider.js +116 -69
- package/dist/module/src/PM/main.js +49 -46
- package/dist/module/src/PM/node.js +1 -1
- package/dist/module/src/Project.js +46 -38
- package/dist/module/src/Puppeteer.js +44 -37
- package/dist/module/src/SubPackages/react-test-renderer/jsx/index.js +17 -2
- package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +39 -12
- package/dist/module/src/esbuildConfigs/web.js +3 -3
- package/dist/module/src/lib/abstractBase.js +41 -13
- package/dist/module/src/lib/basebuilder.js +6 -3
- package/dist/module/src/lib/core.js +47 -3
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/types/src/PM/main.d.ts +7 -1
- package/dist/types/src/Project.d.ts +6 -1
- package/dist/types/src/lib/abstractBase.d.ts +1 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +11 -15
- package/secret +1 -0
- package/secret.env +2 -0
- package/src/Aider.ts +140 -97
- package/src/PM/main.ts +60 -56
- package/src/PM/node.ts +1 -1
- package/src/Project.ts +55 -48
- package/src/Puppeteer.ts +56 -49
- package/src/SubPackages/react-test-renderer/jsx/index.ts +25 -2
- package/src/esbuildConfigs/inputFilesPlugin.ts +77 -32
- package/src/esbuildConfigs/web.ts +3 -3
- package/src/lib/abstractBase.ts +48 -17
- package/src/lib/basebuilder.ts +8 -3
- package/src/lib/core.ts +55 -13
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import renderer, { act } from "react-test-renderer";
|
|
3
|
+
const Context = React.createContext({});
|
|
4
|
+
const AppContext = React.createContext({});
|
|
5
|
+
const contextValue = {
|
|
6
|
+
ingredients: ["flour", "sugar", "eggs"],
|
|
7
|
+
temperature: "200",
|
|
8
|
+
};
|
|
3
9
|
export const testInterface = {
|
|
4
10
|
butThen: async function (s, thenCB, tr) {
|
|
5
|
-
console.log("butThen", thenCB.toString());
|
|
11
|
+
// console.log("butThen", thenCB.toString());
|
|
6
12
|
return thenCB(s);
|
|
7
13
|
},
|
|
8
14
|
beforeEach: function (CComponent, props) {
|
|
9
15
|
let component;
|
|
10
16
|
act(() => {
|
|
11
|
-
component = renderer.create(
|
|
17
|
+
// component = renderer.create(
|
|
18
|
+
// React.createElement(
|
|
19
|
+
// AppContext.Provider,
|
|
20
|
+
// { value: contextValue },
|
|
21
|
+
// React.createElement(AppContext.Consumer, null, (context) =>
|
|
22
|
+
// React.createElement(CComponent, Object.assign({}, context, {}))
|
|
23
|
+
// )
|
|
24
|
+
// )
|
|
25
|
+
// );
|
|
26
|
+
component = renderer.create(React.createElement(CComponent, props, React.createElement(CComponent, props, [])));
|
|
12
27
|
});
|
|
13
28
|
return component;
|
|
14
29
|
},
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
export default (platform, entryPoints) => {
|
|
4
|
-
console.log("mark3", platform);
|
|
5
4
|
return {
|
|
6
5
|
name: "metafileWriter",
|
|
7
6
|
setup(build) {
|
|
8
7
|
build.onEnd((result) => {
|
|
9
8
|
if (result.errors.length === 0) {
|
|
10
9
|
entryPoints.forEach((entryPoint) => {
|
|
11
|
-
console.log("mark1", entryPoint);
|
|
12
10
|
const filePath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `inputFiles.json`);
|
|
11
|
+
const promptPath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `prompt.txt`);
|
|
12
|
+
const testPaths = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `tests.json`);
|
|
13
13
|
const dirName = path.dirname(filePath);
|
|
14
14
|
if (!fs.existsSync(dirName)) {
|
|
15
15
|
fs.mkdirSync(dirName, { recursive: true });
|
|
16
16
|
}
|
|
17
|
-
const
|
|
17
|
+
const j = Object.keys(Object.keys(result.metafile.outputs)
|
|
18
18
|
.filter((s) => {
|
|
19
19
|
if (!result.metafile.outputs[s].entryPoint) {
|
|
20
20
|
return false;
|
|
@@ -25,20 +25,47 @@ export default (platform, entryPoints) => {
|
|
|
25
25
|
.reduce((mm, el) => {
|
|
26
26
|
mm.push(result.metafile.outputs[el].inputs);
|
|
27
27
|
return mm;
|
|
28
|
-
}, [])[0])
|
|
29
|
-
.filter((f) => {
|
|
28
|
+
}, [])[0]).filter((f) => {
|
|
30
29
|
const regex = /^src\/.*/g;
|
|
31
30
|
const matches = f.match(regex);
|
|
32
31
|
const passes = (matches === null || matches === void 0 ? void 0 : matches.length) === 1;
|
|
33
32
|
return passes;
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
})
|
|
33
|
+
});
|
|
34
|
+
// .filter((f: string) => {
|
|
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
41
|
fs.writeFileSync(filePath, jsonContent);
|
|
42
|
+
fs.writeFileSync(promptPath, `
|
|
43
|
+
${j
|
|
44
|
+
.map((x) => {
|
|
45
|
+
return `/add ${x}`;
|
|
46
|
+
})
|
|
47
|
+
.join("\n")}
|
|
48
|
+
/read ${testPaths}
|
|
49
|
+
|
|
50
|
+
/code fix the failing tests described in ${filePath}.
|
|
51
|
+
`);
|
|
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
|
+
// );
|
|
42
69
|
});
|
|
43
70
|
}
|
|
44
71
|
});
|
|
@@ -11,10 +11,10 @@ export default (config, entryPoints) => {
|
|
|
11
11
|
outdir: config.outdir + "/web", alias: {
|
|
12
12
|
react: path.resolve("./node_modules/react"),
|
|
13
13
|
}, metafile: true, external: [
|
|
14
|
-
"testeranto.json",
|
|
15
|
-
"features.test.ts",
|
|
14
|
+
// "testeranto.json",
|
|
15
|
+
// "features.test.ts",
|
|
16
16
|
// "url",
|
|
17
|
-
"react",
|
|
17
|
+
// "react",
|
|
18
18
|
"path",
|
|
19
19
|
"fs",
|
|
20
20
|
"stream",
|
|
@@ -7,10 +7,22 @@ export class BaseSuite {
|
|
|
7
7
|
this.fails = [];
|
|
8
8
|
}
|
|
9
9
|
toObj() {
|
|
10
|
+
const givens = Object.keys(this.givens).map((k) => this.givens[k].toObj());
|
|
11
|
+
const features = Object.keys(this.givens)
|
|
12
|
+
.map((k) => this.givens[k].features)
|
|
13
|
+
.flat()
|
|
14
|
+
.filter((value, index, array) => {
|
|
15
|
+
return array.indexOf(value) === index;
|
|
16
|
+
})
|
|
17
|
+
.reduce((mm, lm) => {
|
|
18
|
+
mm[lm] = lm;
|
|
19
|
+
return mm;
|
|
20
|
+
}, {});
|
|
10
21
|
return {
|
|
11
22
|
name: this.name,
|
|
12
|
-
givens
|
|
23
|
+
givens,
|
|
13
24
|
fails: this.fails,
|
|
25
|
+
features,
|
|
14
26
|
};
|
|
15
27
|
}
|
|
16
28
|
setup(s, artifactory, tr, pm) {
|
|
@@ -226,7 +238,7 @@ export class BaseGiven {
|
|
|
226
238
|
},
|
|
227
239
|
});
|
|
228
240
|
this.store = await this.givenThat(subject, testResourceConfiguration, givenArtifactory, this.givenCB, beforeEachProxy);
|
|
229
|
-
console.log("mark6", this.store);
|
|
241
|
+
// console.log("mark6", this.store);
|
|
230
242
|
for (const [whenNdx, whenStep] of this.whens.entries()) {
|
|
231
243
|
await whenStep.test(this.store, testResourceConfiguration, tLog, pm, `suite-${suiteNdx}/given-${key}/when/${whenNdx}`);
|
|
232
244
|
}
|
|
@@ -325,7 +337,7 @@ export class BaseGiven {
|
|
|
325
337
|
return Reflect.get(...arguments);
|
|
326
338
|
},
|
|
327
339
|
});
|
|
328
|
-
console.log("mark5", this.store, key);
|
|
340
|
+
// console.log("mark5", this.store, key);
|
|
329
341
|
await this.afterEach(this.store, key, givenArtifactory, afterEachProxy);
|
|
330
342
|
}
|
|
331
343
|
catch (e) {
|
|
@@ -443,13 +455,21 @@ export class BaseWhen {
|
|
|
443
455
|
return Reflect.get(...arguments);
|
|
444
456
|
},
|
|
445
457
|
});
|
|
446
|
-
|
|
447
|
-
return await this.andWhen(store, this.whenCB, testResourceConfiguration, andWhenProxy);
|
|
448
|
-
}
|
|
449
|
-
catch (e) {
|
|
458
|
+
return this.andWhen(store, this.whenCB, testResourceConfiguration, andWhenProxy).catch((e) => {
|
|
450
459
|
this.error = true;
|
|
451
|
-
throw e;
|
|
452
|
-
}
|
|
460
|
+
// throw e;
|
|
461
|
+
});
|
|
462
|
+
// try {
|
|
463
|
+
// return await this.andWhen(
|
|
464
|
+
// store,
|
|
465
|
+
// this.whenCB,
|
|
466
|
+
// testResourceConfiguration,
|
|
467
|
+
// andWhenProxy
|
|
468
|
+
// );
|
|
469
|
+
// } catch (e) {
|
|
470
|
+
// this.error = true;
|
|
471
|
+
// throw e;
|
|
472
|
+
// }
|
|
453
473
|
}
|
|
454
474
|
}
|
|
455
475
|
export class BaseThen {
|
|
@@ -529,10 +549,18 @@ export class BaseThen {
|
|
|
529
549
|
return Reflect.get(...arguments);
|
|
530
550
|
},
|
|
531
551
|
});
|
|
532
|
-
const x = await this.butThen(
|
|
533
|
-
//
|
|
534
|
-
|
|
535
|
-
|
|
552
|
+
// const x = await this.butThen(
|
|
553
|
+
// store,
|
|
554
|
+
// this.thenCB,
|
|
555
|
+
// testResourceConfiguration,
|
|
556
|
+
// butThenProxy
|
|
557
|
+
// );
|
|
558
|
+
// return x;
|
|
559
|
+
return this.butThen(store, this.thenCB, testResourceConfiguration, butThenProxy).catch((e) => {
|
|
560
|
+
console.log("mar123");
|
|
561
|
+
this.error = true;
|
|
562
|
+
throw e;
|
|
563
|
+
});
|
|
536
564
|
}
|
|
537
565
|
catch (e) {
|
|
538
566
|
console.log("test failed", e);
|
|
@@ -13,12 +13,15 @@ export class BaseBuilder {
|
|
|
13
13
|
this.specs = testSpecification(this.Suites(), this.Given(), this.When(), this.Then(), this.Check());
|
|
14
14
|
this.testJobs = this.specs.map((suite) => {
|
|
15
15
|
const suiteRunner = (suite) => async (puppetMaster, tLog) => {
|
|
16
|
-
await puppetMaster.startPuppeteer({
|
|
16
|
+
const puppeteerBrowser = await puppetMaster.startPuppeteer({
|
|
17
17
|
browserWSEndpoint: puppetMaster.testResourceConfiguration.browserWSEndpoint,
|
|
18
18
|
}, puppetMaster.testResourceConfiguration.fs);
|
|
19
|
-
|
|
19
|
+
const x = await suite.run(input, puppetMaster.testResourceConfiguration, (fPath, value) => puppetMaster.testArtiFactoryfileWriter(tLog, (p) => {
|
|
20
20
|
this.artifacts.push(p);
|
|
21
21
|
})(puppetMaster.testResourceConfiguration.fs + "/" + fPath, value), tLog, puppetMaster);
|
|
22
|
+
// await puppetMaster.browser.disconnect();
|
|
23
|
+
// puppeteerBrowser.close();
|
|
24
|
+
return x;
|
|
22
25
|
};
|
|
23
26
|
const runner = suiteRunner(suite);
|
|
24
27
|
return {
|
|
@@ -28,7 +31,7 @@ export class BaseBuilder {
|
|
|
28
31
|
},
|
|
29
32
|
runner,
|
|
30
33
|
receiveTestResourceConfig: async function (puppetMaster) {
|
|
31
|
-
await puppetMaster.mkdirSync();
|
|
34
|
+
// await puppetMaster.mkdirSync();
|
|
32
35
|
const logFilePath = "log.txt";
|
|
33
36
|
const access = await puppetMaster.createWriteStream(logFilePath);
|
|
34
37
|
const tLog = (...l) => {
|
|
@@ -46,11 +46,55 @@ export default class Testeranto extends ClassBuilder {
|
|
|
46
46
|
}
|
|
47
47
|
}, class When extends BaseWhen {
|
|
48
48
|
async andWhen(store, whenCB, testResource, pm) {
|
|
49
|
-
|
|
49
|
+
try {
|
|
50
|
+
return await fullTestInterface.andWhen(store, whenCB, testResource, pm);
|
|
51
|
+
}
|
|
52
|
+
catch (e) {
|
|
53
|
+
throw e;
|
|
54
|
+
}
|
|
55
|
+
// return fullTestInterface
|
|
56
|
+
// .andWhen(store, whenCB, testResource, pm)
|
|
57
|
+
// .catch((e) => {
|
|
58
|
+
// throw e;
|
|
59
|
+
// });
|
|
60
|
+
// return new Promise((res, rej) => {
|
|
61
|
+
// fullTestInterface.andWhen(store, whenCB, testResource, pm);
|
|
62
|
+
// });
|
|
63
|
+
// return await fullTestInterface.andWhen(
|
|
64
|
+
// store,
|
|
65
|
+
// whenCB,
|
|
66
|
+
// testResource,
|
|
67
|
+
// pm
|
|
68
|
+
// );
|
|
50
69
|
}
|
|
51
70
|
}, class Then extends BaseThen {
|
|
52
|
-
async butThen(store, thenCB,
|
|
53
|
-
return
|
|
71
|
+
async butThen(store, thenCB, testResource, pm) {
|
|
72
|
+
return fullTestInterface
|
|
73
|
+
.butThen(store, thenCB, testResource, pm)
|
|
74
|
+
.then((v) => {
|
|
75
|
+
return v;
|
|
76
|
+
}, (e) => {
|
|
77
|
+
console.log(" ERROR ", e);
|
|
78
|
+
throw e;
|
|
79
|
+
});
|
|
80
|
+
// try {
|
|
81
|
+
// console.log("mark 4");
|
|
82
|
+
// return await fullTestInterface.butThen(
|
|
83
|
+
// store,
|
|
84
|
+
// thenCB,
|
|
85
|
+
// testResource,
|
|
86
|
+
// pm
|
|
87
|
+
// );
|
|
88
|
+
// } catch (e) {
|
|
89
|
+
// console.log("mar123");
|
|
90
|
+
// throw e;
|
|
91
|
+
// }
|
|
92
|
+
// return await fullTestInterface.butThen(
|
|
93
|
+
// store,
|
|
94
|
+
// thenCB,
|
|
95
|
+
// testResourceConfiguration,
|
|
96
|
+
// pm
|
|
97
|
+
// );
|
|
54
98
|
}
|
|
55
99
|
}, class Check extends BaseCheck {
|
|
56
100
|
constructor(name, features, checkCallback, whens, thens, initialValues) {
|