testeranto 0.49.10 → 0.70.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/.nvmrc +1 -0
- package/README.md +92 -9
- package/dist/cjs-shim.js +12 -0
- package/dist/common/Features.js +2 -3
- package/dist/common/Node.js +37 -62
- package/dist/common/NodeWriter.js +7 -9
- package/dist/common/Project.js +130 -627
- package/dist/common/SubPackages/puppeteer.js +19 -0
- package/dist/common/{subPackages → SubPackages}/react/component/node.js +4 -4
- package/dist/common/{subPackages → SubPackages}/react/component/web.js +4 -4
- package/dist/common/SubPackages/react/jsx/index.js +13 -0
- package/dist/common/SubPackages/react/jsx/node.js +10 -0
- package/dist/common/SubPackages/react/jsx/web.js +10 -0
- package/dist/common/{subPackages → SubPackages}/react-dom/component/node.js +6 -6
- package/dist/common/{subPackages → SubPackages}/react-dom/component/web.js +11 -12
- package/dist/common/SubPackages/react-dom/jsx/node.js +39 -0
- package/dist/common/{subPackages → SubPackages}/react-dom/jsx/web.js +19 -20
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +3 -3
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/component/index.js +25 -15
- package/dist/common/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/component}/node.js +3 -5
- package/dist/common/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/component}/web.js +3 -5
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/fc/node.js +4 -4
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/fc/web.js +4 -4
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx/index.js +8 -3
- package/dist/common/{subPackages/react-test-renderer/jsx-promised → SubPackages/react-test-renderer/jsx}/node.js +4 -4
- package/dist/common/{subPackages/react → SubPackages/react-test-renderer}/jsx/web.js +4 -4
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.js +3 -3
- package/dist/common/{subPackages/react/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +2 -2
- package/dist/common/Types.js +2 -0
- package/dist/common/Web.js +49 -113
- package/dist/common/electron.js +256 -42
- package/dist/common/esbuildConfigs/features.js +14 -0
- package/dist/common/esbuildConfigs/index.js +20 -0
- package/dist/common/esbuildConfigs/node.js +37 -0
- package/dist/common/esbuildConfigs/report.js +13 -0
- package/dist/common/esbuildConfigs/tests.js +13 -0
- package/dist/common/esbuildConfigs/web.js +53 -0
- package/dist/common/lib/abstractBase.js +200 -0
- package/dist/common/lib/basebuilder.js +86 -0
- package/dist/common/lib/classBuilder.js +40 -0
- package/dist/common/lib/core.js +81 -0
- package/dist/common/lib/index.js +21 -0
- package/dist/common/lib/types.js +2 -0
- package/dist/common/preload.js +15 -24
- package/dist/common/puppeteerConfiger.js +24 -0
- package/dist/common/report.html.js +31 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/common/web.html.js +22 -0
- package/dist/module/Features.js +2 -3
- package/dist/module/Node.js +37 -62
- package/dist/module/NodeWriter.js +7 -9
- package/dist/module/Project.js +131 -605
- package/dist/module/SubPackages/puppeteer.js +14 -0
- package/dist/module/{subPackages → SubPackages}/react/component/node.js +3 -3
- package/dist/module/{subPackages → SubPackages}/react/component/web.js +3 -3
- package/dist/module/SubPackages/react/jsx/index.js +10 -0
- package/dist/module/SubPackages/react/jsx/node.js +5 -0
- package/dist/module/SubPackages/react/jsx/web.js +5 -0
- package/dist/module/{subPackages → SubPackages}/react-dom/component/node.js +7 -7
- package/dist/module/{subPackages → SubPackages}/react-dom/component/web.js +10 -11
- package/dist/module/SubPackages/react-dom/jsx/node.js +31 -0
- package/dist/module/{subPackages → SubPackages}/react-dom/jsx/web.js +20 -21
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +3 -3
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/index.js +22 -15
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/node.js +2 -2
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/web.js +2 -2
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/fc/node.js +3 -3
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/fc/web.js +3 -3
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx/index.js +8 -3
- package/dist/module/SubPackages/react-test-renderer/jsx/node.js +5 -0
- package/dist/module/SubPackages/react-test-renderer/jsx/web.js +5 -0
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.js +3 -3
- package/dist/module/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +1 -1
- package/dist/module/Types.js +2 -0
- package/dist/module/Web.js +49 -113
- package/dist/module/electron.js +257 -43
- package/dist/module/esbuildConfigs/features.js +12 -0
- package/dist/module/esbuildConfigs/index.js +18 -0
- package/dist/module/esbuildConfigs/node.js +32 -0
- package/dist/module/esbuildConfigs/report.js +11 -0
- package/dist/module/esbuildConfigs/tests.js +11 -0
- package/dist/module/esbuildConfigs/web.js +48 -0
- package/dist/module/lib/abstractBase.js +192 -0
- package/dist/module/lib/basebuilder.js +82 -0
- package/dist/module/lib/classBuilder.js +36 -0
- package/dist/module/lib/core.js +78 -0
- package/dist/module/lib/index.js +17 -0
- package/dist/module/lib/types.js +1 -0
- package/dist/module/preload.js +12 -24
- package/dist/module/puppeteerConfiger.js +19 -0
- package/dist/module/report.html.js +29 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/module/web.html.js +20 -0
- package/dist/prebuild/Report.css +10326 -0
- package/dist/prebuild/Report.js +37456 -0
- package/dist/types/Features.d.ts +5 -5
- package/dist/types/Node.d.ts +5 -11
- package/dist/types/NodeWriter.d.ts +1 -1
- package/dist/types/Project.d.ts +2 -28
- package/dist/types/SubPackages/puppeteer.d.ts +6 -0
- package/dist/types/SubPackages/react/component/node.d.ts +7 -0
- package/dist/types/SubPackages/react/component/web.d.ts +7 -0
- package/dist/types/SubPackages/react/jsx/index.d.ts +15 -0
- package/dist/types/SubPackages/react/jsx/node.d.ts +4 -0
- package/dist/types/SubPackages/react/jsx/web.d.ts +4 -0
- package/dist/types/SubPackages/react-dom/component/node.d.ts +12 -0
- package/dist/types/SubPackages/react-dom/component/web.d.ts +5 -0
- package/dist/types/SubPackages/react-dom/jsx/node.d.ts +6 -0
- package/dist/types/SubPackages/react-dom/jsx/web.d.ts +5 -0
- package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +5 -0
- package/dist/types/{subPackages → SubPackages}/react-test-renderer/component/index.d.ts +6 -6
- package/dist/types/{subPackages → SubPackages}/react-test-renderer/component/node.d.ts +4 -4
- package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +4 -0
- package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +8 -0
- package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +8 -0
- package/dist/types/{subPackages → SubPackages}/react-test-renderer/jsx/index.d.ts +5 -4
- package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +9 -0
- package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +9 -0
- package/dist/types/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.d.ts +4 -4
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +5 -0
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +5 -0
- package/dist/types/Types.d.ts +49 -17
- package/dist/types/Web.d.ts +5 -11
- package/dist/types/esbuildConfigs/features.d.ts +4 -0
- package/dist/types/esbuildConfigs/index.d.ts +4 -0
- package/dist/types/esbuildConfigs/node.d.ts +4 -0
- package/dist/types/esbuildConfigs/report.d.ts +4 -0
- package/dist/types/esbuildConfigs/tests.d.ts +4 -0
- package/dist/types/esbuildConfigs/web.d.ts +4 -0
- package/dist/types/lib/abstractBase.d.ts +103 -0
- package/dist/types/lib/basebuilder.d.ts +25 -0
- package/dist/types/lib/classBuilder.d.ts +7 -0
- package/dist/types/lib/core.d.ts +8 -0
- package/dist/types/lib/index.d.ts +58 -0
- package/dist/types/lib/types.d.ts +70 -0
- package/dist/types/puppeteerConfiger.d.ts +4 -0
- package/dist/types/report.html.d.ts +2 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/web.html.d.ts +2 -0
- package/electronBuild.ts +32 -0
- package/index.html +30 -0
- package/package.json +123 -87
- package/src/Features.ts +2 -4
- package/src/Node.ts +79 -155
- package/src/NodeWriter.ts +22 -22
- package/src/Project.ts +185 -783
- package/src/Report.tsx +30 -15
- package/src/SubPackages/puppeteer.ts +51 -0
- package/src/SubPackages/react/component/node.ts +43 -0
- package/src/SubPackages/react/component/web.ts +43 -0
- package/src/SubPackages/react/jsx/index.ts +32 -0
- package/src/SubPackages/react/jsx/node.ts +29 -0
- package/src/SubPackages/react/jsx/web.ts +30 -0
- package/src/{subPackages → SubPackages}/react-dom/component/node.ts +24 -44
- package/src/SubPackages/react-dom/component/web.ts +104 -0
- package/src/{subPackages → SubPackages}/react-dom/jsx/index.ts +0 -1
- package/src/SubPackages/react-dom/jsx/node.ts +68 -0
- package/src/SubPackages/react-dom/jsx/web.ts +102 -0
- package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +38 -0
- package/src/{subPackages → SubPackages}/react-test-renderer/component/index.ts +37 -49
- package/src/SubPackages/react-test-renderer/component/node.ts +16 -0
- package/src/SubPackages/react-test-renderer/component/web.ts +16 -0
- package/src/SubPackages/react-test-renderer/fc/node.ts +49 -0
- package/src/SubPackages/react-test-renderer/fc/web.ts +48 -0
- package/src/SubPackages/react-test-renderer/jsx/index.ts +49 -0
- package/src/SubPackages/react-test-renderer/jsx/node.ts +20 -0
- package/src/SubPackages/react-test-renderer/jsx/web.ts +20 -0
- package/src/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.ts +15 -26
- package/src/SubPackages/react-test-renderer/jsx-promised/node.ts +19 -0
- package/src/SubPackages/react-test-renderer/jsx-promised/web.ts +22 -0
- package/src/Types.ts +114 -17
- package/src/Web.ts +100 -225
- package/src/cjs-shim.js +12 -0
- package/src/electron.ts +303 -45
- package/src/esbuildConfigs/features.ts +17 -0
- package/src/esbuildConfigs/index.ts +22 -0
- package/src/esbuildConfigs/node.ts +60 -0
- package/src/esbuildConfigs/report.ts +15 -0
- package/src/esbuildConfigs/tests.ts +14 -0
- package/src/esbuildConfigs/web.ts +73 -0
- package/src/lib/abstractBase.ts +412 -0
- package/src/lib/basebuilder.ts +228 -0
- package/src/lib/classBuilder.ts +118 -0
- package/src/lib/core.ts +214 -0
- package/src/lib/index.ts +117 -0
- package/src/lib/types.ts +206 -0
- package/src/preload.ts +13 -27
- package/src/puppeteerConfiger.ts +26 -0
- package/src/report.html.ts +29 -0
- package/src/web.html.ts +20 -0
- package/tests/Rectangle.test.ts +189 -0
- package/tsconfig.json +19 -6
- package/tsconfig.module.json +15 -4
- package/tsconfig.types.json +14 -4
- package/yarn-error.log +3144 -0
- package/dist/common/core.js +0 -397
- package/dist/common/subPackages/react/jsx/index.js +0 -26
- package/dist/common/subPackages/react-dom/jsx/node.js +0 -95
- package/dist/common/subPackages/react-test-renderer/component/node.js +0 -8
- package/dist/common/subPackages/react-test-renderer/component/web.js +0 -8
- package/dist/module/Report.js +0 -186
- package/dist/module/core.js +0 -388
- package/dist/module/subPackages/react/jsx/index.js +0 -22
- package/dist/module/subPackages/react/jsx/node.js +0 -5
- package/dist/module/subPackages/react/jsx/web.js +0 -5
- package/dist/module/subPackages/react-dom/jsx/node.js +0 -87
- package/dist/module/subPackages/react-test-renderer/jsx/web.js +0 -5
- package/dist/module/subPackages/react-test-renderer/jsx-promised/node.js +0 -5
- package/dist/types/core.d.ts +0 -220
- package/dist/types/subPackages/react/component/node.d.ts +0 -12
- package/dist/types/subPackages/react/component/web.d.ts +0 -12
- package/dist/types/subPackages/react/jsx/index.d.ts +0 -15
- package/dist/types/subPackages/react/jsx/node.d.ts +0 -4
- package/dist/types/subPackages/react/jsx/web.d.ts +0 -4
- package/dist/types/subPackages/react-dom/component/node.d.ts +0 -14
- package/dist/types/subPackages/react-dom/component/web.d.ts +0 -19
- package/dist/types/subPackages/react-dom/jsx/node.d.ts +0 -8
- package/dist/types/subPackages/react-dom/jsx/web.d.ts +0 -5
- package/dist/types/subPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -8
- package/dist/types/subPackages/react-test-renderer/component/web.d.ts +0 -9
- package/dist/types/subPackages/react-test-renderer/fc/node.d.ts +0 -9
- package/dist/types/subPackages/react-test-renderer/fc/web.d.ts +0 -9
- package/dist/types/subPackages/react-test-renderer/jsx/node.d.ts +0 -4
- package/dist/types/subPackages/react-test-renderer/jsx/web.d.ts +0 -4
- package/dist/types/subPackages/react-test-renderer/jsx-promised/node.d.ts +0 -4
- package/dist/types/subPackages/react-test-renderer/jsx-promised/web.d.ts +0 -4
- package/src/core.ts +0 -1399
- package/src/subPackages/react/component/node.ts +0 -75
- package/src/subPackages/react/component/web.ts +0 -80
- package/src/subPackages/react/jsx/index.ts +0 -64
- package/src/subPackages/react/jsx/node.ts +0 -29
- package/src/subPackages/react/jsx/web.ts +0 -29
- package/src/subPackages/react-dom/component/web.ts +0 -129
- package/src/subPackages/react-dom/jsx/node.ts +0 -145
- package/src/subPackages/react-dom/jsx/web.ts +0 -145
- package/src/subPackages/react-test-renderer/MemoExoticComponent/node.ts +0 -67
- package/src/subPackages/react-test-renderer/component/node.ts +0 -30
- package/src/subPackages/react-test-renderer/component/web.ts +0 -30
- package/src/subPackages/react-test-renderer/fc/node.ts +0 -77
- package/src/subPackages/react-test-renderer/fc/web.ts +0 -77
- package/src/subPackages/react-test-renderer/jsx/index.ts +0 -51
- package/src/subPackages/react-test-renderer/jsx/node.ts +0 -31
- package/src/subPackages/react-test-renderer/jsx/web.ts +0 -31
- package/src/subPackages/react-test-renderer/jsx-promised/node.ts +0 -31
- package/src/subPackages/react-test-renderer/jsx-promised/web.ts +0 -31
- /package/dist/common/{subPackages → SubPackages}/react-dom/jsx/index.js +0 -0
- /package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
- /package/dist/module/{subPackages → SubPackages}/react-dom/jsx/index.js +0 -0
- /package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
- /package/dist/types/{subPackages → SubPackages}/react-dom/jsx/index.d.ts +0 -0
package/dist/module/electron.js
CHANGED
|
@@ -1,47 +1,261 @@
|
|
|
1
|
-
import
|
|
1
|
+
import readline from "readline";
|
|
2
|
+
import { app, BrowserWindow, utilityProcess, ipcMain } from "electron";
|
|
3
|
+
import pie from "puppeteer-in-electron";
|
|
4
|
+
import puppeteer from "puppeteer-core";
|
|
5
|
+
import fs from "fs";
|
|
2
6
|
import path from "path";
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
7
|
+
import { jsonc } from "jsonc";
|
|
8
|
+
import { v4 as uuidv4 } from "uuid";
|
|
9
|
+
var mode = process.argv[2] === "-dev" ? "DEV" : "PROD";
|
|
10
|
+
console.log("hello electron", mode);
|
|
11
|
+
const nodeChildren = {};
|
|
12
|
+
const webChildren = {};
|
|
13
|
+
const node2web = {};
|
|
14
|
+
const web2node = {};
|
|
15
|
+
const childProcesses = {};
|
|
16
|
+
readline.emitKeypressEvents(process.stdin);
|
|
17
|
+
if (process.stdin.isTTY)
|
|
18
|
+
process.stdin.setRawMode(true);
|
|
19
|
+
console.log("\n Electron is running. Press 'q' to quit\n");
|
|
20
|
+
process.stdin.on("keypress", (str, key) => {
|
|
21
|
+
if (key.name === "q") {
|
|
22
|
+
mode = "PROD";
|
|
23
|
+
// process.exit();
|
|
24
|
+
console.log("Switching to prod mode. Begin shutdown sequence...");
|
|
25
|
+
// process.exit(-1);
|
|
26
|
+
const allDone = Object.values(childProcesses).every((v) => v === "done");
|
|
27
|
+
if (allDone && mode === "PROD") {
|
|
28
|
+
console.log("Goodbye Testeranto by manual shutdown");
|
|
29
|
+
process.exit();
|
|
25
30
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
app.on("ready", createWindow);
|
|
32
|
-
ipcMain.handle('web-log', (x, message) => {
|
|
33
|
-
console.log("web-log)", message);
|
|
34
|
-
});
|
|
35
|
-
ipcMain.handle('web-error', (x, message) => {
|
|
36
|
-
console.log("web-error)", message);
|
|
37
|
-
});
|
|
38
|
-
ipcMain.handle('web-warn', (x, message) => {
|
|
39
|
-
console.log("web-warn)", message);
|
|
40
|
-
});
|
|
41
|
-
ipcMain.handle('web-info', (x, message) => {
|
|
42
|
-
console.log("web-info)", message);
|
|
31
|
+
else {
|
|
32
|
+
console.log(childProcesses);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
43
35
|
});
|
|
44
|
-
|
|
45
|
-
console.log("
|
|
46
|
-
|
|
36
|
+
const onDone = (test) => {
|
|
37
|
+
console.log("onDone", test);
|
|
38
|
+
childProcesses[test] = "done";
|
|
39
|
+
const allDone = Object.values(childProcesses).every((v) => v === "done");
|
|
40
|
+
if (allDone && mode === "PROD") {
|
|
41
|
+
console.log("Goodbye Testeranto by auto shutdown");
|
|
42
|
+
process.exit();
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
console.log(childProcesses);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
process.on("message", function (message) {
|
|
49
|
+
console.log("message: " + message);
|
|
50
|
+
process.exit();
|
|
47
51
|
});
|
|
52
|
+
const remoteMain = require("@electron/remote/main");
|
|
53
|
+
remoteMain.initialize();
|
|
54
|
+
const main = async () => {
|
|
55
|
+
const configs = jsonc.parse((await fs.readFileSync("./docs/testeranto.json")).toString());
|
|
56
|
+
const loadReport = (configs) => {
|
|
57
|
+
const win = new BrowserWindow({
|
|
58
|
+
show: true,
|
|
59
|
+
webPreferences: {
|
|
60
|
+
offscreen: false,
|
|
61
|
+
devTools: true,
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
win.loadFile(`/${configs.buildDir}/report.html`).then(async (x) => {
|
|
65
|
+
// pie.connect(app, puppeteer).then(async (browser) => {
|
|
66
|
+
// pie.getPage(browser, win).then(async (page) => {
|
|
67
|
+
// await page.screenshot({
|
|
68
|
+
// path: 'electron-puppeteer-screenshot1.jpg'
|
|
69
|
+
// });
|
|
70
|
+
// })
|
|
71
|
+
// })
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
const launchNode = (src, dest) => {
|
|
75
|
+
var _a, _b;
|
|
76
|
+
console.log("launchNode", src);
|
|
77
|
+
childProcesses[src] = "running";
|
|
78
|
+
const destFolder = dest.replace(".mjs", "");
|
|
79
|
+
const argz = JSON.stringify({
|
|
80
|
+
scheduled: true,
|
|
81
|
+
name: src,
|
|
82
|
+
ports: [3333],
|
|
83
|
+
// fs: path.resolve(configs.buildDir, "web", destFolder + "/"),
|
|
84
|
+
// fs: destFolder,
|
|
85
|
+
fs: ".",
|
|
86
|
+
});
|
|
87
|
+
// console.log("launchNode", src, dest, " -> ", destFolder, argz);
|
|
88
|
+
const child = utilityProcess.fork(dest + ".mjs", [argz], {
|
|
89
|
+
cwd: destFolder,
|
|
90
|
+
stdio: "pipe",
|
|
91
|
+
});
|
|
92
|
+
const nodeGuid = uuidv4();
|
|
93
|
+
nodeChildren[nodeGuid] = child;
|
|
94
|
+
if (!fs.existsSync(destFolder)) {
|
|
95
|
+
fs.mkdirSync(destFolder, { recursive: true });
|
|
96
|
+
}
|
|
97
|
+
fs.rmSync(`${destFolder}/stdout.log`, { force: true });
|
|
98
|
+
fs.rmSync(`${destFolder}/stderr.log`, { force: true });
|
|
99
|
+
const stdout = fs.createWriteStream(`${destFolder}/stdout.log`);
|
|
100
|
+
const stderr = fs.createWriteStream(`${destFolder}/stderr.log`);
|
|
101
|
+
child
|
|
102
|
+
.on("message", (data) => {
|
|
103
|
+
console.log("from child", JSON.stringify(data));
|
|
104
|
+
if (data.launchWeb) {
|
|
105
|
+
const guid = uuidv4();
|
|
106
|
+
const webChild = launchWebSecondary(process.cwd() + data.launchWeb);
|
|
107
|
+
// child.postMessage({ webLaunched: guid });
|
|
108
|
+
webChild.webContents.on("did-finish-load", () => {
|
|
109
|
+
// webChild.webContents.send("message", "hello world");
|
|
110
|
+
child.postMessage({ webLaunched: guid });
|
|
111
|
+
webChildren[guid] = webChild;
|
|
112
|
+
node2web[nodeGuid] = [...(node2web[nodeGuid] || []), guid];
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
if (data.teardown) {
|
|
116
|
+
webChildren[data.teardown].close();
|
|
117
|
+
delete webChildren[data.teardown];
|
|
118
|
+
node2web[nodeGuid] = node2web[nodeGuid].filter((x) => x !== data.teardown);
|
|
119
|
+
}
|
|
120
|
+
})
|
|
121
|
+
.on("exit", (data) => {
|
|
122
|
+
stdout.close();
|
|
123
|
+
stderr.close();
|
|
124
|
+
console.log(`ending node ${src}`);
|
|
125
|
+
onDone(src);
|
|
126
|
+
});
|
|
127
|
+
(_a = child.stdout) === null || _a === void 0 ? void 0 : _a.pipe(stdout);
|
|
128
|
+
(_b = child.stderr) === null || _b === void 0 ? void 0 : _b.pipe(stderr);
|
|
129
|
+
};
|
|
130
|
+
const launchWebSecondary = (htmlFile) => {
|
|
131
|
+
console.log("launchWebSecondary", htmlFile);
|
|
132
|
+
const subWin = new BrowserWindow({
|
|
133
|
+
show: false,
|
|
134
|
+
webPreferences: {
|
|
135
|
+
nodeIntegration: true,
|
|
136
|
+
nodeIntegrationInWorker: true,
|
|
137
|
+
contextIsolation: false,
|
|
138
|
+
preload: path.join(app.getAppPath(), "preload.js"),
|
|
139
|
+
offscreen: false,
|
|
140
|
+
devTools: true,
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
remoteMain.enable(subWin.webContents);
|
|
144
|
+
subWin.webContents.openDevTools();
|
|
145
|
+
subWin.loadFile(htmlFile);
|
|
146
|
+
return subWin;
|
|
147
|
+
// const uuid = uuidv4();
|
|
148
|
+
// windows[uuid] = subWin;
|
|
149
|
+
// return uuid;
|
|
150
|
+
};
|
|
151
|
+
const launchWeb = (t, dest) => {
|
|
152
|
+
console.log("launchWeb", t);
|
|
153
|
+
childProcesses[t] = "running";
|
|
154
|
+
const destFolder = dest.replace(".mjs", "");
|
|
155
|
+
const subWin = new BrowserWindow({
|
|
156
|
+
show: true,
|
|
157
|
+
webPreferences: {
|
|
158
|
+
nodeIntegration: true,
|
|
159
|
+
nodeIntegrationInWorker: true,
|
|
160
|
+
contextIsolation: false,
|
|
161
|
+
preload: path.join(app.getAppPath(), "preload.js"),
|
|
162
|
+
offscreen: false,
|
|
163
|
+
devTools: true,
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
webChildren[uuidv4()] = subWin;
|
|
167
|
+
remoteMain.enable(subWin.webContents);
|
|
168
|
+
const webArgz = JSON.stringify({
|
|
169
|
+
name: dest,
|
|
170
|
+
ports: [].toString(),
|
|
171
|
+
fs: destFolder,
|
|
172
|
+
});
|
|
173
|
+
// console.log("webArgz", webArgz);
|
|
174
|
+
subWin.loadFile(`${dest}.html`, {
|
|
175
|
+
query: {
|
|
176
|
+
requesting: encodeURIComponent(webArgz),
|
|
177
|
+
},
|
|
178
|
+
});
|
|
179
|
+
if (!fs.existsSync(destFolder)) {
|
|
180
|
+
fs.mkdirSync(destFolder, { recursive: true });
|
|
181
|
+
}
|
|
182
|
+
const stdout = fs.createWriteStream(`${destFolder}/stdout.log`);
|
|
183
|
+
subWin.webContents.on("console-message", (event, level, message, line, sourceId) => {
|
|
184
|
+
stdout.write(JSON.stringify({
|
|
185
|
+
event,
|
|
186
|
+
level,
|
|
187
|
+
message: JSON.stringify(message),
|
|
188
|
+
line,
|
|
189
|
+
sourceId,
|
|
190
|
+
}, null, 2));
|
|
191
|
+
stdout.write("\n");
|
|
192
|
+
});
|
|
193
|
+
subWin.on("closed", () => {
|
|
194
|
+
stdout.close();
|
|
195
|
+
console.log(`ending web ${t}`);
|
|
196
|
+
// childProcesses[t] = "done";
|
|
197
|
+
onDone(t);
|
|
198
|
+
});
|
|
199
|
+
ipcMain.on("message", (message, data) => {
|
|
200
|
+
console.log("ipcMain message: " + JSON.stringify(data));
|
|
201
|
+
// process.exit();
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
const destinationOfRuntime = (f, r) => {
|
|
205
|
+
return path
|
|
206
|
+
.normalize(`${configs.buildDir}/${r}/${f}`)
|
|
207
|
+
.split(".")
|
|
208
|
+
.slice(0, -1)
|
|
209
|
+
.join(".");
|
|
210
|
+
};
|
|
211
|
+
pie.initialize(app, 2999).then(async () => {
|
|
212
|
+
app.on("ready", () => {
|
|
213
|
+
loadReport(configs);
|
|
214
|
+
console.log("running all the tests once initially");
|
|
215
|
+
configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
|
|
216
|
+
childProcesses[test] = "loaded";
|
|
217
|
+
if (runtime === "node") {
|
|
218
|
+
launchNode(test, destinationOfRuntime(test, "node"));
|
|
219
|
+
}
|
|
220
|
+
else if (runtime === "web") {
|
|
221
|
+
launchWeb(test, destinationOfRuntime(test, "web"));
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
console.error("runtime makes no sense", runtime);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
console.log("ready and watching for changes...", configs.buildDir);
|
|
228
|
+
fs.watch(configs.buildDir, {
|
|
229
|
+
recursive: true,
|
|
230
|
+
}, (eventType, changedFile) => {
|
|
231
|
+
// console.log(eventType);
|
|
232
|
+
if (changedFile) {
|
|
233
|
+
configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
|
|
234
|
+
if (eventType === "change" || eventType === "rename") {
|
|
235
|
+
if (changedFile ===
|
|
236
|
+
test
|
|
237
|
+
.replace("./", "node/")
|
|
238
|
+
.split(".")
|
|
239
|
+
.slice(0, -1)
|
|
240
|
+
.concat("mjs")
|
|
241
|
+
.join(".")) {
|
|
242
|
+
launchNode(test, destinationOfRuntime(test, "node"));
|
|
243
|
+
}
|
|
244
|
+
if (changedFile ===
|
|
245
|
+
test
|
|
246
|
+
.replace("./", "web/")
|
|
247
|
+
.split(".")
|
|
248
|
+
.slice(0, -1)
|
|
249
|
+
.concat("mjs")
|
|
250
|
+
.join(".")) {
|
|
251
|
+
launchWeb(test, destinationOfRuntime(test, "web"));
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
await pie.connect(app, puppeteer);
|
|
260
|
+
};
|
|
261
|
+
main();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default (config) => {
|
|
2
|
+
return {
|
|
3
|
+
bundle: true,
|
|
4
|
+
entryPoints: [config.features],
|
|
5
|
+
minify: config.minify === true,
|
|
6
|
+
outbase: config.outbase,
|
|
7
|
+
write: true,
|
|
8
|
+
outfile: `${config.outdir}/features.test.js`,
|
|
9
|
+
// external: ["graphology"],
|
|
10
|
+
format: "esm",
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export default (config) => {
|
|
2
|
+
return {
|
|
3
|
+
target: "esnext",
|
|
4
|
+
format: "esm",
|
|
5
|
+
splitting: true,
|
|
6
|
+
outExtension: { ".js": ".mjs" },
|
|
7
|
+
outbase: config.outbase,
|
|
8
|
+
jsx: "transform",
|
|
9
|
+
bundle: true,
|
|
10
|
+
minify: config.minify === true,
|
|
11
|
+
write: true,
|
|
12
|
+
loader: {
|
|
13
|
+
".js": "jsx",
|
|
14
|
+
".png": "binary",
|
|
15
|
+
".jpg": "binary",
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import baseEsBuildConfig from "./index.js";
|
|
2
|
+
export default (config, entryPoints) => {
|
|
3
|
+
return Object.assign(Object.assign({}, baseEsBuildConfig(config)), { splitting: true, outdir: config.outdir + "/node", inject: [`./node_modules/testeranto/dist/cjs-shim.js`], supported: {
|
|
4
|
+
"dynamic-import": true,
|
|
5
|
+
}, define: {
|
|
6
|
+
"process.env.FLUENTFFMPEG_COV": "0",
|
|
7
|
+
}, absWorkingDir: process.cwd(), banner: {
|
|
8
|
+
js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`,
|
|
9
|
+
}, platform: "node", external: [
|
|
10
|
+
// "testeranto.json",
|
|
11
|
+
// "features.test.js",
|
|
12
|
+
// "react",
|
|
13
|
+
// "events",
|
|
14
|
+
// "ganache"
|
|
15
|
+
...config.externals,
|
|
16
|
+
], entryPoints: [...entryPoints], plugins: [
|
|
17
|
+
...(config.nodePlugins || []),
|
|
18
|
+
{
|
|
19
|
+
name: "rebuild-notify",
|
|
20
|
+
setup(build) {
|
|
21
|
+
build.onEnd((result) => {
|
|
22
|
+
console.log(`node build ended with ${result.errors.length} errors`);
|
|
23
|
+
if (result.errors.length > 0) {
|
|
24
|
+
console.log(result);
|
|
25
|
+
}
|
|
26
|
+
// console.log(result);
|
|
27
|
+
// result.errors.length !== 0 && process.exit(-1);
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
] });
|
|
32
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export default (config) => {
|
|
2
|
+
return {
|
|
3
|
+
bundle: true,
|
|
4
|
+
entryPoints: ["./node_modules/testeranto/dist/module/report.js"],
|
|
5
|
+
minify: config.minify === true,
|
|
6
|
+
outbase: config.outbase,
|
|
7
|
+
write: true,
|
|
8
|
+
outfile: `${config.outdir}/report.js`,
|
|
9
|
+
external: ["tests.json", "features.test.js"],
|
|
10
|
+
};
|
|
11
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import baseEsBuildConfig from "./index.js";
|
|
3
|
+
export default (config, entryPoints) => {
|
|
4
|
+
return Object.assign(Object.assign({}, baseEsBuildConfig(config)), {
|
|
5
|
+
// inject: ["./node_modules/testeranto/dist/cjs-shim.js"],
|
|
6
|
+
// banner: {
|
|
7
|
+
// js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`,
|
|
8
|
+
// },
|
|
9
|
+
// splitting: true,
|
|
10
|
+
outdir: config.outdir + "/web", alias: {
|
|
11
|
+
react: path.resolve("./node_modules/react"),
|
|
12
|
+
}, external: [
|
|
13
|
+
"testeranto.json",
|
|
14
|
+
"features.test.ts",
|
|
15
|
+
// "url",
|
|
16
|
+
"react",
|
|
17
|
+
"electron",
|
|
18
|
+
"path",
|
|
19
|
+
"fs",
|
|
20
|
+
"stream",
|
|
21
|
+
"http",
|
|
22
|
+
"constants",
|
|
23
|
+
"net",
|
|
24
|
+
"assert",
|
|
25
|
+
"tls",
|
|
26
|
+
"os",
|
|
27
|
+
"child_process",
|
|
28
|
+
"readline",
|
|
29
|
+
"zlib",
|
|
30
|
+
"crypto",
|
|
31
|
+
"https",
|
|
32
|
+
], platform: "browser", entryPoints: [...entryPoints], plugins: [
|
|
33
|
+
...(config.webPlugins || []),
|
|
34
|
+
{
|
|
35
|
+
name: "rebuild-notify",
|
|
36
|
+
setup(build) {
|
|
37
|
+
build.onEnd((result) => {
|
|
38
|
+
console.log(`web build ended with ${result.errors.length} errors`);
|
|
39
|
+
if (result.errors.length > 0) {
|
|
40
|
+
console.log(result);
|
|
41
|
+
}
|
|
42
|
+
// console.log(result);
|
|
43
|
+
// result.errors.length !== 0 && process.exit(-1);
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
] });
|
|
48
|
+
};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
export class BaseSuite {
|
|
2
|
+
constructor(name, index, givens = {}, checks = []) {
|
|
3
|
+
this.name = name;
|
|
4
|
+
this.index = index;
|
|
5
|
+
this.givens = givens;
|
|
6
|
+
this.checks = checks;
|
|
7
|
+
this.fails = [];
|
|
8
|
+
}
|
|
9
|
+
toObj() {
|
|
10
|
+
return {
|
|
11
|
+
name: this.name,
|
|
12
|
+
givens: Object.keys(this.givens).map((k) => this.givens[k].toObj()),
|
|
13
|
+
fails: this.fails,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
setup(s, artifactory, tr, utils) {
|
|
17
|
+
return new Promise((res) => res(s));
|
|
18
|
+
}
|
|
19
|
+
assertThat(t) {
|
|
20
|
+
// console.log("base assertThat")
|
|
21
|
+
return t;
|
|
22
|
+
}
|
|
23
|
+
async run(input, testResourceConfiguration, artifactory, tLog, utils) {
|
|
24
|
+
this.testResourceConfiguration = testResourceConfiguration;
|
|
25
|
+
tLog("test resources: ", testResourceConfiguration);
|
|
26
|
+
const suiteArtifactory = (fPath, value) => artifactory(`suite-${this.index}-${this.name}/${fPath}`, value);
|
|
27
|
+
const subject = await this.setup(input, suiteArtifactory, testResourceConfiguration, utils);
|
|
28
|
+
tLog("\nSuite:", this.index, this.name);
|
|
29
|
+
for (const k of Object.keys(this.givens)) {
|
|
30
|
+
const giver = this.givens[k];
|
|
31
|
+
try {
|
|
32
|
+
this.store = await giver.give(subject, k, testResourceConfiguration, this.assertThat, suiteArtifactory, tLog, utils);
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
console.error(e);
|
|
36
|
+
this.fails.push(giver);
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
for (const [ndx, thater] of this.checks.entries()) {
|
|
41
|
+
await thater.check(subject, thater.name, testResourceConfiguration, this.assertThat, suiteArtifactory, tLog, utils);
|
|
42
|
+
}
|
|
43
|
+
// @TODO fix me
|
|
44
|
+
for (const k of Object.keys(this.givens)) {
|
|
45
|
+
const giver = this.givens[k];
|
|
46
|
+
try {
|
|
47
|
+
giver.afterAll(this.store, artifactory, utils);
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
console.error(e);
|
|
51
|
+
this.fails.push(giver);
|
|
52
|
+
return this;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
////////////////
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export class BaseGiven {
|
|
60
|
+
constructor(name, features, whens, thens, givenCB, initialValues) {
|
|
61
|
+
this.name = name;
|
|
62
|
+
this.features = features;
|
|
63
|
+
this.whens = whens;
|
|
64
|
+
this.thens = thens;
|
|
65
|
+
this.givenCB = givenCB;
|
|
66
|
+
this.initialValues = initialValues;
|
|
67
|
+
}
|
|
68
|
+
beforeAll(store, artifactory) {
|
|
69
|
+
return store;
|
|
70
|
+
}
|
|
71
|
+
afterAll(store, artifactory, utils) {
|
|
72
|
+
return store;
|
|
73
|
+
}
|
|
74
|
+
toObj() {
|
|
75
|
+
return {
|
|
76
|
+
name: this.name,
|
|
77
|
+
whens: this.whens.map((w) => w.toObj()),
|
|
78
|
+
thens: this.thens.map((t) => t.toObj()),
|
|
79
|
+
error: this.error ? [this.error, this.error.stack] : null,
|
|
80
|
+
features: this.features,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
async afterEach(store, key, artifactory, utils) {
|
|
84
|
+
return store;
|
|
85
|
+
}
|
|
86
|
+
async give(subject, key, testResourceConfiguration, tester, artifactory, tLog, utils) {
|
|
87
|
+
tLog(`\n Given: ${this.name}`);
|
|
88
|
+
const givenArtifactory = (fPath, value) => artifactory(`given-${key}/${fPath}`, value);
|
|
89
|
+
try {
|
|
90
|
+
this.store = await this.givenThat(subject, testResourceConfiguration, givenArtifactory, this.givenCB);
|
|
91
|
+
// tLog(`\n Given this.store`, this.store);
|
|
92
|
+
for (const whenStep of this.whens) {
|
|
93
|
+
await whenStep.test(this.store, testResourceConfiguration, tLog, utils);
|
|
94
|
+
}
|
|
95
|
+
for (const thenStep of this.thens) {
|
|
96
|
+
const t = await thenStep.test(this.store, testResourceConfiguration, tLog, utils);
|
|
97
|
+
tester(t);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
catch (e) {
|
|
101
|
+
this.error = e;
|
|
102
|
+
tLog(e);
|
|
103
|
+
tLog("\u0007"); // bell
|
|
104
|
+
// throw e;
|
|
105
|
+
}
|
|
106
|
+
finally {
|
|
107
|
+
try {
|
|
108
|
+
await this.afterEach(this.store, key, givenArtifactory, utils);
|
|
109
|
+
}
|
|
110
|
+
catch (e) {
|
|
111
|
+
console.error("afterEach failed! no error will be recorded!", e);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return this.store;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
export class BaseWhen {
|
|
118
|
+
constructor(name, whenCB) {
|
|
119
|
+
this.name = name;
|
|
120
|
+
this.whenCB = whenCB;
|
|
121
|
+
}
|
|
122
|
+
toObj() {
|
|
123
|
+
return {
|
|
124
|
+
name: this.name,
|
|
125
|
+
error: this.error,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
async test(store, testResourceConfiguration, tLog, utils) {
|
|
129
|
+
tLog(" When:", this.name);
|
|
130
|
+
try {
|
|
131
|
+
return await this.andWhen(store, this.whenCB, testResourceConfiguration);
|
|
132
|
+
}
|
|
133
|
+
catch (e) {
|
|
134
|
+
this.error = true;
|
|
135
|
+
throw e;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
export class BaseThen {
|
|
140
|
+
constructor(name, thenCB) {
|
|
141
|
+
this.name = name;
|
|
142
|
+
this.thenCB = thenCB;
|
|
143
|
+
}
|
|
144
|
+
toObj() {
|
|
145
|
+
return {
|
|
146
|
+
name: this.name,
|
|
147
|
+
error: this.error,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
async test(store, testResourceConfiguration, tLog, utils) {
|
|
151
|
+
tLog(" Then:", this.name);
|
|
152
|
+
try {
|
|
153
|
+
const x = await this.butThen(store, this.thenCB, testResourceConfiguration);
|
|
154
|
+
return x;
|
|
155
|
+
}
|
|
156
|
+
catch (e) {
|
|
157
|
+
console.log("test failed", e);
|
|
158
|
+
this.error = true;
|
|
159
|
+
throw e;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
export class BaseCheck {
|
|
164
|
+
constructor(name, features, checkCB, whens, thens) {
|
|
165
|
+
this.name = name;
|
|
166
|
+
this.features = features;
|
|
167
|
+
this.checkCB = checkCB;
|
|
168
|
+
this.whens = whens;
|
|
169
|
+
this.thens = thens;
|
|
170
|
+
}
|
|
171
|
+
async afterEach(store, key, cb, utils) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
async check(subject, key, testResourceConfiguration, tester, artifactory, tLog, utils) {
|
|
175
|
+
tLog(`\n Check: ${this.name}`);
|
|
176
|
+
const store = await this.checkThat(subject, testResourceConfiguration, artifactory);
|
|
177
|
+
await this.checkCB(Object.entries(this.whens).reduce((a, [key, when]) => {
|
|
178
|
+
a[key] = async (payload) => {
|
|
179
|
+
return await when(payload, testResourceConfiguration).test(store, testResourceConfiguration, tLog, utils);
|
|
180
|
+
};
|
|
181
|
+
return a;
|
|
182
|
+
}, {}), Object.entries(this.thens).reduce((a, [key, then]) => {
|
|
183
|
+
a[key] = async (payload) => {
|
|
184
|
+
const t = await then(payload, testResourceConfiguration).test(store, testResourceConfiguration, tLog, utils);
|
|
185
|
+
tester(t);
|
|
186
|
+
};
|
|
187
|
+
return a;
|
|
188
|
+
}, {}));
|
|
189
|
+
await this.afterEach(store, key, () => { }, utils);
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
}
|