testeranto 0.49.10 → 0.62.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 +71 -9
- package/dist/cjs-shim.js +12 -0
- package/dist/common/Features.js +2 -3
- package/dist/common/Node.js +53 -61
- package/dist/common/Project.js +272 -606
- 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 +5 -14
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +2 -2
- package/dist/common/{subPackages → SubPackages}/react-test-renderer/component/index.js +26 -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 -2
- 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 +2 -2
- package/dist/common/{subPackages/react/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +2 -2
- package/dist/common/Types.js +32 -0
- package/dist/common/Web.js +41 -112
- package/dist/common/electron.js +188 -44
- package/dist/common/esbuildConfigs/features.js +14 -0
- package/dist/common/esbuildConfigs/index.js +20 -0
- package/dist/common/esbuildConfigs/node.js +35 -0
- package/dist/common/esbuildConfigs/report.js +48 -0
- package/dist/common/esbuildConfigs/tests.js +14 -0
- package/dist/common/esbuildConfigs/web.js +50 -0
- package/dist/common/lib/abstractBase.js +193 -0
- package/dist/common/lib/basebuilder.js +86 -0
- package/dist/common/lib/browser.js +26 -0
- package/dist/common/lib/classBuilder.js +41 -0
- package/dist/common/lib/core.js +52 -0
- package/dist/common/lib/index.js +19 -0
- package/dist/common/nodeWriterElectron.js +55 -0
- package/dist/common/preload.js +22 -21
- 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 +53 -61
- package/dist/module/Project.js +272 -583
- 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 +5 -5
- 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 +4 -13
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +2 -2
- package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/index.js +23 -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 -2
- 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 +2 -2
- package/dist/module/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +1 -1
- package/dist/module/Types.js +30 -1
- package/dist/module/Web.js +41 -112
- package/dist/module/electron.js +189 -45
- package/dist/module/esbuildConfigs/features.js +12 -0
- package/dist/module/esbuildConfigs/index.js +18 -0
- package/dist/module/esbuildConfigs/node.js +30 -0
- package/dist/module/esbuildConfigs/report.js +48 -0
- package/dist/module/esbuildConfigs/tests.js +12 -0
- package/dist/module/esbuildConfigs/web.js +45 -0
- package/dist/module/lib/abstractBase.js +185 -0
- package/dist/module/lib/basebuilder.js +82 -0
- package/dist/module/lib/browser.js +22 -0
- package/dist/module/lib/classBuilder.js +37 -0
- package/dist/module/lib/core.js +49 -0
- package/dist/module/lib/index.js +15 -0
- package/dist/module/nodeWriterElectron.js +52 -0
- package/dist/module/preload.js +22 -21
- 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 +4 -11
- package/dist/types/NodeWriter.d.ts +1 -1
- package/dist/types/Project.d.ts +2 -27
- 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 → SubPackages}/react-dom/component/node.d.ts +2 -4
- 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/react-test-renderer/component/node.d.ts +9 -0
- 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 +116 -3
- package/dist/types/Web.d.ts +4 -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 +0 -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 +102 -0
- package/dist/types/lib/basebuilder.d.ts +24 -0
- package/dist/types/lib/browser.d.ts +6 -0
- package/dist/types/lib/classBuilder.d.ts +6 -0
- package/dist/types/lib/core.d.ts +7 -0
- package/dist/types/lib/index.d.ts +57 -0
- package/dist/types/nodeWriterElectron.d.ts +2 -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 +120 -85
- package/src/Features.ts +2 -4
- package/src/Node.ts +114 -160
- package/src/NodeWriter.ts +1 -4
- package/src/Project.ts +610 -753
- package/src/Report.tsx +30 -15
- package/src/SubPackages/puppeteer.ts +46 -0
- package/src/{subPackages → SubPackages}/react/component/node.ts +12 -32
- package/src/SubPackages/react/component/web.ts +53 -0
- package/src/SubPackages/react/jsx/index.ts +43 -0
- package/src/SubPackages/react/jsx/node.ts +29 -0
- package/src/SubPackages/react/jsx/web.ts +28 -0
- package/src/{subPackages → SubPackages}/react-dom/component/node.ts +11 -25
- package/src/{subPackages → SubPackages}/react-dom/component/web.ts +27 -32
- package/src/{subPackages → SubPackages}/react-dom/jsx/index.ts +0 -1
- package/src/SubPackages/react-dom/jsx/node.ts +68 -0
- package/src/{subPackages → SubPackages}/react-dom/jsx/web.ts +18 -54
- package/src/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.ts +9 -28
- package/src/{subPackages → SubPackages}/react-test-renderer/component/index.ts +31 -29
- package/src/SubPackages/react-test-renderer/component/node.ts +22 -0
- package/src/SubPackages/react-test-renderer/component/web.ts +22 -0
- package/src/{subPackages → SubPackages}/react-test-renderer/fc/node.ts +14 -28
- package/src/{subPackages → SubPackages}/react-test-renderer/fc/web.ts +9 -25
- package/src/{subPackages → SubPackages}/react-test-renderer/jsx/index.ts +19 -16
- package/src/SubPackages/react-test-renderer/jsx/node.ts +24 -0
- package/src/SubPackages/react-test-renderer/jsx/web.ts +20 -0
- package/src/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.ts +7 -15
- 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 +334 -3
- package/src/Web.ts +104 -230
- package/src/cjs-shim.js +12 -0
- package/src/electron.ts +237 -46
- package/src/esbuildConfigs/features.ts +18 -0
- package/src/esbuildConfigs/index.ts +22 -0
- package/src/esbuildConfigs/node.ts +59 -0
- package/src/esbuildConfigs/report.ts +51 -0
- package/src/esbuildConfigs/tests.ts +20 -0
- package/src/esbuildConfigs/web.ts +73 -0
- package/src/lib/abstractBase.ts +459 -0
- package/src/lib/basebuilder.ts +253 -0
- package/src/lib/browser.ts +34 -0
- package/src/lib/classBuilder.ts +137 -0
- package/src/lib/core.ts +182 -0
- package/src/lib/index.ts +116 -0
- package/src/nodeWriterElectron.ts +71 -0
- package/src/preload.ts +23 -21
- 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/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/node.d.ts +0 -9
- 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/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/jsx/node.ts +0 -145
- 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/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/src/electron.ts
CHANGED
|
@@ -1,59 +1,250 @@
|
|
|
1
|
-
import { app, BrowserWindow,
|
|
1
|
+
import { app, BrowserWindow, utilityProcess } from "electron";
|
|
2
|
+
import pie from "puppeteer-in-electron";
|
|
3
|
+
import puppeteer from "puppeteer-core";
|
|
4
|
+
import { IBuiltConfig, IJsonConfig, IRunTime, ITestTypes } from "./Types";
|
|
5
|
+
import fs from "fs";
|
|
2
6
|
import path from "path";
|
|
3
|
-
import
|
|
7
|
+
import { jsonc } from 'jsonc';
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
const remoteMain = require("@electron/remote/main");
|
|
6
10
|
|
|
7
|
-
|
|
8
|
-
win = new BrowserWindow({
|
|
11
|
+
remoteMain.initialize();
|
|
9
12
|
|
|
10
|
-
|
|
11
|
-
devTools: true,
|
|
12
|
-
nodeIntegration: true,
|
|
13
|
-
nodeIntegrationInWorker: true,
|
|
14
|
-
contextIsolation: false,
|
|
15
|
-
preload: path.join(app.getAppPath(), 'preload.js'),
|
|
16
|
-
sandbox: false
|
|
13
|
+
const main = async () => {
|
|
17
14
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
15
|
+
const configs = jsonc.parse(
|
|
16
|
+
(await fs.readFileSync("./docs/testeranto.json")).toString()
|
|
17
|
+
) as IBuiltConfig;
|
|
18
|
+
|
|
19
|
+
const loadReport = (configs: IBuiltConfig) => {
|
|
20
|
+
const win = new BrowserWindow(
|
|
21
|
+
{
|
|
22
|
+
show: true,
|
|
23
|
+
webPreferences: {
|
|
24
|
+
offscreen: false,
|
|
25
|
+
devTools: true,
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
win.loadFile(`/${configs.buildDir}/report.html`).then(async (x) => {
|
|
31
|
+
// pie.connect(app, puppeteer).then(async (browser) => {
|
|
32
|
+
// pie.getPage(browser, win).then(async (page) => {
|
|
33
|
+
// await page.screenshot({
|
|
34
|
+
// path: 'electron-puppeteer-screenshot1.jpg'
|
|
35
|
+
// });
|
|
36
|
+
// })
|
|
37
|
+
// })
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const launchNode = (t: string, x: string) => {
|
|
42
|
+
const f = x.replace(".ts", ".mjs");
|
|
43
|
+
|
|
44
|
+
const a = JSON.stringify(
|
|
45
|
+
{
|
|
46
|
+
scheduled: true,
|
|
47
|
+
name: x,
|
|
48
|
+
ports: [],
|
|
49
|
+
fs:
|
|
50
|
+
path.resolve(
|
|
51
|
+
configs.buildDir,
|
|
52
|
+
"node",
|
|
53
|
+
t,
|
|
54
|
+
),
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
console.log("launchNode", f, a);
|
|
58
|
+
|
|
59
|
+
const child = utilityProcess.fork(f, [a], {});
|
|
60
|
+
child.postMessage({ message: 'hello' })
|
|
61
|
+
child.on('message', (data) => {
|
|
62
|
+
console.log("from child", data);
|
|
63
|
+
launchWebSecondary(process.cwd() + data);
|
|
64
|
+
})
|
|
65
|
+
child.on('exit', (data) => {
|
|
66
|
+
console.log("node process ended with: ", data);
|
|
67
|
+
fileStream.close()
|
|
68
|
+
})
|
|
69
|
+
// child.stdout
|
|
70
|
+
// child..on("", (data) => {
|
|
71
|
+
// console.log("from child", data) // hello world!
|
|
72
|
+
// launchWebSecondary(process.cwd() + data);
|
|
73
|
+
// })
|
|
74
|
+
// Create a write stream for the file
|
|
75
|
+
const fileStream = fs.createWriteStream('errors.txt');
|
|
76
|
+
|
|
77
|
+
// Pipe the child process's stdout to the file
|
|
78
|
+
child.stdout?.pipe(fileStream);
|
|
79
|
+
|
|
80
|
+
// // Handle errors
|
|
81
|
+
// child.on('error', (err) => {
|
|
82
|
+
// console.error('Error spawning child process:', err);
|
|
83
|
+
// });
|
|
84
|
+
|
|
85
|
+
// fileStream.on('error', (err) => {
|
|
86
|
+
// console.error('Error writing to file:', err);
|
|
87
|
+
// });
|
|
88
|
+
|
|
89
|
+
// // Log a message when the child process exits
|
|
90
|
+
// child.on('close', (code) => {
|
|
91
|
+
// console.log(`Child process exited with code ${code}`);
|
|
92
|
+
// });
|
|
93
|
+
// console.log("child", child);
|
|
94
|
+
// child.stdout?.on("data", (x) => {
|
|
95
|
+
// console.log("x", x)
|
|
96
|
+
// })
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const launchWebSecondary = (htmlFile: string) => {
|
|
100
|
+
console.log("launchWebSecondary", htmlFile)
|
|
101
|
+
const subWin = new BrowserWindow(
|
|
102
|
+
{
|
|
103
|
+
show: true,
|
|
104
|
+
|
|
105
|
+
webPreferences: {
|
|
106
|
+
nodeIntegration: true,
|
|
107
|
+
nodeIntegrationInWorker: true,
|
|
108
|
+
contextIsolation: false,
|
|
109
|
+
preload: path.join(app.getAppPath(), 'preload.js'),
|
|
110
|
+
offscreen: false,
|
|
111
|
+
devTools: false,
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
)
|
|
116
|
+
remoteMain.enable(subWin.webContents);
|
|
117
|
+
subWin.webContents.openDevTools()
|
|
118
|
+
subWin.loadFile(htmlFile);
|
|
119
|
+
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
const launchWeb = (t: string, changedFile: string) => {
|
|
123
|
+
console.log("launchWeb", changedFile)
|
|
124
|
+
const subWin = new BrowserWindow(
|
|
125
|
+
{
|
|
126
|
+
show: true,
|
|
127
|
+
|
|
128
|
+
webPreferences: {
|
|
129
|
+
nodeIntegration: true,
|
|
130
|
+
nodeIntegrationInWorker: true,
|
|
131
|
+
contextIsolation: false,
|
|
132
|
+
preload: path.join(app.getAppPath(), 'preload.js'),
|
|
133
|
+
offscreen: false,
|
|
134
|
+
devTools: true,
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
)
|
|
139
|
+
remoteMain.enable(subWin.webContents);
|
|
140
|
+
// subWin.webContents.openDevTools()
|
|
141
|
+
|
|
142
|
+
const htmlFile = changedFile.split(".").slice(0, -1).concat("html").join(".")
|
|
143
|
+
|
|
144
|
+
subWin.loadFile(htmlFile, {
|
|
145
|
+
query: {
|
|
146
|
+
requesting: encodeURIComponent(JSON.stringify({
|
|
147
|
+
name: changedFile,
|
|
148
|
+
ports: [].toString(),
|
|
149
|
+
fs:
|
|
150
|
+
path.resolve(
|
|
151
|
+
configs.buildDir,
|
|
152
|
+
"web",
|
|
153
|
+
t,
|
|
154
|
+
),
|
|
155
|
+
}
|
|
156
|
+
))
|
|
157
|
+
}
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
const watcher = (test: string, runtime: IRunTime) => {
|
|
163
|
+
return path.normalize(
|
|
164
|
+
`${configs.buildDir}/${runtime}/${test.split('.').slice(0, -1).concat('mjs').join('.')}`
|
|
165
|
+
);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
const changer = (f: string) => {
|
|
169
|
+
return path.normalize(`${configs.buildDir}/${f}`);
|
|
170
|
+
};
|
|
171
|
+
const changer2 = (f: string, r: IRunTime) => {
|
|
172
|
+
return path.normalize(`${configs.buildDir}/${r}/${f}`);
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
pie.initialize(app, 2999).then(async () => {
|
|
176
|
+
|
|
177
|
+
app.on("ready", () => {
|
|
178
|
+
loadReport(configs);
|
|
179
|
+
|
|
180
|
+
console.log("running all the tests once initially");;
|
|
181
|
+
configs.modules.forEach((t) => {
|
|
182
|
+
if (t.runtime === "node") {
|
|
183
|
+
launchNode(t.test, changer2(t.test, "node"));
|
|
184
|
+
} else if (t.runtime === "web") {
|
|
185
|
+
launchWeb(t.test, changer2(t.test, "web"));
|
|
186
|
+
} else {
|
|
187
|
+
console.error("runtime makes no sense", t.runtime);
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
console.log("ready and watching for changes...", configs.buildDir);
|
|
193
|
+
fs.watch(configs.buildDir, {
|
|
194
|
+
recursive: true,
|
|
195
|
+
}, (eventType, changedFile) => {
|
|
196
|
+
console.log(eventType, changedFile);
|
|
197
|
+
if (changedFile) {
|
|
198
|
+
configs.modules.forEach((t) => {
|
|
199
|
+
if (watcher(t.test, t.runtime) === changer(changedFile)) {
|
|
200
|
+
if (t.runtime === "node") {
|
|
201
|
+
launchNode(t.test, changer(changedFile))
|
|
202
|
+
} else if (t.runtime === "web") {
|
|
203
|
+
launchWeb(t.test, changer(changedFile))
|
|
204
|
+
} else {
|
|
205
|
+
console.error("runtime makes no sense", t.runtime);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
})
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
})
|
|
212
|
+
});
|
|
30
213
|
});
|
|
31
|
-
console.log("loading", u);
|
|
32
|
-
win.loadURL(u);
|
|
33
|
-
win.webContents.openDevTools()
|
|
34
|
-
}
|
|
35
214
|
|
|
36
|
-
|
|
215
|
+
await pie.connect(app, puppeteer);
|
|
216
|
+
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
main();
|
|
220
|
+
|
|
221
|
+
// ipcMain.handle('web-log', (x, message: string) => {
|
|
222
|
+
// console.log("web-log)", message);
|
|
223
|
+
// });
|
|
37
224
|
|
|
38
|
-
ipcMain.handle('web-
|
|
39
|
-
|
|
40
|
-
});
|
|
225
|
+
// ipcMain.handle('web-error', (x, message: string) => {
|
|
226
|
+
// console.log("web-error)", message);
|
|
227
|
+
// });
|
|
41
228
|
|
|
42
|
-
ipcMain.handle('web-
|
|
43
|
-
|
|
44
|
-
});
|
|
229
|
+
// ipcMain.handle('web-warn', (x, message: string) => {
|
|
230
|
+
// console.log("web-warn)", message);
|
|
231
|
+
// });
|
|
45
232
|
|
|
46
|
-
ipcMain.handle('web-
|
|
47
|
-
|
|
48
|
-
});
|
|
233
|
+
// ipcMain.handle('web-info', (x, message: string) => {
|
|
234
|
+
// console.log("web-info)", message);
|
|
235
|
+
// });
|
|
49
236
|
|
|
50
|
-
ipcMain.handle('
|
|
51
|
-
|
|
52
|
-
|
|
237
|
+
// ipcMain.handle('quit-app', (x, failed: number) => {
|
|
238
|
+
// console.log("quit-app", failed);
|
|
239
|
+
// app.exit(failed);
|
|
240
|
+
// });
|
|
53
241
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
});
|
|
242
|
+
// process.stdin.on("data", (configTests) => {
|
|
243
|
+
// main(JSON.parse(configTests.toString()) as ITestTypes[]);
|
|
244
|
+
// });
|
|
58
245
|
|
|
59
|
-
|
|
246
|
+
// const watchables = (tests: ITestTypes[]) => {
|
|
247
|
+
// return tests.map((t) => {
|
|
248
|
+
// return [t[1], `dist/${t[1]}/${t[0].replace(".mts", ".mjs")}`]
|
|
249
|
+
// })
|
|
250
|
+
// }
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IBaseConfig } from "../Types";
|
|
2
|
+
|
|
3
|
+
import { BuildOptions } from "esbuild";
|
|
4
|
+
|
|
5
|
+
export default (config: IBaseConfig): BuildOptions => {
|
|
6
|
+
return {
|
|
7
|
+
bundle: true,
|
|
8
|
+
entryPoints: [config.features],
|
|
9
|
+
minify: config.minify === true,
|
|
10
|
+
outbase: config.outbase,
|
|
11
|
+
write: true,
|
|
12
|
+
|
|
13
|
+
outfile: `${config.outdir}/features.test.js`,
|
|
14
|
+
// external: ["graphology"],
|
|
15
|
+
|
|
16
|
+
format: "esm",
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { BuildOptions } from "esbuild";
|
|
2
|
+
import { config } from "process";
|
|
3
|
+
import { IBaseConfig } from "../Types";
|
|
4
|
+
|
|
5
|
+
export default (config: IBaseConfig): BuildOptions => {
|
|
6
|
+
return {
|
|
7
|
+
target: "esnext",
|
|
8
|
+
format: "esm",
|
|
9
|
+
splitting: true,
|
|
10
|
+
outExtension: { '.js': '.mjs' },
|
|
11
|
+
outbase: config.outbase,
|
|
12
|
+
jsx: 'transform',
|
|
13
|
+
bundle: true,
|
|
14
|
+
minify: config.minify === true,
|
|
15
|
+
write: true,
|
|
16
|
+
loader: {
|
|
17
|
+
'.js': 'jsx',
|
|
18
|
+
'.png': 'binary',
|
|
19
|
+
'.jpg': 'binary',
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { BuildOptions } from "esbuild";
|
|
2
|
+
|
|
3
|
+
import { IBaseConfig, IJsonConfig } from "../Types";
|
|
4
|
+
|
|
5
|
+
import baseEsBuildConfig from "./index.js";
|
|
6
|
+
import { jsonc } from "jsonc";
|
|
7
|
+
import fs from "fs"
|
|
8
|
+
|
|
9
|
+
// const jsonConfig = jsonc.parse((await fs.readFileSync("./testeranto.json")).toString()) as IJsonConfig;
|
|
10
|
+
|
|
11
|
+
export default (
|
|
12
|
+
config: IBaseConfig,
|
|
13
|
+
entryPoints: Set<string> | string[]
|
|
14
|
+
): BuildOptions => {
|
|
15
|
+
return {
|
|
16
|
+
...baseEsBuildConfig(config),
|
|
17
|
+
|
|
18
|
+
outdir: config.outdir + "/node",
|
|
19
|
+
|
|
20
|
+
inject: [`./node_modules/testeranto/dist/cjs-shim.js`],
|
|
21
|
+
|
|
22
|
+
supported: {
|
|
23
|
+
"dynamic-import": true
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
define: {
|
|
27
|
+
"process.env.FLUENTFFMPEG_COV": "0"
|
|
28
|
+
},
|
|
29
|
+
absWorkingDir: process.cwd(),
|
|
30
|
+
banner: {
|
|
31
|
+
js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`
|
|
32
|
+
},
|
|
33
|
+
platform: "node",
|
|
34
|
+
|
|
35
|
+
external: [
|
|
36
|
+
"testeranto.json",
|
|
37
|
+
"features.test.js",
|
|
38
|
+
"react",
|
|
39
|
+
"events",
|
|
40
|
+
// "ganache"
|
|
41
|
+
...config.externals
|
|
42
|
+
],
|
|
43
|
+
|
|
44
|
+
entryPoints: [...entryPoints],
|
|
45
|
+
plugins: [
|
|
46
|
+
...(config.nodePlugins || []),
|
|
47
|
+
{
|
|
48
|
+
name: 'rebuild-notify',
|
|
49
|
+
setup(build) {
|
|
50
|
+
build.onEnd(result => {
|
|
51
|
+
console.log(`node build ended with ${result.errors.length} errors`);
|
|
52
|
+
console.log(result)
|
|
53
|
+
result.errors.length !== 0 && process.exit(-1);
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// import { jsonc } from "jsonc";
|
|
2
|
+
|
|
3
|
+
// import { IBaseConfig, IJsonConfig } from "../Types";
|
|
4
|
+
|
|
5
|
+
// import baseEsBuildConfig from "./index.js";
|
|
6
|
+
|
|
7
|
+
// import fs from "fs"
|
|
8
|
+
// import { BuildOptions } from "esbuild";
|
|
9
|
+
// // import { CssModulesPlugin } from 'esbuild-css-modules-plugin';
|
|
10
|
+
// const jsonConfig = jsonc.parse((await fs.readFileSync("./testeranto.json")).toString()) as IJsonConfig;
|
|
11
|
+
|
|
12
|
+
// export default (config: IBaseConfig): BuildOptions => {
|
|
13
|
+
// return {
|
|
14
|
+
// bundle: true,
|
|
15
|
+
// entryPoints: ["./node_modules/testeranto/dist/module/report.js"],
|
|
16
|
+
// minify: config.minify === true,
|
|
17
|
+
// outbase: config.outbase,
|
|
18
|
+
// write: true,
|
|
19
|
+
// outfile: `${jsonConfig.outdir}/report.js`,
|
|
20
|
+
// external: [
|
|
21
|
+
// "tests.json",
|
|
22
|
+
// "features.test.js"
|
|
23
|
+
// ],
|
|
24
|
+
// // plugins: [
|
|
25
|
+
// // CssModulesPlugin({
|
|
26
|
+
// // // @see https://github.com/indooorsman/esbuild-css-modules-plugin/blob/main/index.d.ts for more details
|
|
27
|
+
// // force: true,
|
|
28
|
+
// // emitDeclarationFile: true,
|
|
29
|
+
// // localsConvention: 'camelCaseOnly',
|
|
30
|
+
// // namedExports: true,
|
|
31
|
+
// // inject: false
|
|
32
|
+
// // })
|
|
33
|
+
// // ]
|
|
34
|
+
// }
|
|
35
|
+
// // return {
|
|
36
|
+
// // bundle: true,
|
|
37
|
+
// // entryPoints: [
|
|
38
|
+
// // "./node_modules/testeranto/dist/module/Report.js",
|
|
39
|
+
// // jsonConfig.features
|
|
40
|
+
// // ],
|
|
41
|
+
// // minify: config.minify === true,
|
|
42
|
+
// // outbase: ".",
|
|
43
|
+
// // outdir: 'docs',
|
|
44
|
+
// // write: true,
|
|
45
|
+
// // // outfile: `${jsonConfig.outdir}/Report.js`,
|
|
46
|
+
// // external: [
|
|
47
|
+
// // "features.test.js",
|
|
48
|
+
// // "testeranto.json"
|
|
49
|
+
// // ]
|
|
50
|
+
// // }
|
|
51
|
+
// }
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsonc } from "jsonc";
|
|
2
|
+
|
|
3
|
+
import { IBaseConfig, IJsonConfig } from "../Types";
|
|
4
|
+
|
|
5
|
+
import fs from "fs"
|
|
6
|
+
import { BuildOptions } from "esbuild";
|
|
7
|
+
|
|
8
|
+
// const jsonConfig = jsonc.parse((await fs.readFileSync("./testeranto.json")).toString()) as IJsonConfig;
|
|
9
|
+
|
|
10
|
+
export default (config: IBaseConfig): BuildOptions => {
|
|
11
|
+
return {
|
|
12
|
+
bundle: true,
|
|
13
|
+
entryPoints: [config.features],
|
|
14
|
+
minify: config.minify === true,
|
|
15
|
+
outbase: config.outbase,
|
|
16
|
+
write: true,
|
|
17
|
+
outfile: `${config.outdir}/tests.test.js`,
|
|
18
|
+
// external: ["graphology"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { BuildOptions } from "esbuild";
|
|
2
|
+
import path from "path";
|
|
3
|
+
|
|
4
|
+
import { IBaseConfig, IJsonConfig } from "../Types";
|
|
5
|
+
|
|
6
|
+
import baseEsBuildConfig from "./index.js";
|
|
7
|
+
import { jsonc } from "jsonc";
|
|
8
|
+
import fs from "fs"
|
|
9
|
+
|
|
10
|
+
// const jsonConfig = jsonc.parse((await fs.readFileSync("./testeranto.json")).toString()) as IJsonConfig;
|
|
11
|
+
|
|
12
|
+
export default (
|
|
13
|
+
config: IBaseConfig,
|
|
14
|
+
entryPoints: Set<string> | string[]
|
|
15
|
+
): BuildOptions => {
|
|
16
|
+
return {
|
|
17
|
+
|
|
18
|
+
...baseEsBuildConfig(config),
|
|
19
|
+
|
|
20
|
+
// inject: ['./node_modules/testeranto/dist/cjs-shim.js'],
|
|
21
|
+
// banner: {
|
|
22
|
+
// js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`
|
|
23
|
+
// },
|
|
24
|
+
|
|
25
|
+
outdir: config.outdir + "/web",
|
|
26
|
+
|
|
27
|
+
alias: {
|
|
28
|
+
react: path.resolve("./node_modules/react")
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
external: [
|
|
32
|
+
"testeranto.json",
|
|
33
|
+
"features.test.ts",
|
|
34
|
+
// "url",
|
|
35
|
+
|
|
36
|
+
"react",
|
|
37
|
+
"electron",
|
|
38
|
+
|
|
39
|
+
"path",
|
|
40
|
+
"fs",
|
|
41
|
+
"stream",
|
|
42
|
+
"http",
|
|
43
|
+
"constants",
|
|
44
|
+
"net",
|
|
45
|
+
"assert",
|
|
46
|
+
"tls",
|
|
47
|
+
"os",
|
|
48
|
+
"child_process",
|
|
49
|
+
"readline",
|
|
50
|
+
"zlib",
|
|
51
|
+
"crypto",
|
|
52
|
+
"https"
|
|
53
|
+
],
|
|
54
|
+
|
|
55
|
+
platform: "browser",
|
|
56
|
+
|
|
57
|
+
entryPoints: [...entryPoints],
|
|
58
|
+
|
|
59
|
+
plugins: [
|
|
60
|
+
...(config.webPlugins || []),
|
|
61
|
+
{
|
|
62
|
+
name: 'rebuild-notify',
|
|
63
|
+
setup(build) {
|
|
64
|
+
build.onEnd(result => {
|
|
65
|
+
console.log(`web build ended with ${result.errors.length} errors`);
|
|
66
|
+
console.log(result)
|
|
67
|
+
result.errors.length !== 0 && process.exit(-1);
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
};
|
|
73
|
+
}
|