testeranto 0.62.0 → 0.73.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -26
- package/dist/cjs-shim.js +2 -2
- package/dist/common/Node.js +14 -51
- package/dist/common/PM/index.js +71 -0
- package/dist/common/PM/main.js +361 -0
- package/dist/common/PM/node.js +176 -0
- package/dist/common/PM/web.js +174 -0
- package/dist/common/Project.js +121 -266
- package/dist/common/Puppeteer.js +109 -0
- package/dist/common/Reporter.js +119 -0
- package/dist/common/Scheduler.js +1 -0
- package/dist/common/SubPackages/puppeteer.js +3 -1
- package/dist/common/SubPackages/react-dom/component/web.js +98 -45
- package/dist/common/SubPackages/react-dom/jsx/web.js +15 -7
- package/dist/common/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
- package/dist/common/SubPackages/react-test-renderer/component/index.js +0 -1
- package/dist/common/SubPackages/react-test-renderer/fc/web.js +1 -1
- package/dist/common/SubPackages/react-test-renderer/jsx/index.js +1 -3
- package/dist/common/SubPackages/react-test-renderer/jsx/web.js +1 -1
- package/dist/common/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
- package/dist/common/Types.js +2 -32
- package/dist/common/Web.js +25 -37
- package/dist/common/esbuildConfigs/index.js +5 -5
- package/dist/common/esbuildConfigs/node.js +17 -15
- package/dist/common/esbuildConfigs/report.js +12 -47
- package/dist/common/esbuildConfigs/tests.js +0 -1
- package/dist/common/esbuildConfigs/web.js +17 -12
- package/dist/common/lib/abstractBase.js +190 -35
- package/dist/common/lib/basebuilder.js +56 -29
- package/dist/common/lib/classBuilder.js +8 -5
- package/dist/common/lib/core.js +42 -17
- package/dist/common/lib/index.js +11 -8
- package/dist/common/lib/types.js +2 -0
- package/dist/common/preload.js +14 -28
- package/dist/common/puppeteerConfiger.js +24 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/Node.js +14 -51
- package/dist/module/PM/index.js +67 -0
- package/dist/module/PM/main.js +331 -0
- package/dist/module/PM/node.js +168 -0
- package/dist/module/PM/web.js +167 -0
- package/dist/module/Project.js +122 -267
- package/dist/module/Puppeteer.js +104 -0
- package/dist/module/Reporter.js +114 -0
- package/dist/module/Scheduler.js +1 -0
- package/dist/module/SubPackages/puppeteer.js +3 -1
- package/dist/module/SubPackages/react/jsx/node.js +1 -1
- package/dist/module/SubPackages/react/jsx/web.js +1 -1
- package/dist/module/SubPackages/react-dom/component/node.js +2 -2
- package/dist/module/SubPackages/react-dom/component/web.js +98 -45
- package/dist/module/SubPackages/react-dom/jsx/web.js +17 -9
- package/dist/module/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
- package/dist/module/SubPackages/react-test-renderer/component/index.js +0 -1
- package/dist/module/SubPackages/react-test-renderer/fc/web.js +1 -1
- package/dist/module/SubPackages/react-test-renderer/jsx/index.js +1 -3
- package/dist/module/SubPackages/react-test-renderer/jsx/web.js +1 -1
- package/dist/module/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
- package/dist/module/Types.js +3 -30
- package/dist/module/Web.js +26 -38
- package/dist/module/esbuildConfigs/index.js +5 -5
- package/dist/module/esbuildConfigs/node.js +17 -15
- package/dist/module/esbuildConfigs/report.js +11 -48
- package/dist/module/esbuildConfigs/tests.js +0 -1
- package/dist/module/esbuildConfigs/web.js +17 -12
- package/dist/module/lib/abstractBase.js +190 -35
- package/dist/module/lib/basebuilder.js +56 -29
- package/dist/module/lib/classBuilder.js +8 -5
- package/dist/module/lib/core.js +44 -19
- package/dist/module/lib/index.js +11 -8
- package/dist/module/preload.js +15 -27
- package/dist/module/puppeteerConfiger.js +19 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/Report.css +1616 -584
- package/dist/prebuild/Report.js +2635 -2506
- package/dist/types/Node.d.ts +3 -2
- package/dist/types/PM/index.d.ts +19 -0
- package/dist/types/PM/main.d.ts +28 -0
- package/dist/types/PM/node.d.ts +26 -0
- package/dist/types/PM/web.d.ts +24 -0
- package/dist/types/Project.d.ts +1 -2
- package/dist/types/Puppeteer.d.ts +1 -0
- package/dist/types/Reporter.d.ts +1 -0
- package/dist/types/Scheduler.d.ts +0 -0
- package/dist/types/SubPackages/puppeteer.d.ts +3 -3
- package/dist/types/SubPackages/react/component/node.d.ts +1 -1
- package/dist/types/SubPackages/react/component/web.d.ts +1 -1
- package/dist/types/SubPackages/react/jsx/index.d.ts +1 -1
- package/dist/types/SubPackages/react/jsx/node.d.ts +1 -1
- package/dist/types/SubPackages/react/jsx/web.d.ts +2 -2
- package/dist/types/SubPackages/react-dom/component/node.d.ts +2 -2
- package/dist/types/SubPackages/react-dom/component/web.d.ts +1 -1
- package/dist/types/SubPackages/react-dom/jsx/node.d.ts +1 -1
- package/dist/types/SubPackages/react-dom/jsx/web.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +3 -3
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +1 -1
- package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +1 -1
- package/dist/types/Types.d.ts +19 -100
- package/dist/types/Web.d.ts +3 -2
- package/dist/types/esbuildConfigs/features.d.ts +1 -1
- package/dist/types/esbuildConfigs/index.d.ts +1 -1
- package/dist/types/esbuildConfigs/node.d.ts +1 -1
- package/dist/types/esbuildConfigs/report.d.ts +4 -0
- package/dist/types/esbuildConfigs/tests.d.ts +1 -1
- package/dist/types/esbuildConfigs/web.d.ts +1 -1
- package/dist/types/lib/abstractBase.d.ts +26 -24
- package/dist/types/lib/basebuilder.d.ts +10 -7
- package/dist/types/lib/classBuilder.d.ts +4 -3
- package/dist/types/lib/core.d.ts +5 -4
- package/dist/types/lib/index.d.ts +7 -5
- package/dist/types/lib/types.d.ts +62 -0
- package/dist/types/preload.d.ts +0 -1
- package/dist/types/puppeteerConfiger.d.ts +4 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +6 -7
- package/src/Node.ts +30 -85
- package/src/PM/index.ts +102 -0
- package/src/PM/main.ts +420 -0
- package/src/PM/node.ts +515 -0
- package/src/PM/web.ts +497 -0
- package/src/Project.ts +183 -619
- package/src/Puppeteer.ts +131 -0
- package/src/Report.tsx +158 -44
- package/src/Reporter.ts +134 -0
- package/src/Scheduler.ts +0 -0
- package/src/SubPackages/puppeteer.ts +19 -14
- package/src/SubPackages/react/component/node.ts +20 -32
- package/src/SubPackages/react/component/web.ts +20 -30
- package/src/SubPackages/react/jsx/index.ts +13 -24
- package/src/SubPackages/react/jsx/node.ts +5 -8
- package/src/SubPackages/react/jsx/web.ts +10 -8
- package/src/SubPackages/react-dom/component/node.ts +17 -23
- package/src/SubPackages/react-dom/component/web.ts +134 -95
- package/src/SubPackages/react-dom/jsx/web.ts +41 -48
- package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +27 -37
- package/src/SubPackages/react-test-renderer/component/index.ts +16 -30
- package/src/SubPackages/react-test-renderer/component/node.ts +5 -11
- package/src/SubPackages/react-test-renderer/component/web.ts +5 -11
- package/src/SubPackages/react-test-renderer/fc/node.ts +36 -50
- package/src/SubPackages/react-test-renderer/fc/web.ts +37 -50
- package/src/SubPackages/react-test-renderer/jsx/index.ts +15 -21
- package/src/SubPackages/react-test-renderer/jsx/node.ts +6 -10
- package/src/SubPackages/react-test-renderer/jsx/web.ts +7 -7
- package/src/SubPackages/react-test-renderer/jsx-promised/index.ts +13 -16
- package/src/Types.ts +73 -307
- package/src/Web.ts +40 -81
- package/src/cjs-shim.js +2 -2
- package/src/esbuildConfigs/features.ts +3 -4
- package/src/esbuildConfigs/index.ts +8 -8
- package/src/esbuildConfigs/node.ts +21 -20
- package/src/esbuildConfigs/report.ts +15 -51
- package/src/esbuildConfigs/tests.ts +3 -9
- package/src/esbuildConfigs/web.ts +22 -20
- package/src/lib/abstractBase.ts +312 -164
- package/src/lib/basebuilder.ts +123 -127
- package/src/lib/classBuilder.ts +30 -48
- package/src/lib/core.ts +115 -84
- package/src/lib/index.ts +58 -56
- package/src/lib/types.ts +197 -0
- package/src/preload.ts +14 -30
- package/src/puppeteerConfiger.ts +26 -0
- package/src/web.html.ts +1 -1
- package/dist/common/NodeWriter.js +0 -56
- package/dist/common/electron.js +0 -196
- package/dist/common/lib/browser.js +0 -26
- package/dist/common/nodeWriterElectron.js +0 -55
- package/dist/module/NodeWriter.js +0 -50
- package/dist/module/electron.js +0 -191
- package/dist/module/lib/browser.js +0 -22
- package/dist/module/nodeWriterElectron.js +0 -52
- package/dist/types/NodeWriter.d.ts +0 -2
- package/dist/types/lib/browser.d.ts +0 -6
- package/dist/types/nodeWriterElectron.d.ts +0 -2
- package/src/NodeWriter.ts +0 -69
- package/src/electron.ts +0 -250
- package/src/lib/browser.ts +0 -34
- package/src/nodeWriterElectron.ts +0 -71
- package/yarn-error.log +0 -3144
- /package/dist/{types/electron.d.ts → module/lib/types.js} +0 -0
package/src/Puppeteer.ts
ADDED
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import readline from "readline";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { jsonc } from "jsonc";
|
|
5
|
+
import { v4 as uuidv4 } from "uuid";
|
|
6
|
+
|
|
7
|
+
import { IBuiltConfig, IRunTime } from "./lib/types";
|
|
8
|
+
|
|
9
|
+
import { PM_Main } from "./PM/main.js";
|
|
10
|
+
|
|
11
|
+
var mode: "DEV" | "PROD" = process.argv[2] === "-dev" ? "DEV" : "PROD";
|
|
12
|
+
|
|
13
|
+
const node2web: Record<string, string[]> = {};
|
|
14
|
+
const web2node: Record<string, string[]> = {};
|
|
15
|
+
const childProcesses: Record<string, "loaded" | "running" | "done"> = {};
|
|
16
|
+
|
|
17
|
+
readline.emitKeypressEvents(process.stdin);
|
|
18
|
+
if (process.stdin.isTTY) process.stdin.setRawMode(true);
|
|
19
|
+
|
|
20
|
+
console.log("\n Puppeteer is running. Press 'q' to quit\n");
|
|
21
|
+
process.stdin.on("keypress", (str, key) => {
|
|
22
|
+
if (key.name === "q") {
|
|
23
|
+
process.exit();
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const main = async () => {
|
|
28
|
+
const configs = jsonc.parse(
|
|
29
|
+
(await fs.readFileSync("./docs/testeranto.json")).toString()
|
|
30
|
+
) as IBuiltConfig;
|
|
31
|
+
|
|
32
|
+
const pm = new PM_Main(configs);
|
|
33
|
+
|
|
34
|
+
await pm.startPuppeteer(
|
|
35
|
+
{
|
|
36
|
+
waitForInitialPage: false,
|
|
37
|
+
executablePath: "/opt/homebrew/bin/chromium",
|
|
38
|
+
headless: true,
|
|
39
|
+
dumpio: true,
|
|
40
|
+
args: [
|
|
41
|
+
"--allow-file-access-from-files",
|
|
42
|
+
"--allow-running-insecure-content",
|
|
43
|
+
"--auto-open-devtools-for-tabs",
|
|
44
|
+
"--disable-dev-shm-usage",
|
|
45
|
+
"--disable-extensions",
|
|
46
|
+
"--disable-gpu",
|
|
47
|
+
"--disable-setuid-sandbox",
|
|
48
|
+
"--disable-site-isolation-trials",
|
|
49
|
+
"--disable-web-security",
|
|
50
|
+
"--disable-web-security",
|
|
51
|
+
"--no-first-run",
|
|
52
|
+
"--no-sandbox",
|
|
53
|
+
"--no-startup-window",
|
|
54
|
+
// "--no-zygote",
|
|
55
|
+
"--reduce-security-for-testing",
|
|
56
|
+
"--remote-allow-origins=*",
|
|
57
|
+
"--unsafely-treat-insecure-origin-as-secure=*",
|
|
58
|
+
// "--disable-features=IsolateOrigins",
|
|
59
|
+
// "--remote-allow-origins=ws://localhost:3234",
|
|
60
|
+
// "--single-process",
|
|
61
|
+
// "--unsafely-treat-insecure-origin-as-secure",
|
|
62
|
+
// "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
|
|
63
|
+
`--remote-debugging-port=3234`,
|
|
64
|
+
|
|
65
|
+
// "--disk-cache-dir=/dev/null",
|
|
66
|
+
// "--disk-cache-size=1",
|
|
67
|
+
// "--start-maximized",
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
"."
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
const destinationOfRuntime = (f: string, r: IRunTime) => {
|
|
74
|
+
return path
|
|
75
|
+
.normalize(`${configs.buildDir}/${r}/${f}`)
|
|
76
|
+
.split(".")
|
|
77
|
+
.slice(0, -1)
|
|
78
|
+
.join(".");
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
|
|
82
|
+
if (runtime === "node") {
|
|
83
|
+
pm.launchNode(test, destinationOfRuntime(test, "node"));
|
|
84
|
+
} else if (runtime === "web") {
|
|
85
|
+
pm.launchWeb(test, destinationOfRuntime(test, "web"));
|
|
86
|
+
} else {
|
|
87
|
+
console.error("runtime makes no sense", runtime);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
console.log("ready and watching for changes...", configs.buildDir);
|
|
92
|
+
fs.watch(
|
|
93
|
+
configs.buildDir,
|
|
94
|
+
{
|
|
95
|
+
recursive: true,
|
|
96
|
+
},
|
|
97
|
+
(eventType, changedFile) => {
|
|
98
|
+
if (changedFile) {
|
|
99
|
+
configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
|
|
100
|
+
if (eventType === "change" || eventType === "rename") {
|
|
101
|
+
if (
|
|
102
|
+
changedFile ===
|
|
103
|
+
test
|
|
104
|
+
.replace("./", "node/")
|
|
105
|
+
.split(".")
|
|
106
|
+
.slice(0, -1)
|
|
107
|
+
.concat("mjs")
|
|
108
|
+
.join(".")
|
|
109
|
+
) {
|
|
110
|
+
pm.launchNode(test, destinationOfRuntime(test, "node"));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (
|
|
114
|
+
changedFile ===
|
|
115
|
+
test
|
|
116
|
+
.replace("./", "web/")
|
|
117
|
+
.split(".")
|
|
118
|
+
.slice(0, -1)
|
|
119
|
+
.concat("mjs")
|
|
120
|
+
.join(".")
|
|
121
|
+
) {
|
|
122
|
+
pm.launchWeb(test, destinationOfRuntime(test, "web"));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
main();
|
package/src/Report.tsx
CHANGED
|
@@ -10,8 +10,8 @@ import { Sigma, RandomizeNodePositions, RelativeSize } from 'react-sigma';
|
|
|
10
10
|
|
|
11
11
|
import 'bootstrap/dist/css/bootstrap.min.css';
|
|
12
12
|
|
|
13
|
-
import type { ITestTypes } from "./Types";
|
|
14
13
|
import { TesterantoFeatures } from "./Features.js";
|
|
14
|
+
import { IRunTime, ITestTypes } from "./lib/types.js";
|
|
15
15
|
|
|
16
16
|
type IGraphData = {
|
|
17
17
|
nodes: { id: string, label: string }[],
|
|
@@ -45,14 +45,34 @@ document.addEventListener("DOMContentLoaded", function () {
|
|
|
45
45
|
});
|
|
46
46
|
|
|
47
47
|
const Report = () => {
|
|
48
|
+
|
|
49
|
+
const [state, setState] = useState<{
|
|
50
|
+
tests: ITestTypes[],
|
|
51
|
+
buildDir: string,
|
|
52
|
+
features: TesterantoFeatures
|
|
53
|
+
results: any
|
|
54
|
+
}>({
|
|
55
|
+
tests: [],
|
|
56
|
+
buildDir: "",
|
|
57
|
+
features: new TesterantoFeatures({}, {
|
|
58
|
+
undirected: [],
|
|
59
|
+
directed: [],
|
|
60
|
+
dags: []
|
|
61
|
+
}),
|
|
62
|
+
results: {}
|
|
63
|
+
});
|
|
64
|
+
|
|
48
65
|
const [tests, setTests] = useState<
|
|
49
66
|
{
|
|
50
|
-
tests: ITestTypes[]
|
|
67
|
+
tests: ITestTypes[],
|
|
68
|
+
buildDir: string,
|
|
51
69
|
}
|
|
52
70
|
|
|
53
71
|
>({
|
|
54
|
-
tests: []
|
|
72
|
+
tests: [],
|
|
73
|
+
buildDir: ""
|
|
55
74
|
});
|
|
75
|
+
|
|
56
76
|
const [features, setFeatures] = useState<TesterantoFeatures>(
|
|
57
77
|
new TesterantoFeatures({}, {
|
|
58
78
|
undirected: [],
|
|
@@ -61,34 +81,102 @@ const Report = () => {
|
|
|
61
81
|
})
|
|
62
82
|
);
|
|
63
83
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
console.log("imported features", module.default);
|
|
68
|
-
setFeatures(module.default);
|
|
69
|
-
};
|
|
70
|
-
importFeatures();
|
|
71
|
-
}, []);
|
|
84
|
+
const [results, setResults] = useState<Record<string, { exitcode, log, testresults, manifest }>>(
|
|
85
|
+
{}
|
|
86
|
+
);
|
|
72
87
|
|
|
88
|
+
const importState = async () => {
|
|
89
|
+
const features = await import('features.test.js');
|
|
90
|
+
const config = await (await fetch("./testeranto.json")).json();
|
|
91
|
+
const results = await Promise.all(config.tests.map((test) => {
|
|
92
|
+
return new Promise(async (res, rej) => {
|
|
93
|
+
const src: string = test[0];
|
|
94
|
+
const runtime: IRunTime = test[1];
|
|
95
|
+
const s: string = [tests.buildDir, runtime as string].concat(src.split(".").slice(0, - 1).join(".")).join("/");
|
|
96
|
+
const exitcode = await (await fetch(config.buildDir + "/" + s + "/exitcode")).text()
|
|
97
|
+
const log = await (await fetch(config.buildDir + "/" + s + "/log.txt")).text()
|
|
98
|
+
const testresults = await (await fetch(config.buildDir + "/" + s + "/tests.json")).json()
|
|
99
|
+
const manifest = await (await fetch(config.buildDir + "/" + s + "/manifest.json")).json()
|
|
100
|
+
|
|
101
|
+
res({ src, exitcode, log, testresults, manifest })
|
|
102
|
+
})
|
|
103
|
+
}))
|
|
104
|
+
// const results = await config.tests.reduce(async (p, test) => {
|
|
105
|
+
// const src: string = test[0];
|
|
106
|
+
// const runtime: IRunTime = test[1];
|
|
107
|
+
// console.log(runtime)
|
|
108
|
+
// const s: string = [tests.buildDir, runtime as string].concat(src.split(".").slice(0, - 1).join(".")).join("/");
|
|
109
|
+
// // const srr
|
|
110
|
+
// console.log("s", s)
|
|
111
|
+
|
|
112
|
+
// const exitcode = await (await fetch(config.buildDir + "/" + s + "/exitcode")).text()
|
|
113
|
+
// const log = await (await fetch(config.buildDir + "/" + s + "/log.txt")).text()
|
|
114
|
+
// const testresults = await (await fetch(config.buildDir + "/" + s + "/tests.json")).text()
|
|
115
|
+
|
|
116
|
+
// // setResults({ src, exitcode, log, testresults })
|
|
117
|
+
// // console.log("a", await a.text())
|
|
118
|
+
// p[src] = { exitcode, log, testresults }
|
|
119
|
+
// return p
|
|
120
|
+
// }, {});
|
|
121
|
+
|
|
122
|
+
console.log("results", results)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
setState({ tests: config.tests as any, results, features: features as any, buildDir: config.buildDir })
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
const importFeatures = async () => {
|
|
129
|
+
const module = await import('features.test.js');
|
|
130
|
+
setFeatures(module.default);
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const importTests = async () => {
|
|
134
|
+
const x = await fetch("./testeranto.json")
|
|
135
|
+
const y = await x.json();
|
|
136
|
+
setTests(y as any);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
useEffect(() => { importState(); }, []);
|
|
140
|
+
|
|
141
|
+
useEffect(() => { importFeatures(); }, []);
|
|
142
|
+
useEffect(() => { importTests(); }, []);
|
|
73
143
|
|
|
74
144
|
useEffect(() => {
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
145
|
+
const collateResults = async () => {
|
|
146
|
+
console.log("collating", tests, features);
|
|
147
|
+
const r = tests.tests.reduce(async (p, test) => {
|
|
148
|
+
const src: string = test[0];
|
|
149
|
+
const runtime: IRunTime = test[1];
|
|
150
|
+
console.log(runtime)
|
|
151
|
+
const s: string = [tests.buildDir, runtime as string].concat(src.split(".").slice(0, - 1).join(".")).join("/");
|
|
152
|
+
// const srr
|
|
153
|
+
// console.log(s)
|
|
154
|
+
|
|
155
|
+
const exitcode = await (await fetch(s + "/exitcode")).text()
|
|
156
|
+
const log = await (await fetch(s + "/log.txt")).text()
|
|
157
|
+
const testresults = await (await fetch(s + "/tests.json")).text()
|
|
158
|
+
|
|
159
|
+
// setResults({ src, exitcode, log, testresults })
|
|
160
|
+
// console.log("a", await a.text())
|
|
161
|
+
p[src] = { exitcode, log, testresults }
|
|
162
|
+
}, {});
|
|
163
|
+
|
|
164
|
+
setResults(r);
|
|
165
|
+
// const x = await fetch("./testeranto.json")
|
|
166
|
+
// const y = await x.json();
|
|
167
|
+
// setTests(y as any);
|
|
80
168
|
// const module = await import('tests.json', {
|
|
81
169
|
// with: {
|
|
82
170
|
// type: 'json'
|
|
83
171
|
// }
|
|
84
172
|
// });
|
|
85
173
|
// console.log("imported tests", module.default);
|
|
86
|
-
//
|
|
174
|
+
// setResults("foo");
|
|
87
175
|
};
|
|
88
|
-
|
|
89
|
-
importTests();
|
|
176
|
+
collateResults();
|
|
90
177
|
}, []);
|
|
91
178
|
|
|
179
|
+
console.log("state.results", state.results);
|
|
92
180
|
|
|
93
181
|
return (
|
|
94
182
|
<div>
|
|
@@ -96,6 +184,7 @@ const Report = () => {
|
|
|
96
184
|
{`
|
|
97
185
|
pre, code, p {
|
|
98
186
|
max-width: 30rem;
|
|
187
|
+
text-wrap: auto;
|
|
99
188
|
}
|
|
100
189
|
footer {
|
|
101
190
|
background-color: lightgray;
|
|
@@ -108,11 +197,16 @@ footer {
|
|
|
108
197
|
`}
|
|
109
198
|
</style>
|
|
110
199
|
|
|
111
|
-
{features && tests && < Tabs defaultActiveKey="
|
|
200
|
+
{features && tests && < Tabs defaultActiveKey="config" >
|
|
201
|
+
|
|
202
|
+
|
|
112
203
|
|
|
113
|
-
<Tab eventKey="
|
|
114
|
-
<pre>{JSON.stringify(
|
|
115
|
-
|
|
204
|
+
<Tab eventKey="config" title="config">
|
|
205
|
+
<pre>{JSON.stringify(state, null, 2)}</pre>
|
|
206
|
+
</Tab>
|
|
207
|
+
|
|
208
|
+
<Tab eventKey="results" title="results">
|
|
209
|
+
<pre>{JSON.stringify(state.results, null, 2)}</pre>
|
|
116
210
|
</Tab>
|
|
117
211
|
|
|
118
212
|
<Tab eventKey="features" title="features">
|
|
@@ -168,7 +262,7 @@ footer {
|
|
|
168
262
|
</Tab>
|
|
169
263
|
|
|
170
264
|
<Tab eventKey="feature.tests" title="tests">
|
|
171
|
-
<pre id="theProps">{JSON.stringify(tests, null, 2)}</pre>
|
|
265
|
+
<pre id="theProps">{JSON.stringify(tests.tests, null, 2)}</pre>
|
|
172
266
|
</Tab>
|
|
173
267
|
</Tabs>
|
|
174
268
|
</Col>
|
|
@@ -221,7 +315,7 @@ footer {
|
|
|
221
315
|
</Tab>
|
|
222
316
|
|
|
223
317
|
<Tab eventKey="feature.tests" title="tests">
|
|
224
|
-
<pre id="theProps">{JSON.stringify(tests, null, 2)}</pre>
|
|
318
|
+
<pre id="theProps">{JSON.stringify(tests.tests, null, 2)}</pre>
|
|
225
319
|
</Tab>
|
|
226
320
|
</Tabs>
|
|
227
321
|
</Col>
|
|
@@ -270,7 +364,7 @@ footer {
|
|
|
270
364
|
</Tab>
|
|
271
365
|
|
|
272
366
|
<Tab eventKey="feature.tests" title="tests">
|
|
273
|
-
<pre id="theProps">{JSON.stringify(tests, null, 2)}</pre>
|
|
367
|
+
<pre id="theProps">{JSON.stringify(tests.tests, null, 2)}</pre>
|
|
274
368
|
</Tab>
|
|
275
369
|
</Tabs>
|
|
276
370
|
</Col>
|
|
@@ -317,7 +411,7 @@ footer {
|
|
|
317
411
|
</Tab>
|
|
318
412
|
|
|
319
413
|
<Tab eventKey="feature.tests" title="tests">
|
|
320
|
-
<pre id="theProps">{JSON.stringify(tests, null, 2)}</pre>
|
|
414
|
+
<pre id="theProps">{JSON.stringify(tests.tests, null, 2)}</pre>
|
|
321
415
|
</Tab>
|
|
322
416
|
</Tabs>
|
|
323
417
|
</Col>
|
|
@@ -332,33 +426,53 @@ footer {
|
|
|
332
426
|
</Tab.Container>
|
|
333
427
|
</Tab>
|
|
334
428
|
|
|
335
|
-
<Tab eventKey="
|
|
429
|
+
<Tab eventKey="tests" title="tests">
|
|
336
430
|
<Tab.Container id="left-tabs-example5" defaultActiveKey="feature-0">
|
|
337
431
|
<Row>
|
|
338
432
|
<Col sm={2}>
|
|
339
433
|
{/* <Tree tests={features.tests} /> */}
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
434
|
+
<Nav variant="pills" className="flex-column">
|
|
435
|
+
{
|
|
436
|
+
tests.tests.map((t, ndx) =>
|
|
437
|
+
<Nav.Item key={ndx}>
|
|
438
|
+
<Nav.Link eventKey={`test-${ndx}`}>
|
|
439
|
+
{t[0]} - {t[1]}
|
|
440
|
+
</Nav.Link>
|
|
441
|
+
</Nav.Item>
|
|
442
|
+
)
|
|
443
|
+
}
|
|
444
|
+
</Nav>
|
|
351
445
|
</Col>
|
|
352
446
|
<Col sm={6}>
|
|
353
447
|
<Tab.Content>
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
448
|
+
|
|
449
|
+
{
|
|
450
|
+
tests.tests.map((t, ndx) =>
|
|
451
|
+
<Tab.Pane eventKey={`test-${ndx}`}>
|
|
452
|
+
{/* <pre>{JSON.stringify(t, null, 2)}</pre> */}
|
|
453
|
+
{/* <pre>{JSON.stringify(state.results, null, 2)}</pre> */}
|
|
454
|
+
<pre>{JSON.stringify(Object.entries(state.results).filter(([k, v]: [string, { src: string }]) => {
|
|
455
|
+
console.log(v.src, tests.tests[ndx][0])
|
|
456
|
+
return v.src === tests.tests[ndx][0]
|
|
457
|
+
}), null, 2)}</pre>
|
|
458
|
+
|
|
459
|
+
{/* {tests.tests.map((t, ndx) => {
|
|
460
|
+
return (
|
|
461
|
+
<Tab.Pane eventKey={`feature-${ndx}`} key={ndx}>
|
|
462
|
+
<pre>{JSON.stringify(t, null, 2)}</pre>
|
|
463
|
+
</Tab.Pane>
|
|
464
|
+
)
|
|
465
|
+
}
|
|
466
|
+
)} */}
|
|
467
|
+
|
|
358
468
|
</Tab.Pane>
|
|
469
|
+
|
|
359
470
|
)
|
|
360
471
|
}
|
|
361
|
-
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
362
476
|
</Tab.Content>
|
|
363
477
|
</Col>
|
|
364
478
|
|
package/src/Reporter.ts
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import readline from "readline";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import { jsonc } from "jsonc";
|
|
4
|
+
import puppeteer from "puppeteer-core";
|
|
5
|
+
|
|
6
|
+
import { IBuiltConfig, IRunTime } from "./lib/types";
|
|
7
|
+
|
|
8
|
+
// import { PM_Main } from "./PM/main.js";
|
|
9
|
+
|
|
10
|
+
// var mode: "DEV" | "PROD" = process.argv[2] === "-dev" ? "DEV" : "PROD";
|
|
11
|
+
|
|
12
|
+
// const node2web: Record<string, string[]> = {};
|
|
13
|
+
// const web2node: Record<string, string[]> = {};
|
|
14
|
+
// const childProcesses: Record<string, "loaded" | "running" | "done"> = {};
|
|
15
|
+
|
|
16
|
+
readline.emitKeypressEvents(process.stdin);
|
|
17
|
+
if (process.stdin.isTTY) process.stdin.setRawMode(true);
|
|
18
|
+
|
|
19
|
+
console.log("\n Puppeteer is running. Press 'q' to quit\n");
|
|
20
|
+
process.stdin.on("keypress", (str, key) => {
|
|
21
|
+
if (key.name === "q") {
|
|
22
|
+
process.exit();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const main = async () => {
|
|
27
|
+
const configs = jsonc.parse(
|
|
28
|
+
(await fs.readFileSync("./docs/testeranto.json")).toString()
|
|
29
|
+
) as IBuiltConfig;
|
|
30
|
+
|
|
31
|
+
// const pm = new PM_Main(configs);
|
|
32
|
+
|
|
33
|
+
// await puppeteer.launch(options);
|
|
34
|
+
const browser = await puppeteer.launch(
|
|
35
|
+
{
|
|
36
|
+
waitForInitialPage: false,
|
|
37
|
+
executablePath: "/opt/homebrew/bin/chromium",
|
|
38
|
+
headless: false,
|
|
39
|
+
args: [
|
|
40
|
+
"--allow-file-access-from-files",
|
|
41
|
+
"--allow-running-insecure-content",
|
|
42
|
+
// "--auto-open-devtools-for-tabs",
|
|
43
|
+
"--disable-dev-shm-usage",
|
|
44
|
+
"--disable-extensions",
|
|
45
|
+
"--disable-gpu",
|
|
46
|
+
"--disable-setuid-sandbox",
|
|
47
|
+
"--disable-site-isolation-trials",
|
|
48
|
+
"--disable-web-security",
|
|
49
|
+
"--disable-web-security",
|
|
50
|
+
"--no-first-run",
|
|
51
|
+
"--no-sandbox",
|
|
52
|
+
"--no-startup-window",
|
|
53
|
+
"--no-zygote",
|
|
54
|
+
"--reduce-security-for-testing",
|
|
55
|
+
"--remote-allow-origins=*",
|
|
56
|
+
// "--remote-allow-origins=ws://localhost:3234",
|
|
57
|
+
"--unsafely-treat-insecure-origin-as-secure=*",
|
|
58
|
+
// "--disable-features=IsolateOrigins",
|
|
59
|
+
// "--single-process",
|
|
60
|
+
// "--unsafely-treat-insecure-origin-as-secure",
|
|
61
|
+
// "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
|
|
62
|
+
// `--remote-debugging-port=3234`,
|
|
63
|
+
],
|
|
64
|
+
}
|
|
65
|
+
// "."
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
console.log("Creating new page...");
|
|
69
|
+
const page = await browser.newPage();
|
|
70
|
+
|
|
71
|
+
await page.setViewport({ width: 0, height: 0 });
|
|
72
|
+
|
|
73
|
+
console.log("Requesting url...");
|
|
74
|
+
await page.goto(`file://${process.cwd()}/docs/report.html`);
|
|
75
|
+
|
|
76
|
+
// const destinationOfRuntime = (f: string, r: IRunTime) => {
|
|
77
|
+
// return path
|
|
78
|
+
// .normalize(`${configs.buildDir}/${r}/${f}`)
|
|
79
|
+
// .split(".")
|
|
80
|
+
// .slice(0, -1)
|
|
81
|
+
// .join(".");
|
|
82
|
+
// };
|
|
83
|
+
|
|
84
|
+
// configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
|
|
85
|
+
// if (runtime === "node") {
|
|
86
|
+
// pm.launchNode(test, destinationOfRuntime(test, "node"));
|
|
87
|
+
// } else if (runtime === "web") {
|
|
88
|
+
// pm.launchWeb(test, destinationOfRuntime(test, "web"));
|
|
89
|
+
// } else {
|
|
90
|
+
// console.error("runtime makes no sense", runtime);
|
|
91
|
+
// }
|
|
92
|
+
// });
|
|
93
|
+
|
|
94
|
+
// console.log("ready and watching for changes...", configs.buildDir);
|
|
95
|
+
// fs.watch(
|
|
96
|
+
// configs.buildDir,
|
|
97
|
+
// {
|
|
98
|
+
// recursive: true,
|
|
99
|
+
// },
|
|
100
|
+
// (eventType, changedFile) => {
|
|
101
|
+
// if (changedFile) {
|
|
102
|
+
// configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
|
|
103
|
+
// if (eventType === "change" || eventType === "rename") {
|
|
104
|
+
// if (
|
|
105
|
+
// changedFile ===
|
|
106
|
+
// test
|
|
107
|
+
// .replace("./", "node/")
|
|
108
|
+
// .split(".")
|
|
109
|
+
// .slice(0, -1)
|
|
110
|
+
// .concat("mjs")
|
|
111
|
+
// .join(".")
|
|
112
|
+
// ) {
|
|
113
|
+
// pm.launchNode(test, destinationOfRuntime(test, "node"));
|
|
114
|
+
// }
|
|
115
|
+
|
|
116
|
+
// if (
|
|
117
|
+
// changedFile ===
|
|
118
|
+
// test
|
|
119
|
+
// .replace("./", "web/")
|
|
120
|
+
// .split(".")
|
|
121
|
+
// .slice(0, -1)
|
|
122
|
+
// .concat("mjs")
|
|
123
|
+
// .join(".")
|
|
124
|
+
// ) {
|
|
125
|
+
// pm.launchWeb(test, destinationOfRuntime(test, "web"));
|
|
126
|
+
// }
|
|
127
|
+
// }
|
|
128
|
+
// });
|
|
129
|
+
// }
|
|
130
|
+
// }
|
|
131
|
+
// );
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
main();
|
package/src/Scheduler.ts
ADDED
|
File without changes
|
|
@@ -2,22 +2,27 @@ import React from "react";
|
|
|
2
2
|
|
|
3
3
|
import Testeranto from "../Node.js";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
IBaseTest,
|
|
7
|
+
IPartialNodeInterface,
|
|
8
|
+
ITestImplementation,
|
|
9
|
+
ITestSpecification,
|
|
10
|
+
} from "../Types";
|
|
6
11
|
|
|
7
12
|
type IInput = string;
|
|
8
13
|
type ISelection = any;
|
|
9
|
-
type IStore = any
|
|
10
|
-
type ISubject = any
|
|
14
|
+
type IStore = any;
|
|
15
|
+
type ISubject = any;
|
|
11
16
|
|
|
12
|
-
export type IImpl<ISpec extends IBaseTest> = ITestImplementation<ISpec
|
|
17
|
+
export type IImpl<ISpec extends IBaseTest> = ITestImplementation<ISpec>;
|
|
13
18
|
|
|
14
19
|
export type ISpec<T extends IBaseTest> = ITestSpecification<T>;
|
|
15
20
|
|
|
16
21
|
export default <ITestShape extends IBaseTest>(
|
|
17
22
|
testInput: IInput,
|
|
18
23
|
testSpecifications: ISpec<ITestShape>,
|
|
19
|
-
testImplementations: ITestImplementation<ITestShape
|
|
20
|
-
testInterface?:
|
|
24
|
+
testImplementations: ITestImplementation<ITestShape>,
|
|
25
|
+
testInterface?: IPartialNodeInterface<ITestShape>
|
|
21
26
|
) => {
|
|
22
27
|
return Testeranto<ITestShape>(
|
|
23
28
|
testInput,
|
|
@@ -25,22 +30,22 @@ export default <ITestShape extends IBaseTest>(
|
|
|
25
30
|
testImplementations,
|
|
26
31
|
{
|
|
27
32
|
beforeAll(x) {
|
|
28
|
-
process.parentPort.postMessage(
|
|
33
|
+
// process.parentPort.postMessage(
|
|
34
|
+
// `/docs/web/src/ClassicalComponent/test.html`
|
|
35
|
+
// );
|
|
29
36
|
|
|
30
37
|
return x;
|
|
31
38
|
},
|
|
32
|
-
beforeEach: async (
|
|
33
|
-
): Promise<IStore> => {
|
|
39
|
+
beforeEach: async (): Promise<IStore> => {
|
|
34
40
|
return new Promise((resolve, rej) => {
|
|
35
|
-
resolve(React.createElement(testInput, {
|
|
36
|
-
}, []));
|
|
41
|
+
resolve(React.createElement(testInput, {}, []));
|
|
37
42
|
});
|
|
38
43
|
},
|
|
39
44
|
andWhen: function (s: IStore, whenCB): Promise<ISelection> {
|
|
40
45
|
return whenCB()(s);
|
|
41
46
|
},
|
|
42
47
|
|
|
43
|
-
...testInterface
|
|
44
|
-
}
|
|
45
|
-
)
|
|
48
|
+
...testInterface,
|
|
49
|
+
}
|
|
50
|
+
);
|
|
46
51
|
};
|