testeranto 0.94.0 → 0.100.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/bundle.js +4 -7
- package/dist/common/src/PM/main.js +160 -42
- package/dist/common/src/PM/node.js +20 -5
- package/dist/common/src/PM/web.js +19 -4
- package/dist/common/src/SubPackages/react/jsx/node.js +1 -6
- package/dist/common/src/cli.js +439 -0
- package/dist/common/src/cli2.js +144 -0
- package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +18 -6
- package/dist/common/src/esbuildConfigs/node.js +1 -4
- package/dist/common/src/esbuildConfigs/web.js +1 -1
- package/dist/common/src/lib/abstractBase.js +14 -91
- package/dist/common/src/lib/types.js +1 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/src/PM/main.js +160 -42
- package/dist/module/src/PM/node.js +20 -5
- package/dist/module/src/PM/web.js +19 -4
- package/dist/module/src/SubPackages/react/jsx/node.js +1 -6
- package/dist/module/src/cli.js +411 -0
- package/dist/module/src/cli2.js +116 -0
- package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +18 -6
- package/dist/module/src/esbuildConfigs/node.js +1 -4
- package/dist/module/src/esbuildConfigs/web.js +1 -1
- package/dist/module/src/lib/abstractBase.js +14 -91
- package/dist/module/src/lib/types.js +1 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/cli.mjs +1491 -0
- package/dist/prebuild/{run-tests.mjs → cli2.mjs} +203 -156
- package/dist/types/src/Node.d.ts +2 -2
- package/dist/types/src/PM/index.d.ts +10 -2
- package/dist/types/src/PM/main.d.ts +13 -7
- package/dist/types/src/PM/node.d.ts +9 -2
- package/dist/types/src/PM/web.d.ts +9 -3
- package/dist/types/src/SubPackages/puppeteer.d.ts +1 -1
- package/dist/types/src/SubPackages/react/component/node.d.ts +1 -1
- package/dist/types/src/SubPackages/react/component/web.d.ts +1 -1
- package/dist/types/src/SubPackages/react/jsx/node.d.ts +3 -3
- package/dist/types/src/SubPackages/react/jsx/web.d.ts +2 -2
- package/dist/types/src/SubPackages/react-dom/component/node.d.ts +2 -2
- package/dist/types/src/SubPackages/react-dom/component/web.d.ts +1 -1
- package/dist/types/src/SubPackages/react-dom/jsx/node.d.ts +1 -1
- package/dist/types/src/SubPackages/react-dom/jsx/web.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/component/node.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/component/web.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/fc/node.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/fc/web.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/jsx/node.d.ts +3 -2
- package/dist/types/src/SubPackages/react-test-renderer/jsx/web.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/node.d.ts +2 -2
- package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/web.d.ts +2 -2
- package/dist/types/src/Types.d.ts +60 -21
- package/dist/types/src/Web.d.ts +2 -2
- package/dist/types/src/lib/index.d.ts +1 -1
- package/dist/types/src/lib/types.d.ts +2 -30
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +11 -8
- package/src/PM/index.ts +12 -8
- package/src/PM/main.ts +218 -62
- package/src/PM/node.ts +42 -7
- package/src/PM/web.ts +33 -5
- package/src/SubPackages/react/jsx/node.ts +16 -5
- package/src/SubPackages/react-test-renderer/jsx/node.ts +16 -1
- package/src/Types.ts +362 -114
- package/src/cli.ts +535 -0
- package/src/cli2.ts +157 -0
- package/src/esbuildConfigs/inputFilesPlugin.ts +27 -6
- package/src/esbuildConfigs/node.ts +4 -7
- package/src/esbuildConfigs/web.ts +4 -3
- package/src/lib/abstractBase.ts +58 -115
- package/src/lib/types.ts +3 -177
- package/dist/common/src/Aider.js +0 -143
- package/dist/common/src/Project.js +0 -227
- package/dist/common/src/Puppeteer.js +0 -111
- package/dist/common/src/build-tests.js +0 -39
- package/dist/common/src/esbuildConfigs/features.js +0 -14
- package/dist/common/src/esbuildConfigs/report.js +0 -14
- package/dist/common/src/esbuildConfigs/tests.js +0 -13
- package/dist/common/src/run-tests.js +0 -39
- package/dist/module/src/Aider.js +0 -136
- package/dist/module/src/Project.js +0 -220
- package/dist/module/src/Puppeteer.js +0 -106
- package/dist/module/src/build-tests.js +0 -11
- package/dist/module/src/esbuildConfigs/features.js +0 -12
- package/dist/module/src/esbuildConfigs/report.js +0 -14
- package/dist/module/src/esbuildConfigs/tests.js +0 -11
- package/dist/module/src/run-tests.js +0 -11
- package/dist/prebuild/build-tests.mjs +0 -553
- package/dist/types/src/Aider.d.ts +0 -1
- package/dist/types/src/Project.d.ts +0 -12
- package/dist/types/src/Puppeteer.d.ts +0 -2
- package/dist/types/src/esbuildConfigs/features.d.ts +0 -4
- package/dist/types/src/esbuildConfigs/report.d.ts +0 -0
- package/dist/types/src/esbuildConfigs/tests.d.ts +0 -4
- package/src/Aider.ts +0 -168
- package/src/Project.ts +0 -292
- package/src/Puppeteer.ts +0 -143
- package/src/build-tests.ts +0 -12
- package/src/esbuildConfigs/features.ts +0 -17
- package/src/esbuildConfigs/report.ts +0 -15
- package/src/esbuildConfigs/tests.ts +0 -14
- package/src/run-tests.ts +0 -12
- /package/dist/types/src/{build-tests.d.ts → cli.d.ts} +0 -0
- /package/dist/types/src/{run-tests.d.ts → cli2.d.ts} +0 -0
package/dist/common/src/Aider.js
DELETED
|
@@ -1,143 +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
|
-
exports.execCommand = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const child_process_1 = require("child_process");
|
|
9
|
-
const execCommand = async (command) => {
|
|
10
|
-
const ls = (0, child_process_1.spawn)(command.split(" ")[0], command.split(" ").slice(1, -1));
|
|
11
|
-
process.stdin.pipe(ls.stdin);
|
|
12
|
-
ls.stdout.pipe(process.stdout);
|
|
13
|
-
ls.stderr.pipe(process.stdout);
|
|
14
|
-
// ls.stdout.on("data", function (data) {
|
|
15
|
-
// console.log("stdout: " + data.toString());
|
|
16
|
-
// });
|
|
17
|
-
// ls.stderr.on("data", function (data) {
|
|
18
|
-
// console.log("stderr: " + data.toString());
|
|
19
|
-
// });
|
|
20
|
-
ls.on("exit", function (code) {
|
|
21
|
-
console.log("child process exited with code " + (code === null || code === void 0 ? void 0 : code.toString()) || -1);
|
|
22
|
-
});
|
|
23
|
-
// return new Promise<void>((resolve, reject) => {
|
|
24
|
-
// const [cmd, ...args] = command.split(" ");
|
|
25
|
-
// const childProcess = spawn(cmd, args);
|
|
26
|
-
// childProcess.stdout.on("data", (data) => {
|
|
27
|
-
// process.stdout.write(data.toString());
|
|
28
|
-
// });
|
|
29
|
-
// childProcess.stderr.on("data", (data) => {
|
|
30
|
-
// process.stderr.write(data.toString());
|
|
31
|
-
// });
|
|
32
|
-
// childProcess.on("error", (error) => {
|
|
33
|
-
// reject(error);
|
|
34
|
-
// });
|
|
35
|
-
// childProcess.on("exit", (code) => {
|
|
36
|
-
// if (code === 0) {
|
|
37
|
-
// resolve();
|
|
38
|
-
// } else {
|
|
39
|
-
// reject(new Error(`Command exited with code ${code}.`));
|
|
40
|
-
// }
|
|
41
|
-
// });
|
|
42
|
-
// });
|
|
43
|
-
};
|
|
44
|
-
exports.execCommand = execCommand;
|
|
45
|
-
const key = process.argv[2];
|
|
46
|
-
console.log(key);
|
|
47
|
-
const exitcode = fs_1.default.readFileSync(`${key}/exitcode`).toString();
|
|
48
|
-
console.log("exitcode", exitcode);
|
|
49
|
-
// if (exitcode != "0") {
|
|
50
|
-
if (exitcode != "0") {
|
|
51
|
-
const inputFiles = JSON.parse(fs_1.default.readFileSync(`${key}/inputFiles.json`).toString());
|
|
52
|
-
inputFiles.push(`${key}/tests.json`);
|
|
53
|
-
// const features = await await Promise.all(
|
|
54
|
-
// Array.from(
|
|
55
|
-
// new Set(
|
|
56
|
-
// JSON.parse(fs.readFileSync(`${key}/tests.json`).toString())
|
|
57
|
-
// .givens.reduce((mm: any[], lm: { features: any[] }) => {
|
|
58
|
-
// mm.push(
|
|
59
|
-
// lm.features.reduce((mm2: any[], lm2: any) => {
|
|
60
|
-
// mm2.push(lm2);
|
|
61
|
-
// return mm2;
|
|
62
|
-
// }, [])
|
|
63
|
-
// );
|
|
64
|
-
// return mm;
|
|
65
|
-
// }, [])
|
|
66
|
-
// .flat()
|
|
67
|
-
// .flat()
|
|
68
|
-
// )
|
|
69
|
-
// ) as string[]
|
|
70
|
-
// );
|
|
71
|
-
// const final = features.reduce((mm, [k, v], ndx) => {
|
|
72
|
-
// mm[k] = v;
|
|
73
|
-
// return mm;
|
|
74
|
-
// }, {});
|
|
75
|
-
// const as = JSON.stringify(final);
|
|
76
|
-
// const scriptCommand = `aider --model deepseek --api-key deepseek=${
|
|
77
|
-
// process.env.DEEPSEEK_KEY
|
|
78
|
-
// } --message "Fix the failing tests" --read ${key}/inputFiles.json ${inputFiles
|
|
79
|
-
// .map((i) => `--file ${i}`)
|
|
80
|
-
// .join(" ")}`;
|
|
81
|
-
const scriptCommand = `aider --message "Fix the failing tests" --model deepseek --api-key deepseek=${process.env.DEEPSEEK_KEY} --file ./${inputFiles.join(" ./")}`;
|
|
82
|
-
console.log("scriptCommand", scriptCommand);
|
|
83
|
-
(0, exports.execCommand)(scriptCommand);
|
|
84
|
-
// fs.writeFile(`./${key}/features.json`, as, () => {
|
|
85
|
-
// inputFiles.push(`./${key}/features.json`);
|
|
86
|
-
// // itermTab(scriptCommand).then(() => console.log("yay"));
|
|
87
|
-
// // const child = spawn("xterm -e", scriptCommand.split(" "), {
|
|
88
|
-
// // detached: true,
|
|
89
|
-
// // stdio: "ignore",
|
|
90
|
-
// // });
|
|
91
|
-
// // runCommandInITerm(scriptCommand);
|
|
92
|
-
// });
|
|
93
|
-
// .reduce(async (mm, feature) => {
|
|
94
|
-
// const req = await octokit.request(
|
|
95
|
-
// `GET /repos/adamwong246/kokomobay-taskman/contents/Task/${feature}.json`,
|
|
96
|
-
// {
|
|
97
|
-
// owner: "adamwong246",
|
|
98
|
-
// repo: "kokomoBay-taskman",
|
|
99
|
-
// path: `Task/${feature}.json`,
|
|
100
|
-
// headers: {
|
|
101
|
-
// "X-GitHub-Api-Version": "2022-11-28",
|
|
102
|
-
// },
|
|
103
|
-
// }
|
|
104
|
-
// );
|
|
105
|
-
// const j = JSON.parse(atob(req.data.content));
|
|
106
|
-
// (await mm).push([
|
|
107
|
-
// feature,
|
|
108
|
-
// JSON.stringify({
|
|
109
|
-
// name: j.name,
|
|
110
|
-
// body: j.body,
|
|
111
|
-
// }),
|
|
112
|
-
// ]);
|
|
113
|
-
// return mm;
|
|
114
|
-
// }, Promise.resolve<[string, string][]>([]))
|
|
115
|
-
// .then((z) => {
|
|
116
|
-
// const final = z.reduce((mm, [k, v], ndx) => {
|
|
117
|
-
// mm[k] = v;
|
|
118
|
-
// return mm;
|
|
119
|
-
// }, {});
|
|
120
|
-
// const as = JSON.stringify(final);
|
|
121
|
-
// fs.writeFile(`./${key}/features.json`, as, () => {
|
|
122
|
-
// inputFiles.push(`./${key}/features.json`);
|
|
123
|
-
// const scriptCommand = `aider --model deepseek --api-key deepseek=${
|
|
124
|
-
// process.env.DEEPSEEK_KEY
|
|
125
|
-
// } --message "Fix the failing tests" ${inputFiles.join(" ")}`;
|
|
126
|
-
// console.log("scriptCommand", scriptCommand);
|
|
127
|
-
// execCommand(scriptCommand);
|
|
128
|
-
// // itermTab(scriptCommand).then(() => console.log("yay"));
|
|
129
|
-
// // const child = spawn("xterm -e", scriptCommand.split(" "), {
|
|
130
|
-
// // detached: true,
|
|
131
|
-
// // stdio: "ignore",
|
|
132
|
-
// // });
|
|
133
|
-
// // runCommandInITerm(scriptCommand);
|
|
134
|
-
// });
|
|
135
|
-
// //
|
|
136
|
-
// });
|
|
137
|
-
// features.then((x) => {
|
|
138
|
-
// console.log("done", x);
|
|
139
|
-
// });
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
console.log("that test is not failing");
|
|
143
|
-
}
|
|
@@ -1,227 +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
|
-
exports.ITProject = void 0;
|
|
7
|
-
const child_process_1 = require("child_process");
|
|
8
|
-
const esbuild_1 = __importDefault(require("esbuild"));
|
|
9
|
-
const fs_1 = __importDefault(require("fs"));
|
|
10
|
-
const path_1 = __importDefault(require("path"));
|
|
11
|
-
const readline_1 = __importDefault(require("readline"));
|
|
12
|
-
const glob_1 = require("glob");
|
|
13
|
-
const node_js_1 = __importDefault(require("./esbuildConfigs/node.js"));
|
|
14
|
-
const web_js_1 = __importDefault(require("./esbuildConfigs/web.js"));
|
|
15
|
-
const web_html_js_1 = __importDefault(require("./web.html.js"));
|
|
16
|
-
readline_1.default.emitKeypressEvents(process.stdin);
|
|
17
|
-
if (process.stdin.isTTY)
|
|
18
|
-
process.stdin.setRawMode(true);
|
|
19
|
-
const logContent = [];
|
|
20
|
-
function parseTsErrors() {
|
|
21
|
-
try {
|
|
22
|
-
// const logContent = fs.readFileSync(logPath, "utf-8").split("\n");
|
|
23
|
-
const regex = /(^src(.*?))\(\d*,\d*\): error/gm;
|
|
24
|
-
const brokenFilesToLines = {};
|
|
25
|
-
for (let i = 0; i < logContent.length - 1; i++) {
|
|
26
|
-
let m;
|
|
27
|
-
while ((m = regex.exec(logContent[i])) !== null) {
|
|
28
|
-
// This is necessary to avoid infinite loops with zero-width matches
|
|
29
|
-
if (m.index === regex.lastIndex) {
|
|
30
|
-
regex.lastIndex++;
|
|
31
|
-
}
|
|
32
|
-
if (!brokenFilesToLines[m[1]]) {
|
|
33
|
-
brokenFilesToLines[m[1]] = new Set();
|
|
34
|
-
}
|
|
35
|
-
brokenFilesToLines[m[1]].add(i);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
const final = Object.keys(brokenFilesToLines).reduce((mm, lm, ndx) => {
|
|
39
|
-
mm[lm] = Array.from(brokenFilesToLines[lm]).map((l, ndx3) => {
|
|
40
|
-
const a = Array.from(brokenFilesToLines[lm]);
|
|
41
|
-
return Object.keys(a).reduce((mm2, lm2, ndx2) => {
|
|
42
|
-
const acc = [];
|
|
43
|
-
let j = a[lm2] + 1;
|
|
44
|
-
let working = true;
|
|
45
|
-
while (j < logContent.length - 1 && working) {
|
|
46
|
-
if (!logContent[j].match(regex) &&
|
|
47
|
-
working &&
|
|
48
|
-
!logContent[j].match(/^..\/(.*?)\(\d*,\d*\)/)) {
|
|
49
|
-
acc.push(logContent[j]);
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
working = false;
|
|
53
|
-
}
|
|
54
|
-
j++;
|
|
55
|
-
}
|
|
56
|
-
mm2[lm] = [logContent[l], ...acc];
|
|
57
|
-
return mm2;
|
|
58
|
-
}, {})[lm];
|
|
59
|
-
});
|
|
60
|
-
return mm;
|
|
61
|
-
}, {});
|
|
62
|
-
Object.keys(final).forEach((k) => {
|
|
63
|
-
fs_1.default.mkdirSync(`./docs/types/${k.split("/").slice(0, -1).join("/")}`, {
|
|
64
|
-
recursive: true,
|
|
65
|
-
});
|
|
66
|
-
fs_1.default.writeFileSync(`./docs/types/${k}.type_errors.txt`, final[k].flat().flat().join("\r\n"));
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
catch (error) {
|
|
70
|
-
console.error("Error reading or parsing the log file:", error);
|
|
71
|
-
process.exit(1);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
const compile = () => {
|
|
75
|
-
return new Promise((resolve, reject) => {
|
|
76
|
-
const tsc = (0, child_process_1.spawn)("tsc", ["-noEmit"]);
|
|
77
|
-
tsc.stdout.on("data", (data) => {
|
|
78
|
-
// console.log(`tsc stdout: ${data}`);
|
|
79
|
-
const lines = data.toString().split("\n");
|
|
80
|
-
logContent.push(...lines);
|
|
81
|
-
});
|
|
82
|
-
tsc.stderr.on("data", (data) => {
|
|
83
|
-
console.error(`stderr: ${data}`);
|
|
84
|
-
process.exit(-1);
|
|
85
|
-
});
|
|
86
|
-
tsc.on("close", (code) => {
|
|
87
|
-
parseTsErrors();
|
|
88
|
-
console.log("tsc done");
|
|
89
|
-
resolve(`tsc process exited with code ${code}`);
|
|
90
|
-
// if (code !== 0) {
|
|
91
|
-
// resolve(`tsc process exited with code ${code}`);
|
|
92
|
-
// // reject(`tsc process exited with code ${code}`);
|
|
93
|
-
// } else {
|
|
94
|
-
// resolve({});
|
|
95
|
-
// }
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
class ITProject {
|
|
100
|
-
constructor(configs) {
|
|
101
|
-
this.nodeDone = false;
|
|
102
|
-
this.webDone = false;
|
|
103
|
-
this.onNodeDone = () => {
|
|
104
|
-
this.nodeDone = true;
|
|
105
|
-
this.onDone();
|
|
106
|
-
};
|
|
107
|
-
this.onWebDone = () => {
|
|
108
|
-
this.webDone = true;
|
|
109
|
-
this.onDone();
|
|
110
|
-
};
|
|
111
|
-
this.onDone = () => {
|
|
112
|
-
// console.log(this.nodeDone && this.webDone && this.mode === "PROD");
|
|
113
|
-
if (this.nodeDone && this.webDone && this.mode === "PROD") {
|
|
114
|
-
console.log("Testeranto-EsBuild is all done. Goodbye!");
|
|
115
|
-
process.exit();
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
if (this.mode === "PROD") {
|
|
119
|
-
console.log("waiting for tests to finish");
|
|
120
|
-
console.log(JSON.stringify({
|
|
121
|
-
nodeDone: this.nodeDone,
|
|
122
|
-
webDone: this.webDone,
|
|
123
|
-
mode: this.mode,
|
|
124
|
-
}, null, 2));
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
console.log("waiting for tests to change");
|
|
128
|
-
}
|
|
129
|
-
console.log("press 'q' to quit");
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
this.config = configs;
|
|
133
|
-
this.mode = this.config.devMode ? "DEV" : "PROD";
|
|
134
|
-
process.stdin.on("keypress", (str, key) => {
|
|
135
|
-
if (key.name === "q") {
|
|
136
|
-
console.log("Testeranto-EsBuild is shutting down...");
|
|
137
|
-
this.mode = "PROD";
|
|
138
|
-
this.onDone();
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
fs_1.default.writeFileSync(`${this.config.outdir}/testeranto.json`, JSON.stringify(Object.assign(Object.assign({}, this.config), { buildDir: process.cwd() + "/" + this.config.outdir }), null, 2));
|
|
142
|
-
Promise.resolve(Promise.all([...this.getSecondaryEndpointsPoints("web")].map(async (sourceFilePath) => {
|
|
143
|
-
const sourceFileSplit = sourceFilePath.split("/");
|
|
144
|
-
const sourceDir = sourceFileSplit.slice(0, -1);
|
|
145
|
-
const sourceFileName = sourceFileSplit[sourceFileSplit.length - 1];
|
|
146
|
-
const sourceFileNameMinusJs = sourceFileName
|
|
147
|
-
.split(".")
|
|
148
|
-
.slice(0, -1)
|
|
149
|
-
.join(".");
|
|
150
|
-
const htmlFilePath = path_1.default.normalize(`${process.cwd()}/${this.config.outdir}/web/${sourceDir.join("/")}/${sourceFileNameMinusJs}.html`);
|
|
151
|
-
const jsfilePath = `./${sourceFileNameMinusJs}.mjs`;
|
|
152
|
-
return fs_1.default.promises
|
|
153
|
-
.mkdir(path_1.default.dirname(htmlFilePath), { recursive: true })
|
|
154
|
-
.then((x) => fs_1.default.writeFileSync(htmlFilePath, (0, web_html_js_1.default)(jsfilePath, htmlFilePath)));
|
|
155
|
-
})));
|
|
156
|
-
const [nodeEntryPoints, webEntryPoints] = getRunnables(this.config.tests);
|
|
157
|
-
(0, glob_1.glob)(`./${this.config.outdir}/chunk-*.mjs`, {
|
|
158
|
-
ignore: "node_modules/**",
|
|
159
|
-
}).then((chunks) => {
|
|
160
|
-
chunks.forEach((chunk) => {
|
|
161
|
-
fs_1.default.unlinkSync(chunk);
|
|
162
|
-
});
|
|
163
|
-
});
|
|
164
|
-
Promise.all([
|
|
165
|
-
compile(),
|
|
166
|
-
esbuild_1.default
|
|
167
|
-
.context((0, node_js_1.default)(this.config, nodeEntryPoints))
|
|
168
|
-
.then(async (nodeContext) => {
|
|
169
|
-
if (this.config.devMode) {
|
|
170
|
-
await nodeContext.watch().then((v) => {
|
|
171
|
-
this.onNodeDone();
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
nodeContext.rebuild().then((v) => {
|
|
176
|
-
this.onNodeDone();
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
return nodeContext;
|
|
180
|
-
}),
|
|
181
|
-
esbuild_1.default
|
|
182
|
-
.context((0, web_js_1.default)(this.config, webEntryPoints))
|
|
183
|
-
.then(async (webContext) => {
|
|
184
|
-
if (this.config.devMode) {
|
|
185
|
-
await webContext.watch().then((v) => {
|
|
186
|
-
this.onWebDone();
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
webContext.rebuild().then((v) => {
|
|
191
|
-
this.onWebDone();
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
return webContext;
|
|
195
|
-
}),
|
|
196
|
-
]);
|
|
197
|
-
}
|
|
198
|
-
getSecondaryEndpointsPoints(runtime) {
|
|
199
|
-
const meta = (ts, st) => {
|
|
200
|
-
ts.forEach((t) => {
|
|
201
|
-
if (t[1] === runtime) {
|
|
202
|
-
st.add(t[0]);
|
|
203
|
-
}
|
|
204
|
-
if (Array.isArray(t[3])) {
|
|
205
|
-
meta(t[3], st);
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
return st;
|
|
209
|
-
};
|
|
210
|
-
return Array.from(meta(this.config.tests, new Set()));
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
exports.ITProject = ITProject;
|
|
214
|
-
const getRunnables = (tests, payload = [new Set(), new Set()]) => {
|
|
215
|
-
return tests.reduce((pt, cv, cndx, cry) => {
|
|
216
|
-
if (cv[1] === "node") {
|
|
217
|
-
pt[0].add(cv[0]);
|
|
218
|
-
}
|
|
219
|
-
else if (cv[1] === "web") {
|
|
220
|
-
pt[1].add(cv[0]);
|
|
221
|
-
}
|
|
222
|
-
if (cv[3].length) {
|
|
223
|
-
getRunnables(cv[3], payload);
|
|
224
|
-
}
|
|
225
|
-
return pt;
|
|
226
|
-
}, payload);
|
|
227
|
-
};
|
|
@@ -1,111 +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 readline_1 = __importDefault(require("readline"));
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const recursive_watch_1 = __importDefault(require("recursive-watch"));
|
|
9
|
-
const main_js_1 = require("./PM/main.js");
|
|
10
|
-
const utils_js_1 = require("./utils.js");
|
|
11
|
-
readline_1.default.emitKeypressEvents(process.stdin);
|
|
12
|
-
if (process.stdin.isTTY)
|
|
13
|
-
process.stdin.setRawMode(true);
|
|
14
|
-
exports.default = async (partialConfig) => {
|
|
15
|
-
const config = Object.assign(Object.assign({}, partialConfig), { buildDir: process.cwd() + "/" + partialConfig.outdir });
|
|
16
|
-
fs_1.default.writeFileSync(`${config.outdir}/testeranto.json`, JSON.stringify(Object.assign(Object.assign({}, config), { buildDir: process.cwd() + "/" + config.outdir }), null, 2));
|
|
17
|
-
const pm = new main_js_1.PM_Main(config);
|
|
18
|
-
await pm.startPuppeteer({
|
|
19
|
-
// timeout: 1,
|
|
20
|
-
waitForInitialPage: false,
|
|
21
|
-
executablePath:
|
|
22
|
-
// process.env.CHROMIUM_PATH || "/opt/homebrew/bin/chromium",
|
|
23
|
-
"/opt/homebrew/bin/chromium",
|
|
24
|
-
headless: true,
|
|
25
|
-
dumpio: true,
|
|
26
|
-
// timeout: 0,
|
|
27
|
-
devtools: true,
|
|
28
|
-
args: [
|
|
29
|
-
"--auto-open-devtools-for-tabs",
|
|
30
|
-
`--remote-debugging-port=3234`,
|
|
31
|
-
// "--disable-features=IsolateOrigins,site-per-process",
|
|
32
|
-
"--disable-site-isolation-trials",
|
|
33
|
-
"--allow-insecure-localhost",
|
|
34
|
-
"--allow-file-access-from-files",
|
|
35
|
-
"--allow-running-insecure-content",
|
|
36
|
-
"--disable-dev-shm-usage",
|
|
37
|
-
"--disable-extensions",
|
|
38
|
-
"--disable-gpu",
|
|
39
|
-
"--disable-setuid-sandbox",
|
|
40
|
-
"--disable-site-isolation-trials",
|
|
41
|
-
"--disable-web-security",
|
|
42
|
-
"--no-first-run",
|
|
43
|
-
"--no-sandbox",
|
|
44
|
-
"--no-startup-window",
|
|
45
|
-
// "--no-zygote",
|
|
46
|
-
"--reduce-security-for-testing",
|
|
47
|
-
"--remote-allow-origins=*",
|
|
48
|
-
"--unsafely-treat-insecure-origin-as-secure=*",
|
|
49
|
-
// "--disable-features=IsolateOrigins",
|
|
50
|
-
// "--remote-allow-origins=ws://localhost:3234",
|
|
51
|
-
// "--single-process",
|
|
52
|
-
// "--unsafely-treat-insecure-origin-as-secure",
|
|
53
|
-
// "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
|
|
54
|
-
// "--disk-cache-dir=/dev/null",
|
|
55
|
-
// "--disk-cache-size=1",
|
|
56
|
-
// "--start-maximized",
|
|
57
|
-
],
|
|
58
|
-
}, ".");
|
|
59
|
-
console.log("\n Puppeteer is running. Press 'q' to shutdown softly. Press 'x' to shutdown forcefully.\n");
|
|
60
|
-
process.stdin.on("keypress", (str, key) => {
|
|
61
|
-
if (key.name === "q") {
|
|
62
|
-
pm.shutDown();
|
|
63
|
-
}
|
|
64
|
-
if (key.name === "x") {
|
|
65
|
-
process.exit(-1);
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
config.tests.forEach(([test, runtime, tr, sidecars]) => {
|
|
69
|
-
if (runtime === "node") {
|
|
70
|
-
pm.launchNode(test, (0, utils_js_1.destinationOfRuntime)(test, "node", config));
|
|
71
|
-
}
|
|
72
|
-
else if (runtime === "web") {
|
|
73
|
-
pm.launchWeb(test, (0, utils_js_1.destinationOfRuntime)(test, "web", config), sidecars);
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
console.error("runtime makes no sense", runtime);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
if (config.devMode) {
|
|
80
|
-
console.log("ready and watching for changes...", config.buildDir);
|
|
81
|
-
(0, recursive_watch_1.default)(config.buildDir, (eventType, changedFile) => {
|
|
82
|
-
if (changedFile) {
|
|
83
|
-
config.tests.forEach(([test, runtime, tr, sidecars]) => {
|
|
84
|
-
if (eventType === "change" || eventType === "rename") {
|
|
85
|
-
if (changedFile ===
|
|
86
|
-
test
|
|
87
|
-
.replace("./", "node/")
|
|
88
|
-
.split(".")
|
|
89
|
-
.slice(0, -1)
|
|
90
|
-
.concat("mjs")
|
|
91
|
-
.join(".")) {
|
|
92
|
-
pm.launchNode(test, (0, utils_js_1.destinationOfRuntime)(test, "node", config));
|
|
93
|
-
}
|
|
94
|
-
if (changedFile ===
|
|
95
|
-
test
|
|
96
|
-
.replace("./", "web/")
|
|
97
|
-
.split(".")
|
|
98
|
-
.slice(0, -1)
|
|
99
|
-
.concat("mjs")
|
|
100
|
-
.join(".")) {
|
|
101
|
-
pm.launchWeb(test, (0, utils_js_1.destinationOfRuntime)(test, "web", config), sidecars);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
else {
|
|
109
|
-
pm.shutDown();
|
|
110
|
-
}
|
|
111
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const process_1 = __importDefault(require("process"));
|
|
30
|
-
const Project_1 = require("./Project");
|
|
31
|
-
if (!process_1.default.argv[2]) {
|
|
32
|
-
console.log("You didn't pass a config file");
|
|
33
|
-
process_1.default.exit(-1);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
Promise.resolve().then(() => __importStar(require(process_1.default.cwd() + "/" + process_1.default.argv[2]))).then((module) => {
|
|
37
|
-
new Project_1.ITProject(module.default);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = (config) => {
|
|
4
|
-
return {
|
|
5
|
-
bundle: true,
|
|
6
|
-
entryPoints: [config.features],
|
|
7
|
-
minify: config.minify === true,
|
|
8
|
-
outbase: config.outbase,
|
|
9
|
-
write: true,
|
|
10
|
-
outfile: `${config.outdir}/features.test.js`,
|
|
11
|
-
// external: ["graphology"],
|
|
12
|
-
format: "esm",
|
|
13
|
-
};
|
|
14
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// import { BuildOptions } from "esbuild";
|
|
3
|
-
// import { IBaseConfig } from "../lib/types";
|
|
4
|
-
// export default (config: IBaseConfig): BuildOptions => {
|
|
5
|
-
// return {
|
|
6
|
-
// bundle: true,
|
|
7
|
-
// entryPoints: ["./node_modules/testeranto/dist/module/report.js"],
|
|
8
|
-
// minify: config.minify === true,
|
|
9
|
-
// outbase: config.outbase,
|
|
10
|
-
// write: true,
|
|
11
|
-
// outfile: `${config.outdir}/report.js`,
|
|
12
|
-
// external: ["tests.json", "features.test.js"],
|
|
13
|
-
// };
|
|
14
|
-
// };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = (config) => {
|
|
4
|
-
return {
|
|
5
|
-
bundle: true,
|
|
6
|
-
entryPoints: [config.features],
|
|
7
|
-
minify: config.minify === true,
|
|
8
|
-
outbase: config.outbase,
|
|
9
|
-
write: true,
|
|
10
|
-
outfile: `${config.outdir}/tests.test.js`,
|
|
11
|
-
// external: ["graphology"]
|
|
12
|
-
};
|
|
13
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const Puppeteer_js_1 = __importDefault(require("./Puppeteer.js"));
|
|
30
|
-
const process_1 = __importDefault(require("process"));
|
|
31
|
-
if (!process_1.default.argv[2]) {
|
|
32
|
-
console.log("You didn't pass a config file");
|
|
33
|
-
process_1.default.exit(-1);
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
Promise.resolve().then(() => __importStar(require(process_1.default.cwd() + "/" + process_1.default.argv[2]))).then((module) => {
|
|
37
|
-
(0, Puppeteer_js_1.default)(module.default);
|
|
38
|
-
});
|
|
39
|
-
}
|