testeranto 0.70.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.
Files changed (94) hide show
  1. package/README.md +9 -18
  2. package/dist/common/Node.js +14 -34
  3. package/dist/common/PM/index.js +71 -0
  4. package/dist/common/PM/main.js +361 -0
  5. package/dist/common/PM/node.js +176 -0
  6. package/dist/common/PM/web.js +174 -0
  7. package/dist/common/Project.js +20 -2
  8. package/dist/common/Puppeteer.js +109 -0
  9. package/dist/common/Reporter.js +119 -0
  10. package/dist/common/Scheduler.js +1 -0
  11. package/dist/common/SubPackages/puppeteer.js +3 -1
  12. package/dist/common/SubPackages/react-dom/component/web.js +98 -45
  13. package/dist/common/SubPackages/react-test-renderer/jsx/index.js +0 -1
  14. package/dist/common/Web.js +24 -43
  15. package/dist/common/esbuildConfigs/web.js +3 -1
  16. package/dist/common/lib/abstractBase.js +189 -41
  17. package/dist/common/lib/basebuilder.js +56 -29
  18. package/dist/common/lib/classBuilder.js +6 -2
  19. package/dist/common/lib/core.js +41 -45
  20. package/dist/common/lib/index.js +2 -1
  21. package/dist/common/preload.js +14 -18
  22. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  23. package/dist/module/Node.js +14 -34
  24. package/dist/module/PM/index.js +67 -0
  25. package/dist/module/PM/main.js +331 -0
  26. package/dist/module/PM/node.js +168 -0
  27. package/dist/module/PM/web.js +167 -0
  28. package/dist/module/Project.js +20 -2
  29. package/dist/module/Puppeteer.js +104 -0
  30. package/dist/module/Reporter.js +114 -0
  31. package/dist/module/Scheduler.js +1 -0
  32. package/dist/module/SubPackages/puppeteer.js +3 -1
  33. package/dist/module/SubPackages/react/jsx/node.js +1 -1
  34. package/dist/module/SubPackages/react-dom/component/web.js +98 -45
  35. package/dist/module/SubPackages/react-test-renderer/jsx/index.js +0 -1
  36. package/dist/module/Web.js +24 -43
  37. package/dist/module/esbuildConfigs/web.js +3 -1
  38. package/dist/module/lib/abstractBase.js +189 -41
  39. package/dist/module/lib/basebuilder.js +56 -29
  40. package/dist/module/lib/classBuilder.js +6 -2
  41. package/dist/module/lib/core.js +41 -45
  42. package/dist/module/lib/index.js +2 -1
  43. package/dist/module/preload.js +15 -14
  44. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  45. package/dist/prebuild/Report.css +1616 -584
  46. package/dist/prebuild/Report.js +2635 -2506
  47. package/dist/types/PM/index.d.ts +19 -0
  48. package/dist/types/PM/main.d.ts +28 -0
  49. package/dist/types/PM/node.d.ts +26 -0
  50. package/dist/types/PM/web.d.ts +24 -0
  51. package/dist/types/Reporter.d.ts +1 -0
  52. package/dist/types/Scheduler.d.ts +0 -0
  53. package/dist/types/SubPackages/react-dom/component/web.d.ts +1 -1
  54. package/dist/types/lib/abstractBase.d.ts +13 -12
  55. package/dist/types/lib/basebuilder.d.ts +4 -2
  56. package/dist/types/lib/classBuilder.d.ts +2 -2
  57. package/dist/types/lib/core.d.ts +4 -4
  58. package/dist/types/lib/index.d.ts +6 -5
  59. package/dist/types/lib/types.d.ts +16 -24
  60. package/dist/types/preload.d.ts +0 -1
  61. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  62. package/package.json +3 -5
  63. package/src/Node.ts +18 -43
  64. package/src/PM/index.ts +102 -0
  65. package/src/PM/main.ts +420 -0
  66. package/src/PM/node.ts +515 -0
  67. package/src/PM/web.ts +497 -0
  68. package/src/Project.ts +21 -2
  69. package/src/Puppeteer.ts +131 -0
  70. package/src/Report.tsx +158 -44
  71. package/src/Reporter.ts +134 -0
  72. package/src/Scheduler.ts +0 -0
  73. package/src/SubPackages/puppeteer.ts +3 -3
  74. package/src/SubPackages/react/jsx/node.ts +5 -8
  75. package/src/SubPackages/react-dom/component/web.ts +126 -67
  76. package/src/SubPackages/react-test-renderer/jsx/index.ts +0 -1
  77. package/src/Web.ts +25 -67
  78. package/src/esbuildConfigs/web.ts +4 -2
  79. package/src/lib/abstractBase.ts +260 -65
  80. package/src/lib/basebuilder.ts +121 -100
  81. package/src/lib/classBuilder.ts +5 -4
  82. package/src/lib/core.ts +58 -59
  83. package/src/lib/index.ts +10 -9
  84. package/src/lib/types.ts +18 -27
  85. package/src/preload.ts +14 -14
  86. package/dist/common/NodeWriter.js +0 -54
  87. package/dist/common/electron.js +0 -266
  88. package/dist/module/NodeWriter.js +0 -48
  89. package/dist/module/electron.js +0 -261
  90. package/dist/types/NodeWriter.d.ts +0 -2
  91. package/src/NodeWriter.ts +0 -72
  92. package/src/electron.ts +0 -317
  93. package/yarn-error.log +0 -3144
  94. /package/dist/types/{electron.d.ts → Puppeteer.d.ts} +0 -0
@@ -0,0 +1,176 @@
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_Node = exports.addPageBinding = void 0;
7
+ // import puppeteer from "puppeteer";
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const path_1 = __importDefault(require("path"));
10
+ // import puppeteer from "puppeteer-core/lib/esm/puppeteer/puppeteer-core";
11
+ const puppeteer_core_1 = __importDefault(require("puppeteer-core"));
12
+ const index_js_1 = require("./index.js");
13
+ const fPaths = [];
14
+ function addPageBinding(type, name, prefix) {
15
+ // Depending on the frame loading state either Runtime.evaluate or
16
+ // Page.addScriptToEvaluateOnNewDocument might succeed. Let's check that we
17
+ // don't re-wrap Puppeteer's binding.
18
+ if (globalThis[name]) {
19
+ return;
20
+ }
21
+ // We replace the CDP binding with a Puppeteer binding.
22
+ Object.assign(globalThis, {
23
+ [name](...args) {
24
+ var _a, _b, _c;
25
+ // This is the Puppeteer binding.
26
+ const callPuppeteer = globalThis[name];
27
+ (_a = callPuppeteer.args) !== null && _a !== void 0 ? _a : (callPuppeteer.args = new Map());
28
+ (_b = callPuppeteer.callbacks) !== null && _b !== void 0 ? _b : (callPuppeteer.callbacks = new Map());
29
+ const seq = ((_c = callPuppeteer.lastSeq) !== null && _c !== void 0 ? _c : 0) + 1;
30
+ callPuppeteer.lastSeq = seq;
31
+ callPuppeteer.args.set(seq, args);
32
+ // Needs to be the same as CDP_BINDING_PREFIX.
33
+ globalThis[prefix + name](JSON.stringify({
34
+ type,
35
+ name,
36
+ seq,
37
+ args,
38
+ isTrivial: !args.some((value) => {
39
+ return value instanceof Node;
40
+ }),
41
+ }));
42
+ return new Promise((resolve, reject) => {
43
+ callPuppeteer.callbacks.set(seq, {
44
+ resolve(value) {
45
+ callPuppeteer.args.delete(seq);
46
+ resolve(value);
47
+ },
48
+ reject(value) {
49
+ callPuppeteer.args.delete(seq);
50
+ reject(value);
51
+ },
52
+ });
53
+ });
54
+ },
55
+ });
56
+ }
57
+ exports.addPageBinding = addPageBinding;
58
+ const files = new Set();
59
+ class PM_Node extends index_js_1.PM {
60
+ constructor(t) {
61
+ super();
62
+ this.server = {};
63
+ this.testResourceConfiguration = t;
64
+ }
65
+ existsSync(destFolder) {
66
+ return globalThis["existsSync"](this.testResourceConfiguration.fs + "/" + destFolder);
67
+ }
68
+ mkdirSync() {
69
+ return globalThis["mkdirSync"](this.testResourceConfiguration.fs + "/");
70
+ }
71
+ write(writeObject, contents) {
72
+ return globalThis["write"](writeObject.uid, contents);
73
+ }
74
+ writeFileSync(filepath, contents) {
75
+ files.add(filepath);
76
+ return globalThis["writeFileSync"](this.testResourceConfiguration.fs + "/" + filepath, contents);
77
+ }
78
+ createWriteStream(filepath) {
79
+ files.add(filepath);
80
+ return globalThis["createWriteStream"](this.testResourceConfiguration.fs + "/" + filepath);
81
+ }
82
+ end(writeObject) {
83
+ return globalThis["end"](writeObject.uid);
84
+ }
85
+ customclose() {
86
+ console.log("node-customclose");
87
+ // globalThis["writeFileSync"](
88
+ // this.testResourceConfiguration.fs + "/manifest.json",
89
+ // // files.entries()
90
+ // JSON.stringify(Array.from(files))
91
+ // ).then(() => {
92
+ // globalThis["customclose"]();
93
+ // });
94
+ }
95
+ // write(accessObject: { uid: number; }, contents: string): boolean {
96
+ // throw new Error("Method not implemented.");
97
+ // }
98
+ // existsSync(destFolder: string): boolean {
99
+ // return fs.existsSync(destFolder);
100
+ // }
101
+ // async mkdirSync(destFolder: string) {
102
+ // if (!fs.existsSync(destFolder)) {
103
+ // return fs.mkdirSync(destFolder, { recursive: true });
104
+ // }
105
+ // return false;
106
+ // }
107
+ // writeFileSync(fp: string, contents: string) {
108
+ // fs.writeFileSync(fp, contents);
109
+ // }
110
+ // createWriteStream(filepath: string): fs.WriteStream {
111
+ // return fs.createWriteStream(filepath);
112
+ // }
113
+ testArtiFactoryfileWriter(tLog, callback) {
114
+ return (fPath, value) => {
115
+ callback(new Promise((res, rej) => {
116
+ tLog("testArtiFactory =>", fPath);
117
+ const cleanPath = path_1.default.resolve(fPath);
118
+ fPaths.push(cleanPath.replace(process.cwd(), ``));
119
+ const targetDir = cleanPath.split("/").slice(0, -1).join("/");
120
+ fs_1.default.mkdir(targetDir, { recursive: true }, async (error) => {
121
+ if (error) {
122
+ console.error(`❗️testArtiFactory failed`, targetDir, error);
123
+ }
124
+ fs_1.default.writeFileSync(path_1.default.resolve(targetDir.split("/").slice(0, -1).join("/"), "manifest"), fPaths.join(`\n`), {
125
+ encoding: "utf-8",
126
+ });
127
+ if (Buffer.isBuffer(value)) {
128
+ fs_1.default.writeFileSync(fPath, value, "binary");
129
+ res();
130
+ }
131
+ else if (`string` === typeof value) {
132
+ fs_1.default.writeFileSync(fPath, value.toString(), {
133
+ encoding: "utf-8",
134
+ });
135
+ res();
136
+ }
137
+ else {
138
+ /* @ts-ignore:next-line */
139
+ const pipeStream = value;
140
+ const myFile = fs_1.default.createWriteStream(fPath);
141
+ pipeStream.pipe(myFile);
142
+ pipeStream.on("close", () => {
143
+ myFile.close();
144
+ res();
145
+ });
146
+ }
147
+ });
148
+ }));
149
+ };
150
+ }
151
+ // launch(options?: PuppeteerLaunchOptions): Promise<Browser>;
152
+ startPuppeteer(options) {
153
+ console.log("start1");
154
+ return puppeteer_core_1.default.connect(options).then((b) => {
155
+ this.browser = b;
156
+ });
157
+ // return new Promise<Browser>((res, rej) => {
158
+ // // this.browser = await puppeteer.connect(options);
159
+ // // console.log("start2", this.browser);
160
+ // // console.log("mark5", this.browser);
161
+ // // res(this.browser);
162
+ // });
163
+ }
164
+ }
165
+ exports.PM_Node = PM_Node;
166
+ // class PuppetMasterServer extends AbstractPuppetMaster {
167
+ // // constructor(...z: []) {
168
+ // // super(...z);
169
+ // // }
170
+ // // // pages(): Promise<Page[]>;
171
+ // // pages(): Promise<Page[]> {
172
+ // // return new Promise<Page[]>((res, rej) => {
173
+ // // res(super.pages());
174
+ // // });
175
+ // // }
176
+ // }
@@ -0,0 +1,174 @@
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 index_js_1 = require("./index.js");
8
+ const puppeteer_core_browser_js_1 = __importDefault(require("puppeteer-core/lib/esm/puppeteer/puppeteer-core-browser.js"));
9
+ function waitForFunctionCall() {
10
+ return new Promise((resolve) => {
11
+ window["myFunction"] = () => {
12
+ // Do something when myFunction is called
13
+ console.log("myFunction was called!");
14
+ resolve(); // Resolve the promise
15
+ };
16
+ });
17
+ }
18
+ const files = new Set();
19
+ class PM_Web extends index_js_1.PM {
20
+ // testResourceConfiguration: ITTestResourceConfiguration;
21
+ constructor(t) {
22
+ super();
23
+ this.server = {};
24
+ this.testResourceConfiguration = t;
25
+ }
26
+ existsSync(destFolder) {
27
+ return window["existsSync"](destFolder);
28
+ }
29
+ mkdirSync() {
30
+ return window["mkdirSync"](this.testResourceConfiguration.fs + "/");
31
+ }
32
+ write(writeObject, contents) {
33
+ return window["write"](writeObject.uid, contents);
34
+ }
35
+ writeFileSync(filepath, contents) {
36
+ console.log("WEB writeFileSync", filepath);
37
+ files.add(filepath);
38
+ return window["writeFileSync"](this.testResourceConfiguration.fs + "/" + filepath, contents);
39
+ }
40
+ createWriteStream(filepath) {
41
+ files.add(filepath);
42
+ return window["createWriteStream"](this.testResourceConfiguration.fs + "/" + filepath);
43
+ }
44
+ end(writeObject) {
45
+ return window["end"](writeObject.uid);
46
+ }
47
+ customclose() {
48
+ window["writeFileSync"](this.testResourceConfiguration.fs + "/manifest.json",
49
+ // files.entries()
50
+ JSON.stringify(Array.from(files))).then(() => {
51
+ window["customclose"]();
52
+ });
53
+ }
54
+ testArtiFactoryfileWriter(tLog, callback) {
55
+ return (fPath, value) => {
56
+ callback(new Promise((res, rej) => {
57
+ tLog("testArtiFactory =>", fPath);
58
+ // const cleanPath = path.resolve(fPath);
59
+ // fPaths.push(cleanPath.replace(process.cwd(), ``));
60
+ // const targetDir = cleanPath.split("/").slice(0, -1).join("/");
61
+ // fs.mkdir(targetDir, { recursive: true }, async (error) => {
62
+ // if (error) {
63
+ // console.error(`❗️testArtiFactory failed`, targetDir, error);
64
+ // }
65
+ // fs.writeFileSync(
66
+ // path.resolve(
67
+ // targetDir.split("/").slice(0, -1).join("/"),
68
+ // "manifest"
69
+ // ),
70
+ // fPaths.join(`\n`),
71
+ // {
72
+ // encoding: "utf-8",
73
+ // }
74
+ // );
75
+ // if (Buffer.isBuffer(value)) {
76
+ // fs.writeFileSync(fPath, value, "binary");
77
+ // res();
78
+ // } else if (`string` === typeof value) {
79
+ // fs.writeFileSync(fPath, value.toString(), {
80
+ // encoding: "utf-8",
81
+ // });
82
+ // res();
83
+ // } else {
84
+ // /* @ts-ignore:next-line */
85
+ // const pipeStream: PassThrough = value;
86
+ // const myFile = fs.createWriteStream(fPath);
87
+ // pipeStream.pipe(myFile);
88
+ // pipeStream.on("close", () => {
89
+ // myFile.close();
90
+ // res();
91
+ // });
92
+ // }
93
+ // });
94
+ }));
95
+ };
96
+ }
97
+ startPuppeteer(options, destFolder) {
98
+ return fetch(`http://localhost:3234/json/version`)
99
+ .then((v) => {
100
+ return v.json();
101
+ })
102
+ .then((json) => {
103
+ console.log("found endpoint", json.webSocketDebuggerUrl);
104
+ return puppeteer_core_browser_js_1.default
105
+ .connect({
106
+ browserWSEndpoint: json.webSocketDebuggerUrl,
107
+ })
108
+ .then((b) => {
109
+ this.browser = b;
110
+ const handler2 = {
111
+ get(target, prop, receiver) {
112
+ if (prop === "screenshot") {
113
+ return async (x) => {
114
+ // debugger;
115
+ files.add(x.path);
116
+ console.log("aloha", files);
117
+ return await window["custom-screenshot"](Object.assign(Object.assign({}, x), { path: destFolder + "/" + x.path }));
118
+ };
119
+ }
120
+ else if (prop === "mainFrame") {
121
+ return () => target[prop](...arguments);
122
+ }
123
+ else {
124
+ return Reflect.get(...arguments);
125
+ }
126
+ },
127
+ };
128
+ const handler1 = {
129
+ get(target, prop, receiver) {
130
+ if (prop === "pages") {
131
+ return async () => {
132
+ return target.pages().then((pages) => {
133
+ return pages.map((p) => {
134
+ return new Proxy(p, handler2);
135
+ });
136
+ });
137
+ };
138
+ }
139
+ return Reflect.get(...arguments);
140
+ },
141
+ };
142
+ const proxy3 = new Proxy(this.browser, handler1);
143
+ this.browser = proxy3;
144
+ });
145
+ });
146
+ // console.log("connecting to ws://localhost:3234/devtools/browser/RANDOM");
147
+ // return puppeteer
148
+ // .connect({
149
+ // ...options,
150
+ // })
151
+ // .finally(() => {
152
+ // console.log("idk");
153
+ // });
154
+ // return new Promise<Browser>(async (res, rej) => {
155
+ // console.log("connecting with options", options);
156
+ // this.browser = await puppeteer.connect({
157
+ // ...options,
158
+ // });
159
+ // res(this.browser);
160
+ // });
161
+ }
162
+ }
163
+ exports.PM_Web = PM_Web;
164
+ // class PuppetMasterServer extends AbstractPuppetMaster {
165
+ // // constructor(...z: []) {
166
+ // // super(...z);
167
+ // // }
168
+ // // // pages(): Promise<Page[]>;
169
+ // // pages(): Promise<Page[]> {
170
+ // // return new Promise<Page[]>((res, rej) => {
171
+ // // res(super.pages());
172
+ // // });
173
+ // // }
174
+ // }
@@ -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[2].length) {
160
- getRunnables(cv[2], payload);
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(`/docs/web/src/ClassicalComponent/test.html`);
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) => {