testeranto 0.70.0 → 0.74.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 +9 -18
- package/dist/common/Node.js +7 -34
- package/dist/common/PM/index.js +71 -0
- package/dist/common/PM/main.js +370 -0
- package/dist/common/PM/node.js +84 -0
- package/dist/common/PM/web.js +129 -0
- package/dist/common/Project.js +20 -2
- 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/jsx/index.js +14 -2
- package/dist/common/SubPackages/react-dom/component/web.js +98 -45
- package/dist/common/SubPackages/react-test-renderer/jsx/index.js +0 -1
- package/dist/common/Web.js +24 -44
- package/dist/common/esbuildConfigs/web.js +3 -1
- package/dist/common/lib/abstractBase.js +189 -41
- package/dist/common/lib/basebuilder.js +56 -29
- package/dist/common/lib/classBuilder.js +6 -2
- package/dist/common/lib/core.js +41 -45
- package/dist/common/lib/index.js +2 -1
- package/dist/common/preload.js +14 -18
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/Node.js +7 -34
- package/dist/module/PM/index.js +67 -0
- package/dist/module/PM/main.js +340 -0
- package/dist/module/PM/node.js +77 -0
- package/dist/module/PM/web.js +122 -0
- package/dist/module/Project.js +20 -2
- 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/index.js +11 -2
- package/dist/module/SubPackages/react/jsx/node.js +1 -1
- package/dist/module/SubPackages/react-dom/component/web.js +98 -45
- package/dist/module/SubPackages/react-test-renderer/jsx/index.js +0 -1
- package/dist/module/Web.js +24 -44
- package/dist/module/esbuildConfigs/web.js +3 -1
- package/dist/module/lib/abstractBase.js +189 -41
- package/dist/module/lib/basebuilder.js +56 -29
- package/dist/module/lib/classBuilder.js +6 -2
- package/dist/module/lib/core.js +41 -45
- package/dist/module/lib/index.js +2 -1
- package/dist/module/preload.js +15 -14
- 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/PM/index.d.ts +19 -0
- package/dist/types/PM/main.d.ts +26 -0
- package/dist/types/PM/node.d.ts +25 -0
- package/dist/types/PM/web.d.ts +24 -0
- package/dist/types/Reporter.d.ts +1 -0
- package/dist/types/Scheduler.d.ts +0 -0
- package/dist/types/SubPackages/react/jsx/index.d.ts +2 -5
- package/dist/types/SubPackages/react-dom/component/web.d.ts +1 -1
- package/dist/types/lib/abstractBase.d.ts +13 -12
- package/dist/types/lib/basebuilder.d.ts +4 -2
- package/dist/types/lib/classBuilder.d.ts +2 -2
- package/dist/types/lib/core.d.ts +4 -4
- package/dist/types/lib/index.d.ts +6 -5
- package/dist/types/lib/types.d.ts +16 -24
- package/dist/types/preload.d.ts +0 -1
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/package.json +3 -5
- package/src/Node.ts +8 -47
- package/src/PM/index.ts +102 -0
- package/src/PM/main.ts +452 -0
- package/src/PM/node.ts +122 -0
- package/src/PM/web.ts +162 -0
- package/src/Project.ts +21 -2
- package/src/Puppeteer.ts +131 -0
- package/src/Report.tsx +160 -46
- package/src/Reporter.ts +134 -0
- package/src/Scheduler.ts +0 -0
- package/src/SubPackages/puppeteer.ts +3 -3
- package/src/SubPackages/react/jsx/index.ts +13 -3
- package/src/SubPackages/react/jsx/node.ts +5 -8
- package/src/SubPackages/react-dom/component/web.ts +126 -67
- package/src/SubPackages/react-test-renderer/jsx/index.ts +0 -1
- package/src/Web.ts +25 -69
- package/src/esbuildConfigs/web.ts +4 -2
- package/src/lib/abstractBase.ts +260 -65
- package/src/lib/basebuilder.ts +121 -100
- package/src/lib/classBuilder.ts +5 -4
- package/src/lib/core.ts +58 -59
- package/src/lib/index.ts +10 -9
- package/src/lib/types.ts +18 -27
- package/src/preload.ts +14 -14
- package/dist/common/NodeWriter.js +0 -54
- package/dist/common/electron.js +0 -266
- package/dist/module/NodeWriter.js +0 -48
- package/dist/module/electron.js +0 -261
- package/dist/types/NodeWriter.d.ts +0 -2
- package/src/NodeWriter.ts +0 -72
- package/src/electron.ts +0 -317
- package/yarn-error.log +0 -3144
- /package/dist/types/{electron.d.ts → Puppeteer.d.ts} +0 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PM_Web = void 0;
|
|
7
|
+
const puppeteer_core_browser_js_1 = __importDefault(require("puppeteer-core/lib/esm/puppeteer/puppeteer-core-browser.js"));
|
|
8
|
+
const index_js_1 = require("./index.js");
|
|
9
|
+
class PM_Web extends index_js_1.PM {
|
|
10
|
+
constructor(t) {
|
|
11
|
+
super();
|
|
12
|
+
this.server = {};
|
|
13
|
+
this.testResourceConfiguration = t;
|
|
14
|
+
}
|
|
15
|
+
existsSync(destFolder) {
|
|
16
|
+
return window["existsSync"](destFolder);
|
|
17
|
+
}
|
|
18
|
+
mkdirSync() {
|
|
19
|
+
return window["mkdirSync"](this.testResourceConfiguration.fs + "/");
|
|
20
|
+
}
|
|
21
|
+
write(writeObject, contents) {
|
|
22
|
+
return window["write"](writeObject.uid, contents);
|
|
23
|
+
}
|
|
24
|
+
writeFileSync(filepath, contents) {
|
|
25
|
+
return window["writeFileSync"](this.testResourceConfiguration.fs + "/" + filepath, contents, this.testResourceConfiguration.name);
|
|
26
|
+
}
|
|
27
|
+
createWriteStream(filepath) {
|
|
28
|
+
return window["createWriteStream"](this.testResourceConfiguration.fs + "/" + filepath, this.testResourceConfiguration.name);
|
|
29
|
+
}
|
|
30
|
+
end(writeObject) {
|
|
31
|
+
return window["end"](writeObject.uid);
|
|
32
|
+
}
|
|
33
|
+
customclose() {
|
|
34
|
+
window["customclose"](this.testResourceConfiguration.fs, this.testResourceConfiguration.name);
|
|
35
|
+
}
|
|
36
|
+
testArtiFactoryfileWriter(tLog, callback) {
|
|
37
|
+
return (fPath, value) => {
|
|
38
|
+
callback(new Promise((res, rej) => {
|
|
39
|
+
tLog("testArtiFactory =>", fPath);
|
|
40
|
+
// const cleanPath = path.resolve(fPath);
|
|
41
|
+
// fPaths.push(cleanPath.replace(process.cwd(), ``));
|
|
42
|
+
// const targetDir = cleanPath.split("/").slice(0, -1).join("/");
|
|
43
|
+
// fs.mkdir(targetDir, { recursive: true }, async (error) => {
|
|
44
|
+
// if (error) {
|
|
45
|
+
// console.error(`❗️testArtiFactory failed`, targetDir, error);
|
|
46
|
+
// }
|
|
47
|
+
// fs.writeFileSync(
|
|
48
|
+
// path.resolve(
|
|
49
|
+
// targetDir.split("/").slice(0, -1).join("/"),
|
|
50
|
+
// "manifest"
|
|
51
|
+
// ),
|
|
52
|
+
// fPaths.join(`\n`),
|
|
53
|
+
// {
|
|
54
|
+
// encoding: "utf-8",
|
|
55
|
+
// }
|
|
56
|
+
// );
|
|
57
|
+
// if (Buffer.isBuffer(value)) {
|
|
58
|
+
// fs.writeFileSync(fPath, value, "binary");
|
|
59
|
+
// res();
|
|
60
|
+
// } else if (`string` === typeof value) {
|
|
61
|
+
// fs.writeFileSync(fPath, value.toString(), {
|
|
62
|
+
// encoding: "utf-8",
|
|
63
|
+
// });
|
|
64
|
+
// res();
|
|
65
|
+
// } else {
|
|
66
|
+
// /* @ts-ignore:next-line */
|
|
67
|
+
// const pipeStream: PassThrough = value;
|
|
68
|
+
// const myFile = fs.createWriteStream(fPath);
|
|
69
|
+
// pipeStream.pipe(myFile);
|
|
70
|
+
// pipeStream.on("close", () => {
|
|
71
|
+
// myFile.close();
|
|
72
|
+
// res();
|
|
73
|
+
// });
|
|
74
|
+
// }
|
|
75
|
+
// });
|
|
76
|
+
}));
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
startPuppeteer(options, destFolder) {
|
|
80
|
+
const name = this.testResourceConfiguration.name;
|
|
81
|
+
return fetch(`http://localhost:3234/json/version`)
|
|
82
|
+
.then((v) => {
|
|
83
|
+
return v.json();
|
|
84
|
+
})
|
|
85
|
+
.then((json) => {
|
|
86
|
+
return puppeteer_core_browser_js_1.default
|
|
87
|
+
.connect({
|
|
88
|
+
browserWSEndpoint: json.webSocketDebuggerUrl,
|
|
89
|
+
})
|
|
90
|
+
.then((b) => {
|
|
91
|
+
this.browser = b;
|
|
92
|
+
const handler2 = {
|
|
93
|
+
get(target, prop, receiver) {
|
|
94
|
+
if (prop === "screenshot") {
|
|
95
|
+
return async (x) => {
|
|
96
|
+
return await window["custom-screenshot"](Object.assign(Object.assign({}, x), {
|
|
97
|
+
// path: destFolder + "/" + x.path,
|
|
98
|
+
path: x.path }), name);
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
else if (prop === "mainFrame") {
|
|
102
|
+
return () => target[prop](...arguments);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
return Reflect.get(...arguments);
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
const handler1 = {
|
|
110
|
+
get(target, prop, receiver) {
|
|
111
|
+
if (prop === "pages") {
|
|
112
|
+
return async () => {
|
|
113
|
+
return target.pages().then((pages) => {
|
|
114
|
+
return pages.map((p) => {
|
|
115
|
+
return new Proxy(p, handler2);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
return Reflect.get(...arguments);
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
const proxy3 = new Proxy(this.browser, handler1);
|
|
124
|
+
this.browser = proxy3;
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.PM_Web = PM_Web;
|
package/dist/common/Project.js
CHANGED
|
@@ -76,6 +76,24 @@ class ITProject {
|
|
|
76
76
|
.then((x) => fs_1.default.writeFileSync(htmlFilePath, (0, web_html_js_1.default)(jsfilePath, htmlFilePath)));
|
|
77
77
|
})));
|
|
78
78
|
const [nodeEntryPoints, webEntryPoints] = getRunnables(this.config.tests);
|
|
79
|
+
// nodeEntryPoints.forEach((nep) => {
|
|
80
|
+
// const f = `${process.cwd()}/${nep}`;
|
|
81
|
+
// console.log("nep", f);
|
|
82
|
+
// import(f).then((module) => {
|
|
83
|
+
// return module.default.then((defaultModule) => {
|
|
84
|
+
// console.log("defaultModule", defaultModule);
|
|
85
|
+
// // defaultModule
|
|
86
|
+
// // .receiveTestResourceConfig(argz)
|
|
87
|
+
// // .then((x) => {
|
|
88
|
+
// // console.log("then", x);
|
|
89
|
+
// // return x;
|
|
90
|
+
// // })
|
|
91
|
+
// // .catch((e) => {
|
|
92
|
+
// // console.log("catch", e);
|
|
93
|
+
// // });
|
|
94
|
+
// });
|
|
95
|
+
// });
|
|
96
|
+
// });
|
|
79
97
|
(0, glob_1.glob)(`./${config.outdir}/chunk-*.mjs`, { ignore: "node_modules/**" }).then((chunks) => {
|
|
80
98
|
chunks.forEach((chunk) => {
|
|
81
99
|
fs_1.default.unlinkSync(chunk);
|
|
@@ -156,8 +174,8 @@ const getRunnables = (tests, payload = [new Set(), new Set()]) => {
|
|
|
156
174
|
else if (cv[1] === "web") {
|
|
157
175
|
pt[1].add(cv[0]);
|
|
158
176
|
}
|
|
159
|
-
if (cv[
|
|
160
|
-
getRunnables(cv[
|
|
177
|
+
if (cv[3].length) {
|
|
178
|
+
getRunnables(cv[3], payload);
|
|
161
179
|
}
|
|
162
180
|
return pt;
|
|
163
181
|
}, payload);
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const readline_1 = __importDefault(require("readline"));
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const jsonc_1 = require("jsonc");
|
|
10
|
+
const main_js_1 = require("./PM/main.js");
|
|
11
|
+
var mode = process.argv[2] === "-dev" ? "DEV" : "PROD";
|
|
12
|
+
const node2web = {};
|
|
13
|
+
const web2node = {};
|
|
14
|
+
const childProcesses = {};
|
|
15
|
+
readline_1.default.emitKeypressEvents(process.stdin);
|
|
16
|
+
if (process.stdin.isTTY)
|
|
17
|
+
process.stdin.setRawMode(true);
|
|
18
|
+
console.log("\n Puppeteer is running. Press 'q' to quit\n");
|
|
19
|
+
process.stdin.on("keypress", (str, key) => {
|
|
20
|
+
if (key.name === "q") {
|
|
21
|
+
process.exit();
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const main = async () => {
|
|
25
|
+
const configs = jsonc_1.jsonc.parse((await fs_1.default.readFileSync("./docs/testeranto.json")).toString());
|
|
26
|
+
const pm = new main_js_1.PM_Main(configs);
|
|
27
|
+
await pm.startPuppeteer({
|
|
28
|
+
waitForInitialPage: false,
|
|
29
|
+
executablePath: "/opt/homebrew/bin/chromium",
|
|
30
|
+
headless: true,
|
|
31
|
+
dumpio: true,
|
|
32
|
+
args: [
|
|
33
|
+
"--allow-file-access-from-files",
|
|
34
|
+
"--allow-running-insecure-content",
|
|
35
|
+
"--auto-open-devtools-for-tabs",
|
|
36
|
+
"--disable-dev-shm-usage",
|
|
37
|
+
"--disable-extensions",
|
|
38
|
+
"--disable-gpu",
|
|
39
|
+
"--disable-setuid-sandbox",
|
|
40
|
+
"--disable-site-isolation-trials",
|
|
41
|
+
"--disable-web-security",
|
|
42
|
+
"--disable-web-security",
|
|
43
|
+
"--no-first-run",
|
|
44
|
+
"--no-sandbox",
|
|
45
|
+
"--no-startup-window",
|
|
46
|
+
// "--no-zygote",
|
|
47
|
+
"--reduce-security-for-testing",
|
|
48
|
+
"--remote-allow-origins=*",
|
|
49
|
+
"--unsafely-treat-insecure-origin-as-secure=*",
|
|
50
|
+
// "--disable-features=IsolateOrigins",
|
|
51
|
+
// "--remote-allow-origins=ws://localhost:3234",
|
|
52
|
+
// "--single-process",
|
|
53
|
+
// "--unsafely-treat-insecure-origin-as-secure",
|
|
54
|
+
// "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
|
|
55
|
+
`--remote-debugging-port=3234`,
|
|
56
|
+
// "--disk-cache-dir=/dev/null",
|
|
57
|
+
// "--disk-cache-size=1",
|
|
58
|
+
// "--start-maximized",
|
|
59
|
+
],
|
|
60
|
+
}, ".");
|
|
61
|
+
const destinationOfRuntime = (f, r) => {
|
|
62
|
+
return path_1.default
|
|
63
|
+
.normalize(`${configs.buildDir}/${r}/${f}`)
|
|
64
|
+
.split(".")
|
|
65
|
+
.slice(0, -1)
|
|
66
|
+
.join(".");
|
|
67
|
+
};
|
|
68
|
+
configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
|
|
69
|
+
if (runtime === "node") {
|
|
70
|
+
pm.launchNode(test, destinationOfRuntime(test, "node"));
|
|
71
|
+
}
|
|
72
|
+
else if (runtime === "web") {
|
|
73
|
+
pm.launchWeb(test, destinationOfRuntime(test, "web"));
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
console.error("runtime makes no sense", runtime);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
console.log("ready and watching for changes...", configs.buildDir);
|
|
80
|
+
fs_1.default.watch(configs.buildDir, {
|
|
81
|
+
recursive: true,
|
|
82
|
+
}, (eventType, changedFile) => {
|
|
83
|
+
if (changedFile) {
|
|
84
|
+
configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
|
|
85
|
+
if (eventType === "change" || eventType === "rename") {
|
|
86
|
+
if (changedFile ===
|
|
87
|
+
test
|
|
88
|
+
.replace("./", "node/")
|
|
89
|
+
.split(".")
|
|
90
|
+
.slice(0, -1)
|
|
91
|
+
.concat("mjs")
|
|
92
|
+
.join(".")) {
|
|
93
|
+
pm.launchNode(test, destinationOfRuntime(test, "node"));
|
|
94
|
+
}
|
|
95
|
+
if (changedFile ===
|
|
96
|
+
test
|
|
97
|
+
.replace("./", "web/")
|
|
98
|
+
.split(".")
|
|
99
|
+
.slice(0, -1)
|
|
100
|
+
.concat("mjs")
|
|
101
|
+
.join(".")) {
|
|
102
|
+
pm.launchWeb(test, destinationOfRuntime(test, "web"));
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
main();
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const readline_1 = __importDefault(require("readline"));
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const jsonc_1 = require("jsonc");
|
|
9
|
+
const puppeteer_core_1 = __importDefault(require("puppeteer-core"));
|
|
10
|
+
// import { PM_Main } from "./PM/main.js";
|
|
11
|
+
// var mode: "DEV" | "PROD" = process.argv[2] === "-dev" ? "DEV" : "PROD";
|
|
12
|
+
// const node2web: Record<string, string[]> = {};
|
|
13
|
+
// const web2node: Record<string, string[]> = {};
|
|
14
|
+
// const childProcesses: Record<string, "loaded" | "running" | "done"> = {};
|
|
15
|
+
readline_1.default.emitKeypressEvents(process.stdin);
|
|
16
|
+
if (process.stdin.isTTY)
|
|
17
|
+
process.stdin.setRawMode(true);
|
|
18
|
+
console.log("\n Puppeteer is running. Press 'q' to quit\n");
|
|
19
|
+
process.stdin.on("keypress", (str, key) => {
|
|
20
|
+
if (key.name === "q") {
|
|
21
|
+
process.exit();
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
const main = async () => {
|
|
25
|
+
const configs = jsonc_1.jsonc.parse((await fs_1.default.readFileSync("./docs/testeranto.json")).toString());
|
|
26
|
+
// const pm = new PM_Main(configs);
|
|
27
|
+
// await puppeteer.launch(options);
|
|
28
|
+
const browser = await puppeteer_core_1.default.launch({
|
|
29
|
+
waitForInitialPage: false,
|
|
30
|
+
executablePath: "/opt/homebrew/bin/chromium",
|
|
31
|
+
headless: false,
|
|
32
|
+
args: [
|
|
33
|
+
"--allow-file-access-from-files",
|
|
34
|
+
"--allow-running-insecure-content",
|
|
35
|
+
// "--auto-open-devtools-for-tabs",
|
|
36
|
+
"--disable-dev-shm-usage",
|
|
37
|
+
"--disable-extensions",
|
|
38
|
+
"--disable-gpu",
|
|
39
|
+
"--disable-setuid-sandbox",
|
|
40
|
+
"--disable-site-isolation-trials",
|
|
41
|
+
"--disable-web-security",
|
|
42
|
+
"--disable-web-security",
|
|
43
|
+
"--no-first-run",
|
|
44
|
+
"--no-sandbox",
|
|
45
|
+
"--no-startup-window",
|
|
46
|
+
"--no-zygote",
|
|
47
|
+
"--reduce-security-for-testing",
|
|
48
|
+
"--remote-allow-origins=*",
|
|
49
|
+
// "--remote-allow-origins=ws://localhost:3234",
|
|
50
|
+
"--unsafely-treat-insecure-origin-as-secure=*",
|
|
51
|
+
// "--disable-features=IsolateOrigins",
|
|
52
|
+
// "--single-process",
|
|
53
|
+
// "--unsafely-treat-insecure-origin-as-secure",
|
|
54
|
+
// "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
|
|
55
|
+
// `--remote-debugging-port=3234`,
|
|
56
|
+
],
|
|
57
|
+
}
|
|
58
|
+
// "."
|
|
59
|
+
);
|
|
60
|
+
console.log("Creating new page...");
|
|
61
|
+
const page = await browser.newPage();
|
|
62
|
+
await page.setViewport({ width: 0, height: 0 });
|
|
63
|
+
console.log("Requesting url...");
|
|
64
|
+
await page.goto(`file://${process.cwd()}/docs/report.html`);
|
|
65
|
+
// const destinationOfRuntime = (f: string, r: IRunTime) => {
|
|
66
|
+
// return path
|
|
67
|
+
// .normalize(`${configs.buildDir}/${r}/${f}`)
|
|
68
|
+
// .split(".")
|
|
69
|
+
// .slice(0, -1)
|
|
70
|
+
// .join(".");
|
|
71
|
+
// };
|
|
72
|
+
// configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
|
|
73
|
+
// if (runtime === "node") {
|
|
74
|
+
// pm.launchNode(test, destinationOfRuntime(test, "node"));
|
|
75
|
+
// } else if (runtime === "web") {
|
|
76
|
+
// pm.launchWeb(test, destinationOfRuntime(test, "web"));
|
|
77
|
+
// } else {
|
|
78
|
+
// console.error("runtime makes no sense", runtime);
|
|
79
|
+
// }
|
|
80
|
+
// });
|
|
81
|
+
// console.log("ready and watching for changes...", configs.buildDir);
|
|
82
|
+
// fs.watch(
|
|
83
|
+
// configs.buildDir,
|
|
84
|
+
// {
|
|
85
|
+
// recursive: true,
|
|
86
|
+
// },
|
|
87
|
+
// (eventType, changedFile) => {
|
|
88
|
+
// if (changedFile) {
|
|
89
|
+
// configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
|
|
90
|
+
// if (eventType === "change" || eventType === "rename") {
|
|
91
|
+
// if (
|
|
92
|
+
// changedFile ===
|
|
93
|
+
// test
|
|
94
|
+
// .replace("./", "node/")
|
|
95
|
+
// .split(".")
|
|
96
|
+
// .slice(0, -1)
|
|
97
|
+
// .concat("mjs")
|
|
98
|
+
// .join(".")
|
|
99
|
+
// ) {
|
|
100
|
+
// pm.launchNode(test, destinationOfRuntime(test, "node"));
|
|
101
|
+
// }
|
|
102
|
+
// if (
|
|
103
|
+
// changedFile ===
|
|
104
|
+
// test
|
|
105
|
+
// .replace("./", "web/")
|
|
106
|
+
// .split(".")
|
|
107
|
+
// .slice(0, -1)
|
|
108
|
+
// .concat("mjs")
|
|
109
|
+
// .join(".")
|
|
110
|
+
// ) {
|
|
111
|
+
// pm.launchWeb(test, destinationOfRuntime(test, "web"));
|
|
112
|
+
// }
|
|
113
|
+
// }
|
|
114
|
+
// });
|
|
115
|
+
// }
|
|
116
|
+
// }
|
|
117
|
+
// );
|
|
118
|
+
};
|
|
119
|
+
main();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -7,7 +7,9 @@ const react_1 = __importDefault(require("react"));
|
|
|
7
7
|
const Node_js_1 = __importDefault(require("../Node.js"));
|
|
8
8
|
exports.default = (testInput, testSpecifications, testImplementations, testInterface) => {
|
|
9
9
|
return (0, Node_js_1.default)(testInput, testSpecifications, testImplementations, Object.assign({ beforeAll(x) {
|
|
10
|
-
process.parentPort.postMessage(
|
|
10
|
+
// process.parentPort.postMessage(
|
|
11
|
+
// `/docs/web/src/ClassicalComponent/test.html`
|
|
12
|
+
// );
|
|
11
13
|
return x;
|
|
12
14
|
}, beforeEach: async () => {
|
|
13
15
|
return new Promise((resolve, rej) => {
|
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.testInterface = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
4
8
|
exports.testInterface = {
|
|
5
|
-
|
|
9
|
+
// beforeAll: async (proto, testResource, artificer, pm): Promise<IStore> => {
|
|
10
|
+
// return React.createElement(proto);
|
|
11
|
+
// // return new Promise((resolve, rej) => {
|
|
12
|
+
// // resolve(x());
|
|
13
|
+
// // });
|
|
14
|
+
// },
|
|
15
|
+
beforeEach: async (subject, initializer, artificer) => {
|
|
6
16
|
return new Promise((resolve, rej) => {
|
|
7
|
-
|
|
17
|
+
const x = react_1.default.createElement(subject);
|
|
18
|
+
console.log("react-element", x);
|
|
19
|
+
resolve(x);
|
|
8
20
|
});
|
|
9
21
|
},
|
|
10
22
|
andWhen: function (s, whenCB) {
|
|
@@ -7,54 +7,107 @@ const react_1 = require("react");
|
|
|
7
7
|
const client_1 = __importDefault(require("react-dom/client"));
|
|
8
8
|
const Web_js_1 = __importDefault(require("../../../Web.js"));
|
|
9
9
|
exports.default = (testInput, testSpecifications, testImplementations) => {
|
|
10
|
+
class TesterantoComponent extends testInput {
|
|
11
|
+
constructor(props) {
|
|
12
|
+
super(props);
|
|
13
|
+
this.done = props.done;
|
|
14
|
+
}
|
|
15
|
+
componentDidMount() {
|
|
16
|
+
super.componentDidMount && super.componentDidMount();
|
|
17
|
+
return this.done(this);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const t = (0, Web_js_1.default)(testInput, testSpecifications, testImplementations, {
|
|
21
|
+
beforeAll: async (initialProps, artificer) => {
|
|
22
|
+
console.log("mark5", initialProps);
|
|
23
|
+
return await new Promise((resolve, rej) => {
|
|
24
|
+
const htmlElement = document.getElementById("root");
|
|
25
|
+
if (htmlElement) {
|
|
26
|
+
const domRoot = client_1.default.createRoot(htmlElement);
|
|
27
|
+
// Ignore these type errors
|
|
28
|
+
domRoot.render((0, react_1.createElement)(TesterantoComponent, Object.assign(Object.assign({}, initialProps), { done: (reactElement) => {
|
|
29
|
+
resolve({
|
|
30
|
+
htmlElement,
|
|
31
|
+
reactElement,
|
|
32
|
+
domRoot,
|
|
33
|
+
});
|
|
34
|
+
} }), []));
|
|
35
|
+
// resolve({ htmlElement });
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
// beforeEach: async (
|
|
40
|
+
// s,
|
|
41
|
+
// initializer,
|
|
42
|
+
// testResource,
|
|
43
|
+
// artificer,
|
|
44
|
+
// initialValues
|
|
45
|
+
// ): Promise<IStore> => {
|
|
46
|
+
// return new Promise((resolve, rej) => {
|
|
47
|
+
// console.log("beforeEach" + TesterantoComponent);
|
|
48
|
+
// // const domRoot = ReactDom.createRoot(htmlElement);
|
|
49
|
+
// // // Ignore these type errors
|
|
50
|
+
// // domRoot.render(
|
|
51
|
+
// // createElement(
|
|
52
|
+
// // TesterantoComponent,
|
|
53
|
+
// // {
|
|
54
|
+
// // ...initializer,
|
|
55
|
+
// // done: (reactElement) => {
|
|
56
|
+
// // resolve({
|
|
57
|
+
// // htmlElement,
|
|
58
|
+
// // reactElement,
|
|
59
|
+
// // domRoot,
|
|
60
|
+
// // });
|
|
61
|
+
// // },
|
|
62
|
+
// // },
|
|
63
|
+
// // []
|
|
64
|
+
// // )
|
|
65
|
+
// // );
|
|
66
|
+
// });
|
|
67
|
+
// },
|
|
68
|
+
andWhen: function (s, whenCB) {
|
|
69
|
+
return whenCB(s);
|
|
70
|
+
},
|
|
71
|
+
butThen: async function (s, thenCB) {
|
|
72
|
+
return thenCB(s);
|
|
73
|
+
},
|
|
74
|
+
afterEach: async function (store, ndx, artificer, utils) {
|
|
75
|
+
console.log("afterEach", store);
|
|
76
|
+
utils.writeFileSync("aftereachlog", store.toString());
|
|
77
|
+
const page = (await utils.browser.pages()).filter((x) => {
|
|
78
|
+
const parsedUrl = new URL(x.url());
|
|
79
|
+
parsedUrl.search = "";
|
|
80
|
+
const strippedUrl = parsedUrl.toString();
|
|
81
|
+
return (strippedUrl ===
|
|
82
|
+
"file:///Users/adam/Code/kokomoBay/docs/web/src/ClassicalComponent/react-dom/client.web.test.html");
|
|
83
|
+
// return true;
|
|
84
|
+
})[0];
|
|
85
|
+
const x = await page.screenshot({
|
|
86
|
+
path: "afterEachLog.jpg",
|
|
87
|
+
});
|
|
88
|
+
console.log("x", x);
|
|
89
|
+
// debugger;
|
|
90
|
+
// const div_root = document.getElementById("root");
|
|
91
|
+
// store.domRoot && store.domRoot.unmount(); //React 18
|
|
92
|
+
// store.remove();
|
|
93
|
+
// store.htmlElement.remove();
|
|
94
|
+
// store.htmlElement = document.createElement("root");
|
|
95
|
+
return store;
|
|
96
|
+
},
|
|
97
|
+
afterAll: async (store, artificer, utils) => {
|
|
98
|
+
// setTimeout(() => {
|
|
99
|
+
// console.log("This will run after 1 second");
|
|
100
|
+
// }, 1000); // 1000 milliseconds = 1 second
|
|
101
|
+
// store.htmlElement.remove();
|
|
102
|
+
// store.htmlElement = document.createElement("root");
|
|
103
|
+
return store;
|
|
104
|
+
},
|
|
105
|
+
});
|
|
10
106
|
document.addEventListener("DOMContentLoaded", function () {
|
|
11
107
|
const elem = document.getElementById("root");
|
|
12
108
|
if (elem) {
|
|
13
|
-
|
|
14
|
-
constructor(props) {
|
|
15
|
-
super(props);
|
|
16
|
-
this.done = props.done;
|
|
17
|
-
}
|
|
18
|
-
componentDidMount() {
|
|
19
|
-
super.componentDidMount && super.componentDidMount();
|
|
20
|
-
return this.done(this);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return (0, Web_js_1.default)(testInput, testSpecifications, testImplementations, {
|
|
24
|
-
beforeAll: async (initialProps, artificer) => {
|
|
25
|
-
console.log("mark5", initialProps);
|
|
26
|
-
return await new Promise((resolve, rej) => {
|
|
27
|
-
const elem = document.getElementById("root");
|
|
28
|
-
if (elem) {
|
|
29
|
-
resolve({ htmlElement: elem });
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
},
|
|
33
|
-
beforeEach: async ({ htmlElement }, initializer, testResource, artificer, initialValues) => {
|
|
34
|
-
return new Promise((resolve, rej) => {
|
|
35
|
-
// console.log("beforeEach" + JSON.stringify(initializer) + JSON.stringify(initialValues));
|
|
36
|
-
// Ignore these type errors
|
|
37
|
-
client_1.default.createRoot(htmlElement).render((0, react_1.createElement)(TesterantoComponent, Object.assign(Object.assign({}, initializer), { done: (reactElement) => {
|
|
38
|
-
resolve({
|
|
39
|
-
htmlElement,
|
|
40
|
-
reactElement,
|
|
41
|
-
});
|
|
42
|
-
} }), []));
|
|
43
|
-
});
|
|
44
|
-
},
|
|
45
|
-
andWhen: function (s, whenCB) {
|
|
46
|
-
return whenCB(s);
|
|
47
|
-
},
|
|
48
|
-
butThen: async function (s) {
|
|
49
|
-
return s;
|
|
50
|
-
},
|
|
51
|
-
afterEach: async function (store, ndx, artificer) {
|
|
52
|
-
return {};
|
|
53
|
-
},
|
|
54
|
-
afterAll: (store, artificer) => {
|
|
55
|
-
return;
|
|
56
|
-
},
|
|
57
|
-
});
|
|
109
|
+
return t;
|
|
58
110
|
}
|
|
59
111
|
});
|
|
112
|
+
return t;
|
|
60
113
|
};
|
|
@@ -35,7 +35,6 @@ exports.testInterface = {
|
|
|
35
35
|
return thenCB(s);
|
|
36
36
|
},
|
|
37
37
|
beforeEach: function (CComponent, props) {
|
|
38
|
-
console.log("ASDASDx");
|
|
39
38
|
let component;
|
|
40
39
|
(0, react_test_renderer_1.act)(() => {
|
|
41
40
|
component = react_test_renderer_1.default.create(react_1.default.createElement(CComponent, props, []));
|