testeranto 0.85.0 → 0.90.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 +1 -3
- package/bin/init-docs.js +24 -0
- package/bundle.js +53 -0
- package/dist/common/dist/module/src/Init.js +40 -0
- package/dist/common/src/Init.js +30 -0
- package/dist/common/src/PM/main.js +45 -9
- package/dist/common/src/Project.js +80 -0
- package/dist/common/src/Puppeteer.js +1 -1
- package/dist/common/{run-tests.js → src/build-tests.js} +10 -5
- package/dist/common/src/defaultConfig.js +19 -0
- package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +27 -15
- package/dist/common/src/init-docs.js +43 -0
- package/dist/common/src/lib/abstractBase.js +0 -64
- package/dist/common/src/lib/core.js +5 -3
- package/dist/common/{build-tests.js → src/run-tests.js} +10 -9
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/src/Init.js +30 -0
- package/dist/module/src/PM/main.js +45 -9
- package/dist/module/src/Project.js +80 -0
- package/dist/module/src/Puppeteer.js +1 -1
- package/dist/module/src/build-tests.js +11 -0
- package/dist/module/src/defaultConfig.js +17 -0
- package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +27 -15
- package/dist/module/src/init-docs.js +15 -0
- package/dist/module/src/lib/abstractBase.js +0 -64
- package/dist/module/src/lib/core.js +5 -3
- package/dist/module/src/run-tests.js +11 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/build-tests.mjs +552 -0
- package/dist/prebuild/init-docs.mjs +48 -0
- package/dist/prebuild/run-tests.mjs +907 -0
- package/dist/types/dist/module/src/Init.d.ts +2 -0
- package/dist/types/src/build-tests.d.ts +1 -0
- package/dist/types/src/defaultConfig.d.ts +3 -0
- package/dist/types/src/init-docs.d.ts +1 -0
- package/dist/types/src/run-tests.d.ts +1 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +9 -12
- package/src/Init.ts +28 -0
- package/src/PM/main.ts +58 -10
- package/src/Project.ts +102 -0
- package/src/Puppeteer.ts +1 -1
- package/src/build-tests.ts +12 -0
- package/src/defaultConfig.ts +20 -0
- package/src/esbuildConfigs/inputFilesPlugin.ts +48 -16
- package/src/init-docs.ts +19 -0
- package/src/lib/abstractBase.ts +0 -67
- package/src/lib/core.ts +3 -3
- package/src/run-tests.ts +12 -0
- package/tsconfig.json +1 -1
- package/build-tests.ts +0 -16
- package/dist/common/init-docs.js +0 -8
- package/dist/module/build-tests.js +0 -10
- package/dist/module/init-docs.js +0 -3
- package/dist/module/run-tests.js +0 -6
- package/dist/prebuild/Puppeteer.mjs +0 -82033
- package/dist/types/build-tests.d.ts +0 -3
- package/dist/types/init-docs.d.ts +0 -2
- package/dist/types/run-tests.d.ts +0 -2
- package/init-docs.ts +0 -5
- package/pupBuild.js +0 -18
- package/run-tests.ts +0 -9
package/package.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "testeranto",
|
|
3
|
-
"description": "
|
|
4
|
-
"version": "0.
|
|
3
|
+
"description": "the AI powered BDD test framework for typescript projects",
|
|
4
|
+
"version": "0.90.0",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": "18.18.0"
|
|
7
7
|
},
|
|
8
|
+
"bin": {
|
|
9
|
+
"testeranto-init": "bin/init-docs.js testeranto.mts"
|
|
10
|
+
},
|
|
8
11
|
"type": "module",
|
|
9
12
|
"types": "./dist/index.d.mts",
|
|
10
13
|
"module": "dist/module/index.js",
|
|
@@ -185,19 +188,13 @@
|
|
|
185
188
|
"ATDD"
|
|
186
189
|
],
|
|
187
190
|
"scripts": {
|
|
188
|
-
"commit": "yarn build; git add --all && git commit -m 'stash'",
|
|
189
191
|
"doit": "rm -rf node_modules && yarn install && yarn build",
|
|
190
|
-
"build": "sh prebuild.sh; cp ./src/cjs-shim.js ./dist/cjs-shim.js; tsc -p tsconfig.module.json; tsc -p tsconfig.common.json; tsc -p tsconfig.types.json; sh postBuild.sh",
|
|
192
|
+
"build": "sh prebuild.sh; cp ./src/cjs-shim.js ./dist/cjs-shim.js; tsc -p tsconfig.module.json; tsc -p tsconfig.common.json; tsc -p tsconfig.types.json; sh postBuild.sh; yarn bundle",
|
|
191
193
|
"dev": "cp ./src/cjs-shim.js ./dist/cjs-shim.js && tsc -p tsconfig.module.json --watch & tsc -p tsconfig.common.json --watch & tsc -p tsconfig.types.json --watch ",
|
|
192
|
-
"
|
|
194
|
+
"bundle": "node bundle.js",
|
|
193
195
|
"build-module": "tsc -p tsconfig.module.json",
|
|
194
196
|
"build-common": "tsc -p tsconfig.common.json",
|
|
195
|
-
"build-types": "tsc -p tsconfig.types.json"
|
|
196
|
-
"build-tests": "ts-node-esm ./project.ts",
|
|
197
|
-
"run-tests": "ts-node-esm ./run-tests.ts",
|
|
198
|
-
"init-docs": "ts-node-esm init-docs.ts",
|
|
199
|
-
"test": "yarn build-tests & yarn run-tests",
|
|
200
|
-
"scratch": "node scratch/build.js && node dist/scratch/server.js"
|
|
197
|
+
"build-types": "tsc -p tsconfig.types.json"
|
|
201
198
|
},
|
|
202
199
|
"peerDependencies": {
|
|
203
200
|
"@types/react": "18.2.0",
|
|
@@ -252,4 +249,4 @@
|
|
|
252
249
|
"why-is-node-running": "^3.2.2",
|
|
253
250
|
"ws": "^8.16.0"
|
|
254
251
|
}
|
|
255
|
-
}
|
|
252
|
+
}
|
package/src/Init.ts
CHANGED
|
@@ -6,6 +6,12 @@ export default async (partialConfig) => {
|
|
|
6
6
|
buildDir: process.cwd() + "/" + partialConfig.outdir,
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
+
try {
|
|
10
|
+
fs.mkdirSync(`${process.cwd()}/${config.outdir}`);
|
|
11
|
+
} catch {
|
|
12
|
+
// console.log()
|
|
13
|
+
}
|
|
14
|
+
|
|
9
15
|
fs.writeFileSync(
|
|
10
16
|
`${config.outdir}/testeranto.json`,
|
|
11
17
|
JSON.stringify(
|
|
@@ -17,4 +23,26 @@ export default async (partialConfig) => {
|
|
|
17
23
|
2
|
|
18
24
|
)
|
|
19
25
|
);
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
fs.mkdirSync(`${process.cwd()}/${config.outdir}/node`);
|
|
29
|
+
} catch {
|
|
30
|
+
// console.log()
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
try {
|
|
34
|
+
fs.mkdirSync(`${process.cwd()}/${config.outdir}/web`);
|
|
35
|
+
} catch {
|
|
36
|
+
// console.log()
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
fs.mkdirSync(`${process.cwd()}/${config.outdir}/features`);
|
|
40
|
+
} catch {
|
|
41
|
+
// console.log()
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
fs.mkdirSync(`${process.cwd()}/${config.outdir}/ts`);
|
|
45
|
+
} catch {
|
|
46
|
+
// console.log()
|
|
47
|
+
}
|
|
20
48
|
};
|
package/src/PM/main.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import puppeteer, {
|
|
3
|
+
import puppeteer, {
|
|
4
|
+
Browser,
|
|
5
|
+
ConsoleMessage,
|
|
6
|
+
ScreenshotOptions,
|
|
7
|
+
} from "puppeteer-core";
|
|
4
8
|
import { PassThrough } from "stream";
|
|
5
9
|
import crypto from "crypto";
|
|
6
10
|
|
|
@@ -11,10 +15,12 @@ import { destinationOfRuntime } from "../utils.js";
|
|
|
11
15
|
import { ITLog } from "../lib/index.js";
|
|
12
16
|
import { Page } from "puppeteer-core/lib/esm/puppeteer";
|
|
13
17
|
|
|
18
|
+
const fileStreams3: fs.WriteStream[] = [];
|
|
19
|
+
|
|
14
20
|
type IFPaths = string[];
|
|
15
21
|
|
|
16
22
|
const fPaths: IFPaths = [];
|
|
17
|
-
|
|
23
|
+
|
|
18
24
|
const files: Record<string, Set<string>> = {};
|
|
19
25
|
const screenshots: Record<string, Promise<Uint8Array>[]> = {};
|
|
20
26
|
|
|
@@ -395,6 +401,7 @@ export class PM_Main extends PM {
|
|
|
395
401
|
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
396
402
|
});
|
|
397
403
|
|
|
404
|
+
// files[src] = new Set();
|
|
398
405
|
// const evaluation = `
|
|
399
406
|
// console.log("importing ${dest}.mjs");
|
|
400
407
|
// import('${dest}.mjs').then(async (x) => {
|
|
@@ -482,9 +489,9 @@ export class PM_Main extends PM {
|
|
|
482
489
|
(fp: string, testName: string) => {
|
|
483
490
|
const f = fs.createWriteStream(fp);
|
|
484
491
|
|
|
485
|
-
if (!files[testName]) {
|
|
486
|
-
|
|
487
|
-
}
|
|
492
|
+
// if (!files[testName]) {
|
|
493
|
+
// files[testName] = new Set();
|
|
494
|
+
// }
|
|
488
495
|
files[testName].add(fp);
|
|
489
496
|
|
|
490
497
|
const p = new Promise<string>((res, rej) => {
|
|
@@ -659,6 +666,9 @@ export class PM_Main extends PM {
|
|
|
659
666
|
const fileStreams2: fs.WriteStream[] = [];
|
|
660
667
|
const doneFileStream2: Promise<any>[] = [];
|
|
661
668
|
|
|
669
|
+
const stdoutStream = fs.createWriteStream(`${dest}/stdout.log`);
|
|
670
|
+
const stderrStream = fs.createWriteStream(`${dest}/stderr.log`);
|
|
671
|
+
|
|
662
672
|
this.browser
|
|
663
673
|
.newPage()
|
|
664
674
|
.then((page) => {
|
|
@@ -884,9 +894,44 @@ export class PM_Main extends PM {
|
|
|
884
894
|
return page;
|
|
885
895
|
})
|
|
886
896
|
.then(async (page) => {
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
897
|
+
const close = () => {
|
|
898
|
+
console.log("evaluation complete.", dest);
|
|
899
|
+
page.off("pageerror");
|
|
900
|
+
page.close();
|
|
901
|
+
|
|
902
|
+
this.deregister(t);
|
|
903
|
+
stderrStream.close();
|
|
904
|
+
stdoutStream.close();
|
|
905
|
+
};
|
|
906
|
+
|
|
907
|
+
page.on("pageerror", (err: Error) => {
|
|
908
|
+
console.debug(`Error from ${t}: [${err.name}] `);
|
|
909
|
+
stderrStream.write(err.name);
|
|
910
|
+
|
|
911
|
+
if (err.cause) {
|
|
912
|
+
console.debug(`Error from ${t} cause: [${err.cause}] `);
|
|
913
|
+
stderrStream.write(err.cause);
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
if (err.stack) {
|
|
917
|
+
console.debug(`Error from stack ${t}: [${err.stack}] `);
|
|
918
|
+
stderrStream.write(err.stack);
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
console.debug(`Error from message ${t}: [${err.message}] `);
|
|
922
|
+
stderrStream.write(err.message);
|
|
923
|
+
// close();
|
|
924
|
+
});
|
|
925
|
+
page.on("console", (log: ConsoleMessage) => {
|
|
926
|
+
// console.debug(`Log from ${t}: [${log.text()}] `);
|
|
927
|
+
// console.debug(`Log from ${t}: [${JSON.stringify(log.location())}] `);
|
|
928
|
+
// console.debug(
|
|
929
|
+
// `Log from ${t}: [${JSON.stringify(log.stackTrace())}] `
|
|
930
|
+
// );
|
|
931
|
+
stdoutStream.write(log.text());
|
|
932
|
+
stdoutStream.write(JSON.stringify(log.location()));
|
|
933
|
+
stdoutStream.write(JSON.stringify(log.stackTrace()));
|
|
934
|
+
});
|
|
890
935
|
await page.goto(`file://${`${dest}.html`}`, {});
|
|
891
936
|
|
|
892
937
|
await page
|
|
@@ -899,9 +944,12 @@ export class PM_Main extends PM {
|
|
|
899
944
|
console.log(e);
|
|
900
945
|
})
|
|
901
946
|
.finally(() => {
|
|
902
|
-
|
|
947
|
+
close();
|
|
948
|
+
// console.log("evaluation complete.", dest);
|
|
903
949
|
// page.close();
|
|
904
|
-
this.deregister(t);
|
|
950
|
+
// this.deregister(t);
|
|
951
|
+
// stderrStream.close();
|
|
952
|
+
// stdoutStream.close();
|
|
905
953
|
});
|
|
906
954
|
|
|
907
955
|
return page;
|
package/src/Project.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { spawn } from "child_process";
|
|
2
|
+
|
|
1
3
|
import esbuild from "esbuild";
|
|
2
4
|
import fs from "fs";
|
|
3
5
|
import path from "path";
|
|
@@ -12,6 +14,104 @@ import { ITestTypes, IBaseConfig, IRunTime } from "./lib/types.js";
|
|
|
12
14
|
readline.emitKeypressEvents(process.stdin);
|
|
13
15
|
if (process.stdin.isTTY) process.stdin.setRawMode(true);
|
|
14
16
|
|
|
17
|
+
const logContent: string[] = [];
|
|
18
|
+
|
|
19
|
+
function parseTsErrors(): void {
|
|
20
|
+
try {
|
|
21
|
+
// const logContent = fs.readFileSync(logPath, "utf-8").split("\n");
|
|
22
|
+
const regex = /(^src(.*?))\(\d*,\d*\): error/gm;
|
|
23
|
+
const brokenFilesToLines: Record<string, Set<number>> = {};
|
|
24
|
+
|
|
25
|
+
for (let i = 0; i < logContent.length - 1; i++) {
|
|
26
|
+
let m;
|
|
27
|
+
|
|
28
|
+
while ((m = regex.exec(logContent[i])) !== null) {
|
|
29
|
+
// This is necessary to avoid infinite loops with zero-width matches
|
|
30
|
+
if (m.index === regex.lastIndex) {
|
|
31
|
+
regex.lastIndex++;
|
|
32
|
+
}
|
|
33
|
+
if (!brokenFilesToLines[m[1]]) {
|
|
34
|
+
brokenFilesToLines[m[1]] = new Set<number>();
|
|
35
|
+
}
|
|
36
|
+
brokenFilesToLines[m[1]].add(i);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const final = Object.keys(brokenFilesToLines).reduce((mm, lm, ndx) => {
|
|
41
|
+
mm[lm] = Array.from(brokenFilesToLines[lm]).map((l, ndx3) => {
|
|
42
|
+
const a = Array.from(brokenFilesToLines[lm]);
|
|
43
|
+
|
|
44
|
+
return Object.keys(a).reduce((mm2, lm2, ndx2) => {
|
|
45
|
+
const acc: string[] = [];
|
|
46
|
+
|
|
47
|
+
let j = a[lm2] + 1;
|
|
48
|
+
|
|
49
|
+
let working = true;
|
|
50
|
+
while (j < logContent.length - 1 && working) {
|
|
51
|
+
if (
|
|
52
|
+
!logContent[j].match(regex) &&
|
|
53
|
+
working &&
|
|
54
|
+
!logContent[j].match(/^..\/(.*?)\(\d*,\d*\)/)
|
|
55
|
+
) {
|
|
56
|
+
acc.push(logContent[j]);
|
|
57
|
+
} else {
|
|
58
|
+
working = false;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
j++;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
mm2[lm] = [logContent[l], ...acc];
|
|
65
|
+
|
|
66
|
+
return mm2;
|
|
67
|
+
}, {} as any)[lm];
|
|
68
|
+
});
|
|
69
|
+
return mm;
|
|
70
|
+
}, {});
|
|
71
|
+
|
|
72
|
+
Object.keys(final).forEach((k) => {
|
|
73
|
+
fs.mkdirSync(`./docs/types/${k.split("/").slice(0, -1).join("/")}`, {
|
|
74
|
+
recursive: true,
|
|
75
|
+
});
|
|
76
|
+
fs.writeFileSync(
|
|
77
|
+
`./docs/types/${k}.type_errors.txt`,
|
|
78
|
+
final[k].flat().flat().join("\r\n")
|
|
79
|
+
);
|
|
80
|
+
});
|
|
81
|
+
} catch (error) {
|
|
82
|
+
console.error("Error reading or parsing the log file:", error);
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const compile = () => {
|
|
88
|
+
return new Promise((resolve, reject) => {
|
|
89
|
+
const tsc = spawn("tsc", ["-noEmit"]);
|
|
90
|
+
|
|
91
|
+
tsc.stdout.on("data", (data) => {
|
|
92
|
+
// console.log(`stdout: ${data}`);
|
|
93
|
+
const lines = data.toString().split("\n");
|
|
94
|
+
logContent.push(...lines);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
tsc.stderr.on("data", (data) => {
|
|
98
|
+
// console.error(`stderr: ${data}`);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
tsc.on("close", (code) => {
|
|
102
|
+
parseTsErrors();
|
|
103
|
+
|
|
104
|
+
resolve(`tsc process exited with code ${code}`);
|
|
105
|
+
// if (code !== 0) {
|
|
106
|
+
// resolve(`tsc process exited with code ${code}`);
|
|
107
|
+
// // reject(`tsc process exited with code ${code}`);
|
|
108
|
+
// } else {
|
|
109
|
+
// resolve({});
|
|
110
|
+
// }
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
|
|
15
115
|
export class ITProject {
|
|
16
116
|
config: IBaseConfig;
|
|
17
117
|
mode: `DEV` | `PROD`;
|
|
@@ -43,6 +143,8 @@ export class ITProject {
|
|
|
43
143
|
)
|
|
44
144
|
);
|
|
45
145
|
|
|
146
|
+
compile();
|
|
147
|
+
|
|
46
148
|
Promise.resolve(
|
|
47
149
|
Promise.all(
|
|
48
150
|
[...this.getSecondaryEndpointsPoints("web")].map(
|
package/src/Puppeteer.ts
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import process from "process";
|
|
2
|
+
|
|
3
|
+
import { ITProject } from "./Project";
|
|
4
|
+
|
|
5
|
+
if (!process.argv[2]) {
|
|
6
|
+
console.log("You didn't pass a config file");
|
|
7
|
+
process.exit(-1);
|
|
8
|
+
} else {
|
|
9
|
+
import(process.cwd() + "/" + process.argv[2]).then((module) => {
|
|
10
|
+
new ITProject(module.default);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IBaseConfig } from "testeranto/src/lib/types.js";
|
|
2
|
+
|
|
3
|
+
const config: IBaseConfig = {
|
|
4
|
+
outdir: "docs",
|
|
5
|
+
tests: [],
|
|
6
|
+
debugger: true,
|
|
7
|
+
clearScreen: false,
|
|
8
|
+
devMode: true,
|
|
9
|
+
minify: false,
|
|
10
|
+
outbase: ".",
|
|
11
|
+
ports: ["3001"],
|
|
12
|
+
externals: [],
|
|
13
|
+
nodePlugins: [],
|
|
14
|
+
webPlugins: [],
|
|
15
|
+
featureIngestor: function (s: string): Promise<string> {
|
|
16
|
+
throw new Error("Function not implemented.");
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default config;
|
|
@@ -13,13 +13,20 @@ const register = (entrypoint: string, sources: string[]): void => {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
function tree(meta: Metafile, key: string) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
console.log("searching metafile for", key);
|
|
17
|
+
|
|
18
|
+
const outputKey = Object.keys(meta.outputs).find((k) => {
|
|
19
|
+
return meta.outputs[k].entryPoint === key;
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
if (!outputKey) {
|
|
23
|
+
console.error("No outputkey found");
|
|
24
|
+
process.exit(-1);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return Object.keys(meta.outputs[outputKey].inputs).filter((k) =>
|
|
28
|
+
k.startsWith("src")
|
|
29
|
+
);
|
|
23
30
|
}
|
|
24
31
|
|
|
25
32
|
export default (
|
|
@@ -72,7 +79,20 @@ export default (
|
|
|
72
79
|
platform,
|
|
73
80
|
entryPoint.split(".").slice(0, -1).join("."),
|
|
74
81
|
`featurePrompt.txt`
|
|
75
|
-
);
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const stderrPath = path.join(
|
|
85
|
+
"./docs/",
|
|
86
|
+
platform,
|
|
87
|
+
entryPoint.split(".").slice(0, -1).join("."),
|
|
88
|
+
`stderr.log`
|
|
89
|
+
);
|
|
90
|
+
const stdoutPath = path.join(
|
|
91
|
+
"./docs/",
|
|
92
|
+
platform,
|
|
93
|
+
entryPoint.split(".").slice(0, -1).join("."),
|
|
94
|
+
`stdout.log`
|
|
95
|
+
);
|
|
76
96
|
|
|
77
97
|
if (result.metafile) {
|
|
78
98
|
const addableFiles = tree(
|
|
@@ -87,26 +107,38 @@ export default (
|
|
|
87
107
|
})
|
|
88
108
|
.flat();
|
|
89
109
|
|
|
110
|
+
const typeErrorFiles = addableFiles.map(
|
|
111
|
+
(t) => `docs/types/${t}.type_errors.txt`
|
|
112
|
+
);
|
|
113
|
+
|
|
90
114
|
fs.writeFileSync(
|
|
91
115
|
promptPath,
|
|
92
116
|
`
|
|
93
|
-
${
|
|
117
|
+
${addableFiles
|
|
94
118
|
.map((x) => {
|
|
95
119
|
return `/add ${x}`;
|
|
96
120
|
})
|
|
97
121
|
.join("\n")}
|
|
98
|
-
|
|
122
|
+
|
|
123
|
+
${typeErrorFiles
|
|
99
124
|
.map((x) => {
|
|
100
|
-
const f = `docs/
|
|
101
|
-
|
|
102
|
-
if (fs.existsSync(f)) {
|
|
103
|
-
|
|
104
|
-
}
|
|
125
|
+
// const f = `docs/types/${x}.type_errors.txt`;
|
|
126
|
+
return `/read ${x}`;
|
|
127
|
+
// if (fs.existsSync(f)) {
|
|
128
|
+
// return `/read ${f}`;
|
|
129
|
+
// }
|
|
105
130
|
})
|
|
106
131
|
.join("\n")}
|
|
132
|
+
|
|
107
133
|
/read ${testPaths}
|
|
134
|
+
/read ${stdoutPath}
|
|
135
|
+
/read ${stderrPath}
|
|
136
|
+
|
|
108
137
|
/load ${featuresPath}
|
|
109
|
-
|
|
138
|
+
|
|
139
|
+
/code Fix the failing tests described in ${testPaths}. Correct any type signature errors described in the files [${typeErrorFiles.join(
|
|
140
|
+
", "
|
|
141
|
+
)}]. Implement any method which throws "Function not implemented."
|
|
110
142
|
`
|
|
111
143
|
);
|
|
112
144
|
}
|
package/src/init-docs.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import Init from "../dist/module/src/Init";
|
|
3
|
+
console.log("Initializing a testeranto project");
|
|
4
|
+
|
|
5
|
+
if (!process.argv[2]) {
|
|
6
|
+
console.log("You didn't pass a config file, so I will create one for you.");
|
|
7
|
+
|
|
8
|
+
fs.writeFileSync(
|
|
9
|
+
"testeranto.mts",
|
|
10
|
+
fs.readFileSync("node_modules/testeranto/src/defaultConfig.ts")
|
|
11
|
+
);
|
|
12
|
+
import(process.cwd() + "/" + "testeranto.mts").then((module) => {
|
|
13
|
+
Init(module.default);
|
|
14
|
+
});
|
|
15
|
+
} else {
|
|
16
|
+
import(process.cwd() + "/" + process.argv[2]).then((module) => {
|
|
17
|
+
Init(module.default);
|
|
18
|
+
});
|
|
19
|
+
}
|
package/src/lib/abstractBase.ts
CHANGED
|
@@ -494,73 +494,6 @@ export abstract class BaseGiven<
|
|
|
494
494
|
);
|
|
495
495
|
}
|
|
496
496
|
|
|
497
|
-
// if (prop === "browser") {
|
|
498
|
-
// return new Proxy(target[prop], {
|
|
499
|
-
// get(bTarget, bProp, bReceiver) {
|
|
500
|
-
// if (bProp === "pages") {
|
|
501
|
-
// return async () => {
|
|
502
|
-
// return bTarget.pages().then((pages) => {
|
|
503
|
-
// return pages.map((page) => {
|
|
504
|
-
// return new Proxy(page, {
|
|
505
|
-
// get(pTarget, pProp, pReciever) {
|
|
506
|
-
// if (pProp === "screenshot") {
|
|
507
|
-
// return async (x) => {
|
|
508
|
-
// // console.log(
|
|
509
|
-
// // "custom-screenshot-MARK-afterEachProxy",
|
|
510
|
-
// // window["custom-screenshot"].toString()
|
|
511
|
-
// // );
|
|
512
|
-
|
|
513
|
-
// return pm.customScreenShot(
|
|
514
|
-
// {
|
|
515
|
-
// ...x,
|
|
516
|
-
// path:
|
|
517
|
-
// `${testResourceConfiguration.fs}/suite-${suiteNdx}/given-${key}/afterEach` +
|
|
518
|
-
// "/" +
|
|
519
|
-
// x.path,
|
|
520
|
-
// },
|
|
521
|
-
// page
|
|
522
|
-
// );
|
|
523
|
-
|
|
524
|
-
// // return await pTarget[pProp]({
|
|
525
|
-
// // ...x,
|
|
526
|
-
// // path:
|
|
527
|
-
// // `${testResourceConfiguration.fs}/suite-${suiteNdx}/given-${key}/afterEach` +
|
|
528
|
-
// // "/" +
|
|
529
|
-
// // x.path,
|
|
530
|
-
// // });
|
|
531
|
-
// };
|
|
532
|
-
// } else if (pProp === "mainFrame") {
|
|
533
|
-
// return () => pTarget[pProp]();
|
|
534
|
-
// // return target[pProp];
|
|
535
|
-
// // return Reflect.get(...arguments);
|
|
536
|
-
// } else if (pProp === "exposeFunction") {
|
|
537
|
-
// // return Reflect.get(target, prop, receiver);
|
|
538
|
-
// return (...a) => pTarget[pProp](...a);
|
|
539
|
-
// // return target[pProp];
|
|
540
|
-
// } else if (pProp === "removeExposedFunction") {
|
|
541
|
-
// // return Reflect.get(target, prop, receiver);
|
|
542
|
-
// return pTarget[pProp].bind(pTarget);
|
|
543
|
-
// // return target[pProp];
|
|
544
|
-
// }
|
|
545
|
-
// // else if (pProp === "#frameManager") {
|
|
546
|
-
// // return () => target[pProp](...arguments);
|
|
547
|
-
// // }
|
|
548
|
-
// else {
|
|
549
|
-
// return Reflect.get(...arguments);
|
|
550
|
-
// }
|
|
551
|
-
// },
|
|
552
|
-
// });
|
|
553
|
-
// });
|
|
554
|
-
// });
|
|
555
|
-
// // return (await target.pages()).map((page) => {
|
|
556
|
-
// // return new Proxy(page, handler2);
|
|
557
|
-
// // });
|
|
558
|
-
// };
|
|
559
|
-
// }
|
|
560
|
-
// },
|
|
561
|
-
// });
|
|
562
|
-
// }
|
|
563
|
-
|
|
564
497
|
return Reflect.get(...arguments);
|
|
565
498
|
},
|
|
566
499
|
});
|
package/src/lib/core.ts
CHANGED
|
@@ -111,9 +111,9 @@ export default abstract class Testeranto<
|
|
|
111
111
|
return fullTestInterface.beforeEach(
|
|
112
112
|
subject,
|
|
113
113
|
initializer,
|
|
114
|
-
(fPath: string, value: unknown) =>
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
// (fPath: string, value: unknown) =>
|
|
115
|
+
// // TODO does not work?
|
|
116
|
+
// artifactory(`beforeEach/${fPath}`, value),
|
|
117
117
|
testResource,
|
|
118
118
|
this.initialValues,
|
|
119
119
|
pm
|
package/src/run-tests.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Puppeteer from "./Puppeteer.js";
|
|
2
|
+
|
|
3
|
+
import process from "process";
|
|
4
|
+
|
|
5
|
+
if (!process.argv[2]) {
|
|
6
|
+
console.log("You didn't pass a config file");
|
|
7
|
+
process.exit(-1);
|
|
8
|
+
} else {
|
|
9
|
+
import(process.cwd() + "/" + process.argv[2]).then((module) => {
|
|
10
|
+
Puppeteer(module.default);
|
|
11
|
+
});
|
|
12
|
+
}
|
package/tsconfig.json
CHANGED
package/build-tests.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// import { ITProject } from "./src/Project.js";
|
|
2
|
-
|
|
3
|
-
// import Project from "./testeranto.js";
|
|
4
|
-
|
|
5
|
-
import process from "process";
|
|
6
|
-
import { ITProject } from "./src/Project";
|
|
7
|
-
// import { ITProject } from "testeranto/src/Project";
|
|
8
|
-
|
|
9
|
-
// process.chdir(__dirname);
|
|
10
|
-
|
|
11
|
-
// import Puppeteer from "./src/Puppeteer.js";
|
|
12
|
-
|
|
13
|
-
console.log(process.argv);
|
|
14
|
-
const Project = await import(process.argv[2]);
|
|
15
|
-
|
|
16
|
-
export default new ITProject(Project as any);
|
package/dist/common/init-docs.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const Init_js_1 = __importDefault(require("./src/Init.js"));
|
|
7
|
-
const testeranto_js_1 = __importDefault(require("./testeranto.js"));
|
|
8
|
-
exports.default = (0, Init_js_1.default)(testeranto_js_1.default);
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
// import { ITProject } from "./src/Project.js";
|
|
2
|
-
// import Project from "./testeranto.js";
|
|
3
|
-
import process from "process";
|
|
4
|
-
import { ITProject } from "./src/Project";
|
|
5
|
-
// import { ITProject } from "testeranto/src/Project";
|
|
6
|
-
// process.chdir(__dirname);
|
|
7
|
-
// import Puppeteer from "./src/Puppeteer.js";
|
|
8
|
-
console.log(process.argv);
|
|
9
|
-
const Project = await import(process.argv[2]);
|
|
10
|
-
export default new ITProject(Project);
|
package/dist/module/init-docs.js
DELETED