testeranto 0.79.6 → 0.79.7

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 (181) hide show
  1. package/dist/common/Features.js +84 -0
  2. package/dist/common/Node.js +23 -0
  3. package/dist/common/PM/index.js +7 -0
  4. package/dist/common/PM/main.js +641 -0
  5. package/dist/common/PM/node.js +88 -0
  6. package/dist/common/PM/web.js +132 -0
  7. package/dist/common/Project.js +186 -0
  8. package/dist/common/Puppeteer.js +104 -0
  9. package/dist/common/Reporter.js +112 -0
  10. package/dist/common/Scheduler.js +1 -0
  11. package/dist/common/SubPackages/puppeteer.js +21 -0
  12. package/dist/common/SubPackages/react/component/node.js +19 -0
  13. package/dist/common/SubPackages/react/component/web.js +19 -0
  14. package/dist/common/SubPackages/react/jsx/index.js +25 -0
  15. package/dist/common/SubPackages/react/jsx/node.js +10 -0
  16. package/dist/common/SubPackages/react/jsx/web.js +10 -0
  17. package/dist/common/SubPackages/react-dom/component/node.js +101 -0
  18. package/dist/common/SubPackages/react-dom/component/web.js +93 -0
  19. package/dist/common/SubPackages/react-dom/jsx/index.js +2 -0
  20. package/dist/common/SubPackages/react-dom/jsx/node.js +39 -0
  21. package/dist/common/SubPackages/react-dom/jsx/web.js +118 -0
  22. package/dist/common/SubPackages/react-test-renderer/MemoExoticComponent/node.js +44 -0
  23. package/dist/common/SubPackages/react-test-renderer/component/index.js +2 -0
  24. package/dist/common/SubPackages/react-test-renderer/component/interface.js +68 -0
  25. package/dist/common/SubPackages/react-test-renderer/component/node.js +8 -0
  26. package/dist/common/SubPackages/react-test-renderer/component/web.js +8 -0
  27. package/dist/common/SubPackages/react-test-renderer/fc/node.js +50 -0
  28. package/dist/common/SubPackages/react-test-renderer/fc/web.js +50 -0
  29. package/dist/common/SubPackages/react-test-renderer/jsx/index.js +48 -0
  30. package/dist/common/SubPackages/react-test-renderer/jsx/node.js +10 -0
  31. package/dist/common/SubPackages/react-test-renderer/jsx/web.js +10 -0
  32. package/dist/common/SubPackages/react-test-renderer/jsx-promised/index.js +42 -0
  33. package/dist/common/SubPackages/react-test-renderer/jsx-promised/node.js +10 -0
  34. package/dist/common/SubPackages/react-test-renderer/jsx-promised/web.js +10 -0
  35. package/dist/common/TaskManBackEnd.js +174 -0
  36. package/dist/common/Types.js +2 -0
  37. package/dist/common/Web.js +39 -0
  38. package/dist/common/esbuildConfigs/features.js +14 -0
  39. package/dist/common/esbuildConfigs/index.js +21 -0
  40. package/dist/common/esbuildConfigs/inputFilesPlugin.js +49 -0
  41. package/dist/common/esbuildConfigs/node.js +39 -0
  42. package/dist/common/esbuildConfigs/report.js +13 -0
  43. package/dist/common/esbuildConfigs/tests.js +13 -0
  44. package/dist/common/esbuildConfigs/web.js +57 -0
  45. package/dist/common/lib/abstractBase.js +553 -0
  46. package/dist/common/lib/basebuilder.js +79 -0
  47. package/dist/common/lib/classBuilder.js +42 -0
  48. package/dist/common/lib/core.js +75 -0
  49. package/dist/common/lib/index.js +22 -0
  50. package/dist/common/lib/types.js +2 -0
  51. package/dist/common/mongooseSchemas.js +56 -0
  52. package/dist/common/package.json +3 -0
  53. package/dist/common/preload.js +15 -0
  54. package/dist/common/puppeteerConfiger.js +24 -0
  55. package/dist/common/report.html.js +31 -0
  56. package/dist/common/tsconfig.common.tsbuildinfo +1 -0
  57. package/dist/common/utils.js +16 -0
  58. package/dist/common/web.html.js +22 -0
  59. package/dist/module/ExampleTab.js +112 -0
  60. package/dist/module/Features.js +73 -0
  61. package/dist/module/Node.js +18 -0
  62. package/dist/module/PM/index.js +3 -0
  63. package/dist/module/PM/main.js +611 -0
  64. package/dist/module/PM/node.js +81 -0
  65. package/dist/module/PM/web.js +125 -0
  66. package/dist/module/Project.js +179 -0
  67. package/dist/module/Puppeteer.js +99 -0
  68. package/dist/module/Reporter.js +107 -0
  69. package/dist/module/Scheduler.js +1 -0
  70. package/dist/module/SubPackages/puppeteer.js +16 -0
  71. package/dist/module/SubPackages/react/component/node.js +14 -0
  72. package/dist/module/SubPackages/react/component/web.js +14 -0
  73. package/dist/module/SubPackages/react/jsx/index.js +19 -0
  74. package/dist/module/SubPackages/react/jsx/node.js +5 -0
  75. package/dist/module/SubPackages/react/jsx/web.js +5 -0
  76. package/dist/module/SubPackages/react-dom/component/node.js +93 -0
  77. package/dist/module/SubPackages/react-dom/component/web.js +88 -0
  78. package/dist/module/SubPackages/react-dom/jsx/index.js +1 -0
  79. package/dist/module/SubPackages/react-dom/jsx/node.js +31 -0
  80. package/dist/module/SubPackages/react-dom/jsx/web.js +90 -0
  81. package/dist/module/SubPackages/react-test-renderer/MemoExoticComponent/node.js +16 -0
  82. package/dist/module/SubPackages/react-test-renderer/component/index.js +1 -0
  83. package/dist/module/SubPackages/react-test-renderer/component/interface.js +39 -0
  84. package/dist/module/SubPackages/react-test-renderer/component/node.js +3 -0
  85. package/dist/module/SubPackages/react-test-renderer/component/web.js +3 -0
  86. package/dist/module/SubPackages/react-test-renderer/fc/node.js +22 -0
  87. package/dist/module/SubPackages/react-test-renderer/fc/web.js +22 -0
  88. package/dist/module/SubPackages/react-test-renderer/jsx/index.js +19 -0
  89. package/dist/module/SubPackages/react-test-renderer/jsx/node.js +5 -0
  90. package/dist/module/SubPackages/react-test-renderer/jsx/web.js +5 -0
  91. package/dist/module/SubPackages/react-test-renderer/jsx-promised/index.js +16 -0
  92. package/dist/module/SubPackages/react-test-renderer/jsx-promised/node.js +5 -0
  93. package/dist/module/SubPackages/react-test-renderer/jsx-promised/web.js +5 -0
  94. package/dist/module/TaskManBackEnd.js +169 -0
  95. package/dist/module/TaskManFrontEnd.js +600 -0
  96. package/dist/module/Types.js +1 -0
  97. package/dist/module/Web.js +34 -0
  98. package/dist/module/esbuildConfigs/features.js +12 -0
  99. package/dist/module/esbuildConfigs/index.js +19 -0
  100. package/dist/module/esbuildConfigs/inputFilesPlugin.js +44 -0
  101. package/dist/module/esbuildConfigs/node.js +34 -0
  102. package/dist/module/esbuildConfigs/report.js +11 -0
  103. package/dist/module/esbuildConfigs/tests.js +11 -0
  104. package/dist/module/esbuildConfigs/web.js +52 -0
  105. package/dist/module/lib/abstractBase.js +545 -0
  106. package/dist/module/lib/basebuilder.js +75 -0
  107. package/dist/module/lib/classBuilder.js +38 -0
  108. package/dist/module/lib/core.js +72 -0
  109. package/dist/module/lib/index.js +18 -0
  110. package/dist/module/lib/types.js +1 -0
  111. package/dist/module/mongooseSchemas.js +50 -0
  112. package/dist/module/package.json +3 -0
  113. package/dist/module/preload.js +15 -0
  114. package/dist/module/puppeteerConfiger.js +19 -0
  115. package/dist/module/report.html.js +29 -0
  116. package/dist/module/tsconfig.module.tsbuildinfo +1 -0
  117. package/dist/module/utils.js +9 -0
  118. package/dist/module/web.html.js +20 -0
  119. package/dist/prebuild/Report.css +11358 -0
  120. package/dist/prebuild/Report.js +37666 -0
  121. package/dist/prebuild/TaskManBackEnd.mjs +180 -0
  122. package/dist/prebuild/TaskManFrontEnd.css +12301 -0
  123. package/dist/prebuild/TaskManFrontEnd.js +81737 -0
  124. package/dist/types/Features.d.ts +68 -0
  125. package/dist/types/Node.d.ts +6 -0
  126. package/dist/types/PM/index.d.ts +20 -0
  127. package/dist/types/PM/main.d.ts +31 -0
  128. package/dist/types/PM/node.d.ts +27 -0
  129. package/dist/types/PM/web.d.ts +25 -0
  130. package/dist/types/Project.d.ts +7 -0
  131. package/dist/types/Puppeteer.d.ts +1 -0
  132. package/dist/types/Reporter.d.ts +1 -0
  133. package/dist/types/Scheduler.d.ts +0 -0
  134. package/dist/types/SubPackages/puppeteer.d.ts +6 -0
  135. package/dist/types/SubPackages/react/component/node.d.ts +7 -0
  136. package/dist/types/SubPackages/react/component/web.d.ts +7 -0
  137. package/dist/types/SubPackages/react/jsx/index.d.ts +12 -0
  138. package/dist/types/SubPackages/react/jsx/node.d.ts +4 -0
  139. package/dist/types/SubPackages/react/jsx/web.d.ts +4 -0
  140. package/dist/types/SubPackages/react-dom/component/node.d.ts +12 -0
  141. package/dist/types/SubPackages/react-dom/component/web.d.ts +11 -0
  142. package/dist/types/SubPackages/react-dom/jsx/index.d.ts +6 -0
  143. package/dist/types/SubPackages/react-dom/jsx/node.d.ts +6 -0
  144. package/dist/types/SubPackages/react-dom/jsx/web.d.ts +5 -0
  145. package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +5 -0
  146. package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +13 -0
  147. package/dist/types/SubPackages/react-test-renderer/component/interface.d.ts +9 -0
  148. package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +8 -0
  149. package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +3 -0
  150. package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +8 -0
  151. package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +8 -0
  152. package/dist/types/SubPackages/react-test-renderer/jsx/index.d.ts +16 -0
  153. package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +8 -0
  154. package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +8 -0
  155. package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +15 -0
  156. package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +4 -0
  157. package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +4 -0
  158. package/dist/types/TaskManBackEnd.d.ts +1 -0
  159. package/dist/types/Types.d.ts +50 -0
  160. package/dist/types/Web.d.ts +6 -0
  161. package/dist/types/esbuildConfigs/features.d.ts +4 -0
  162. package/dist/types/esbuildConfigs/index.d.ts +4 -0
  163. package/dist/types/esbuildConfigs/inputFilesPlugin.d.ts +5 -0
  164. package/dist/types/esbuildConfigs/node.d.ts +4 -0
  165. package/dist/types/esbuildConfigs/report.d.ts +4 -0
  166. package/dist/types/esbuildConfigs/tests.d.ts +4 -0
  167. package/dist/types/esbuildConfigs/web.d.ts +4 -0
  168. package/dist/types/lib/abstractBase.d.ts +104 -0
  169. package/dist/types/lib/basebuilder.d.ts +27 -0
  170. package/dist/types/lib/classBuilder.d.ts +7 -0
  171. package/dist/types/lib/core.d.ts +8 -0
  172. package/dist/types/lib/index.d.ts +59 -0
  173. package/dist/types/lib/types.d.ts +64 -0
  174. package/dist/types/mongooseSchemas.d.ts +124 -0
  175. package/dist/types/preload.d.ts +0 -0
  176. package/dist/types/puppeteerConfiger.d.ts +4 -0
  177. package/dist/types/report.html.d.ts +2 -0
  178. package/dist/types/tsconfig.types.tsbuildinfo +1 -0
  179. package/dist/types/utils.d.ts +2 -0
  180. package/dist/types/web.html.d.ts +2 -0
  181. package/package.json +2 -2
@@ -0,0 +1,88 @@
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 = void 0;
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const puppeteer_core_1 = __importDefault(require("puppeteer-core"));
10
+ const index_js_1 = require("./index.js");
11
+ const fPaths = [];
12
+ class PM_Node extends index_js_1.PM {
13
+ constructor(t) {
14
+ super();
15
+ this.server = {};
16
+ this.testResourceConfiguration = t;
17
+ }
18
+ customScreenShot(opts, page) {
19
+ return globalThis["customScreenShot"](opts, page);
20
+ }
21
+ existsSync(destFolder) {
22
+ return globalThis["existsSync"](this.testResourceConfiguration.fs + "/" + destFolder);
23
+ }
24
+ mkdirSync() {
25
+ return globalThis["mkdirSync"](this.testResourceConfiguration.fs + "/");
26
+ }
27
+ write(writeObject, contents) {
28
+ return globalThis["write"](writeObject.uid, contents);
29
+ }
30
+ writeFileSync(filepath, contents) {
31
+ console.log("pm_node-writeFileSync", this.testResourceConfiguration);
32
+ return globalThis["writeFileSync"](this.testResourceConfiguration.fs + "/" + filepath, contents, this.testResourceConfiguration.name);
33
+ }
34
+ createWriteStream(filepath) {
35
+ return globalThis["createWriteStream"](this.testResourceConfiguration.fs + "/" + filepath, this.testResourceConfiguration.name);
36
+ }
37
+ end(writeObject) {
38
+ return globalThis["end"](writeObject.uid);
39
+ }
40
+ customclose() {
41
+ globalThis["customclose"](this.testResourceConfiguration.fs, this.testResourceConfiguration.name);
42
+ }
43
+ testArtiFactoryfileWriter(tLog, callback) {
44
+ return (fPath, value) => {
45
+ callback(new Promise((res, rej) => {
46
+ tLog("testArtiFactory =>", fPath);
47
+ const cleanPath = path_1.default.resolve(fPath);
48
+ fPaths.push(cleanPath.replace(process.cwd(), ``));
49
+ const targetDir = cleanPath.split("/").slice(0, -1).join("/");
50
+ fs_1.default.mkdir(targetDir, { recursive: true }, async (error) => {
51
+ if (error) {
52
+ console.error(`❗️testArtiFactory failed`, targetDir, error);
53
+ }
54
+ fs_1.default.writeFileSync(path_1.default.resolve(targetDir.split("/").slice(0, -1).join("/"), "manifest"), fPaths.join(`\n`), {
55
+ encoding: "utf-8",
56
+ });
57
+ if (Buffer.isBuffer(value)) {
58
+ fs_1.default.writeFileSync(fPath, value, "binary");
59
+ res();
60
+ }
61
+ else if (`string` === typeof value) {
62
+ fs_1.default.writeFileSync(fPath, value.toString(), {
63
+ encoding: "utf-8",
64
+ });
65
+ res();
66
+ }
67
+ else {
68
+ /* @ts-ignore:next-line */
69
+ const pipeStream = value;
70
+ const myFile = fs_1.default.createWriteStream(fPath);
71
+ pipeStream.pipe(myFile);
72
+ pipeStream.on("close", () => {
73
+ myFile.close();
74
+ res();
75
+ });
76
+ }
77
+ });
78
+ }));
79
+ };
80
+ }
81
+ // launch(options?: PuppeteerLaunchOptions): Promise<Browser>;
82
+ startPuppeteer(options) {
83
+ return puppeteer_core_1.default.connect(options).then((b) => {
84
+ this.browser = b;
85
+ });
86
+ }
87
+ }
88
+ exports.PM_Node = PM_Node;
@@ -0,0 +1,132 @@
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
+ customScreenShot(opts) {
16
+ window["customScreenShot"](opts);
17
+ }
18
+ existsSync(destFolder) {
19
+ return window["existsSync"](destFolder);
20
+ }
21
+ mkdirSync() {
22
+ return window["mkdirSync"](this.testResourceConfiguration.fs + "/");
23
+ }
24
+ write(writeObject, contents) {
25
+ return window["write"](writeObject.uid, contents);
26
+ }
27
+ writeFileSync(filepath, contents) {
28
+ return window["writeFileSync"](this.testResourceConfiguration.fs + "/" + filepath, contents, this.testResourceConfiguration.name);
29
+ }
30
+ createWriteStream(filepath) {
31
+ return window["createWriteStream"](this.testResourceConfiguration.fs + "/" + filepath, this.testResourceConfiguration.name);
32
+ }
33
+ end(writeObject) {
34
+ return window["end"](writeObject.uid);
35
+ }
36
+ customclose() {
37
+ window["customclose"](this.testResourceConfiguration.fs, this.testResourceConfiguration.name);
38
+ }
39
+ testArtiFactoryfileWriter(tLog, callback) {
40
+ return (fPath, value) => {
41
+ callback(new Promise((res, rej) => {
42
+ tLog("testArtiFactory =>", fPath);
43
+ // const cleanPath = path.resolve(fPath);
44
+ // fPaths.push(cleanPath.replace(process.cwd(), ``));
45
+ // const targetDir = cleanPath.split("/").slice(0, -1).join("/");
46
+ // fs.mkdir(targetDir, { recursive: true }, async (error) => {
47
+ // if (error) {
48
+ // console.error(`❗️testArtiFactory failed`, targetDir, error);
49
+ // }
50
+ // fs.writeFileSync(
51
+ // path.resolve(
52
+ // targetDir.split("/").slice(0, -1).join("/"),
53
+ // "manifest"
54
+ // ),
55
+ // fPaths.join(`\n`),
56
+ // {
57
+ // encoding: "utf-8",
58
+ // }
59
+ // );
60
+ // if (Buffer.isBuffer(value)) {
61
+ // fs.writeFileSync(fPath, value, "binary");
62
+ // res();
63
+ // } else if (`string` === typeof value) {
64
+ // fs.writeFileSync(fPath, value.toString(), {
65
+ // encoding: "utf-8",
66
+ // });
67
+ // res();
68
+ // } else {
69
+ // /* @ts-ignore:next-line */
70
+ // const pipeStream: PassThrough = value;
71
+ // const myFile = fs.createWriteStream(fPath);
72
+ // pipeStream.pipe(myFile);
73
+ // pipeStream.on("close", () => {
74
+ // myFile.close();
75
+ // res();
76
+ // });
77
+ // }
78
+ // });
79
+ }));
80
+ };
81
+ }
82
+ startPuppeteer(options, destFolder) {
83
+ const name = this.testResourceConfiguration.name;
84
+ return fetch(`http://localhost:3234/json/version`)
85
+ .then((v) => {
86
+ return v.json();
87
+ })
88
+ .then((json) => {
89
+ return puppeteer_core_browser_js_1.default
90
+ .connect({
91
+ browserWSEndpoint: json.webSocketDebuggerUrl,
92
+ })
93
+ .then((b) => {
94
+ this.browser = b;
95
+ const handler2 = {
96
+ get(target, prop, receiver) {
97
+ if (prop === "screenshot") {
98
+ return async (x) => {
99
+ return await window["custom-screenshot"](Object.assign(Object.assign({}, x), {
100
+ // path: destFolder + "/" + x.path,
101
+ path: x.path }), name);
102
+ };
103
+ }
104
+ else if (prop === "mainFrame") {
105
+ return () => target[prop](...arguments);
106
+ }
107
+ else {
108
+ return Reflect.get(...arguments);
109
+ }
110
+ },
111
+ };
112
+ const handler1 = {
113
+ get(target, prop, receiver) {
114
+ if (prop === "pages") {
115
+ return async () => {
116
+ return target.pages().then((pages) => {
117
+ return pages.map((p) => {
118
+ return new Proxy(p, handler2);
119
+ });
120
+ });
121
+ };
122
+ }
123
+ return Reflect.get(...arguments);
124
+ },
125
+ };
126
+ const proxy3 = new Proxy(this.browser, handler1);
127
+ this.browser = proxy3;
128
+ });
129
+ });
130
+ }
131
+ }
132
+ exports.PM_Web = PM_Web;
@@ -0,0 +1,186 @@
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.ITProject = void 0;
7
+ const esbuild_1 = __importDefault(require("esbuild"));
8
+ const fs_1 = __importDefault(require("fs"));
9
+ const path_1 = __importDefault(require("path"));
10
+ const readline_1 = __importDefault(require("readline"));
11
+ const glob_1 = require("glob");
12
+ const node_js_1 = __importDefault(require("./esbuildConfigs/node.js"));
13
+ const web_js_1 = __importDefault(require("./esbuildConfigs/web.js"));
14
+ const features_js_1 = __importDefault(require("./esbuildConfigs/features.js"));
15
+ const web_html_js_1 = __importDefault(require("./web.html.js"));
16
+ const report_html_js_1 = __importDefault(require("./report.html.js"));
17
+ var mode = process.argv[2] === "-dev" ? "DEV" : "PROD";
18
+ readline_1.default.emitKeypressEvents(process.stdin);
19
+ if (process.stdin.isTTY)
20
+ process.stdin.setRawMode(true);
21
+ process.stdin.on("keypress", (str, key) => {
22
+ if (key.name === "q") {
23
+ console.log("Testeranto-EsBuild is shutting down...");
24
+ mode = "PROD";
25
+ onDone();
26
+ }
27
+ });
28
+ // setInterval(() => {
29
+ // const memoryUsage = process.memoryUsage();
30
+ // console.log("Memory usage:", memoryUsage);
31
+ // }, 10000); // Check every 10 seconds
32
+ let featuresDone, nodeDone, webDone = false;
33
+ const onFeaturesDone = () => {
34
+ featuresDone = true;
35
+ onDone();
36
+ };
37
+ const onNodeDone = () => {
38
+ nodeDone = true;
39
+ onDone();
40
+ };
41
+ const onWebDone = () => {
42
+ webDone = true;
43
+ onDone();
44
+ };
45
+ const onDone = () => {
46
+ console.log(JSON.stringify({
47
+ featuresDone,
48
+ nodeDone,
49
+ webDone,
50
+ mode,
51
+ }, null, 2));
52
+ if (featuresDone && nodeDone && webDone && mode === "PROD") {
53
+ console.log("Testeranto-EsBuild is all done. Goodbye!");
54
+ process.exit();
55
+ }
56
+ else {
57
+ console.log("Testeranto-EsBuild is still working...");
58
+ }
59
+ };
60
+ class ITProject {
61
+ constructor(config) {
62
+ this.mode = `up`;
63
+ this.config = config;
64
+ Promise.resolve(Promise.all([...this.getSecondaryEndpointsPoints("web")].map(async (sourceFilePath) => {
65
+ const sourceFileSplit = sourceFilePath.split("/");
66
+ const sourceDir = sourceFileSplit.slice(0, -1);
67
+ const sourceFileName = sourceFileSplit[sourceFileSplit.length - 1];
68
+ const sourceFileNameMinusJs = sourceFileName
69
+ .split(".")
70
+ .slice(0, -1)
71
+ .join(".");
72
+ const htmlFilePath = path_1.default.normalize(`${process.cwd()}/${config.outdir}/web/${sourceDir.join("/")}/${sourceFileNameMinusJs}.html`);
73
+ const jsfilePath = `./${sourceFileNameMinusJs}.mjs`;
74
+ return fs_1.default.promises
75
+ .mkdir(path_1.default.dirname(htmlFilePath), { recursive: true })
76
+ .then((x) => fs_1.default.writeFileSync(htmlFilePath, (0, web_html_js_1.default)(jsfilePath, htmlFilePath)));
77
+ })));
78
+ const [nodeEntryPoints, webEntryPoints] = getRunnables(this.config.tests);
79
+ console.log(`this.getSecondaryEndpointsPoints("web")`, this.getSecondaryEndpointsPoints("web"));
80
+ // console.log("nodeEntryPoints", nodeEntryPoints);
81
+ // console.log("webEntryPoints", webEntryPoints);
82
+ // nodeEntryPoints.forEach((nep) => {
83
+ // const f = `${process.cwd()}/${nep}`;
84
+ // console.log("nep", f);
85
+ // import(f).then((module) => {
86
+ // return module.default.then((defaultModule) => {
87
+ // console.log("defaultModule", defaultModule);
88
+ // // defaultModule
89
+ // // .receiveTestResourceConfig(argz)
90
+ // // .then((x) => {
91
+ // // console.log("then", x);
92
+ // // return x;
93
+ // // })
94
+ // // .catch((e) => {
95
+ // // console.log("catch", e);
96
+ // // });
97
+ // });
98
+ // });
99
+ // });
100
+ (0, glob_1.glob)(`./${config.outdir}/chunk-*.mjs`, { ignore: "node_modules/**" }).then((chunks) => {
101
+ chunks.forEach((chunk) => {
102
+ fs_1.default.unlinkSync(chunk);
103
+ });
104
+ });
105
+ fs_1.default.copyFileSync("./node_modules/testeranto/dist/prebuild/Report.js", "./docs/Report.js");
106
+ fs_1.default.copyFileSync("./node_modules/testeranto/dist/prebuild/Report.css", "./docs/Report.css");
107
+ fs_1.default.writeFileSync(`${config.outdir}/report.html`, (0, report_html_js_1.default)());
108
+ Promise.all([
109
+ fs_1.default.promises.writeFile(`${config.outdir}/testeranto.json`, JSON.stringify(Object.assign(Object.assign({}, config), { buildDir: process.cwd() + "/" + config.outdir }), null, 2)),
110
+ esbuild_1.default
111
+ .context((0, features_js_1.default)(config))
112
+ .then(async (featuresContext) => {
113
+ if (mode == "DEV") {
114
+ await featuresContext.watch();
115
+ onFeaturesDone();
116
+ }
117
+ else {
118
+ featuresContext.rebuild().then((v) => {
119
+ onFeaturesDone();
120
+ });
121
+ }
122
+ return featuresContext;
123
+ }),
124
+ esbuild_1.default
125
+ .context((0, node_js_1.default)(config, nodeEntryPoints))
126
+ .then(async (nodeContext) => {
127
+ if (mode == "DEV") {
128
+ await nodeContext.watch().then((v) => {
129
+ onNodeDone();
130
+ });
131
+ }
132
+ else {
133
+ nodeContext.rebuild().then((v) => {
134
+ onNodeDone();
135
+ });
136
+ }
137
+ return nodeContext;
138
+ }),
139
+ esbuild_1.default
140
+ .context((0, web_js_1.default)(config, webEntryPoints))
141
+ .then(async (webContext) => {
142
+ if (mode == "DEV") {
143
+ await webContext.watch().then((v) => {
144
+ onWebDone();
145
+ });
146
+ }
147
+ else {
148
+ webContext.rebuild().then((v) => {
149
+ onWebDone();
150
+ });
151
+ }
152
+ return webContext;
153
+ }),
154
+ ]);
155
+ }
156
+ getSecondaryEndpointsPoints(runtime) {
157
+ const meta = (ts, st) => {
158
+ ts.forEach((t) => {
159
+ console.log("getSecondaryEndpointsPoints", t);
160
+ if (t[1] === runtime) {
161
+ st.add(t[0]);
162
+ }
163
+ if (Array.isArray(t[3])) {
164
+ meta(t[3], st);
165
+ }
166
+ });
167
+ return st;
168
+ };
169
+ return Array.from(meta(this.config.tests, new Set()));
170
+ }
171
+ }
172
+ exports.ITProject = ITProject;
173
+ const getRunnables = (tests, payload = [new Set(), new Set()]) => {
174
+ return tests.reduce((pt, cv, cndx, cry) => {
175
+ if (cv[1] === "node") {
176
+ pt[0].add(cv[0]);
177
+ }
178
+ else if (cv[1] === "web") {
179
+ pt[1].add(cv[0]);
180
+ }
181
+ if (cv[3].length) {
182
+ getRunnables(cv[3], payload);
183
+ }
184
+ return pt;
185
+ }, payload);
186
+ };
@@ -0,0 +1,104 @@
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 main_js_1 = require("./PM/main.js");
10
+ const utils_js_1 = require("./utils.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
+ "--disable-features=IsolateOrigins,site-per-process",
34
+ "--disable-site-isolation-trials",
35
+ "--allow-insecure-localhost",
36
+ "--allow-file-access-from-files",
37
+ "--allow-running-insecure-content",
38
+ // "--auto-open-devtools-for-tabs",
39
+ "--disable-dev-shm-usage",
40
+ "--disable-extensions",
41
+ "--disable-gpu",
42
+ "--disable-setuid-sandbox",
43
+ "--disable-site-isolation-trials",
44
+ "--disable-web-security",
45
+ "--no-first-run",
46
+ "--no-sandbox",
47
+ "--no-startup-window",
48
+ // "--no-zygote",
49
+ "--reduce-security-for-testing",
50
+ "--remote-allow-origins=*",
51
+ "--unsafely-treat-insecure-origin-as-secure=*",
52
+ // "--disable-features=IsolateOrigins",
53
+ // "--remote-allow-origins=ws://localhost:3234",
54
+ // "--single-process",
55
+ // "--unsafely-treat-insecure-origin-as-secure",
56
+ // "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
57
+ `--remote-debugging-port=3234`,
58
+ // "--disk-cache-dir=/dev/null",
59
+ // "--disk-cache-size=1",
60
+ // "--start-maximized",
61
+ ],
62
+ }, ".");
63
+ configs.tests.forEach(([test, runtime, tr, sidecars]) => {
64
+ if (runtime === "node") {
65
+ pm.launchNode(test, (0, utils_js_1.destinationOfRuntime)(test, "node", configs));
66
+ }
67
+ else if (runtime === "web") {
68
+ pm.launchWeb(test, (0, utils_js_1.destinationOfRuntime)(test, "web", configs), sidecars);
69
+ }
70
+ else {
71
+ console.error("runtime makes no sense", runtime);
72
+ }
73
+ });
74
+ console.log("ready and watching for changes...", configs.buildDir);
75
+ fs_1.default.watch(configs.buildDir, {
76
+ recursive: true,
77
+ }, (eventType, changedFile) => {
78
+ if (changedFile) {
79
+ configs.tests.forEach(([test, runtime, tr, sidecars]) => {
80
+ if (eventType === "change" || eventType === "rename") {
81
+ if (changedFile ===
82
+ test
83
+ .replace("./", "node/")
84
+ .split(".")
85
+ .slice(0, -1)
86
+ .concat("mjs")
87
+ .join(".")) {
88
+ pm.launchNode(test, (0, utils_js_1.destinationOfRuntime)(test, "node", configs));
89
+ }
90
+ if (changedFile ===
91
+ test
92
+ .replace("./", "web/")
93
+ .split(".")
94
+ .slice(0, -1)
95
+ .concat("mjs")
96
+ .join(".")) {
97
+ pm.launchWeb(test, (0, utils_js_1.destinationOfRuntime)(test, "web", configs), sidecars);
98
+ }
99
+ }
100
+ });
101
+ }
102
+ });
103
+ };
104
+ main();
@@ -0,0 +1,112 @@
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?local=true`);
65
+ // configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
66
+ // if (runtime === "node") {
67
+ // pm.launchNode(test, destinationOfRuntime(test, "node"));
68
+ // } else if (runtime === "web") {
69
+ // pm.launchWeb(test, destinationOfRuntime(test, "web"));
70
+ // } else {
71
+ // console.error("runtime makes no sense", runtime);
72
+ // }
73
+ // });
74
+ // console.log("ready and watching for changes...", configs.buildDir);
75
+ // fs.watch(
76
+ // configs.buildDir,
77
+ // {
78
+ // recursive: true,
79
+ // },
80
+ // (eventType, changedFile) => {
81
+ // if (changedFile) {
82
+ // configs.tests.forEach(([test, runtime, secondaryArtifacts]) => {
83
+ // if (eventType === "change" || eventType === "rename") {
84
+ // if (
85
+ // changedFile ===
86
+ // test
87
+ // .replace("./", "node/")
88
+ // .split(".")
89
+ // .slice(0, -1)
90
+ // .concat("mjs")
91
+ // .join(".")
92
+ // ) {
93
+ // pm.launchNode(test, destinationOfRuntime(test, "node"));
94
+ // }
95
+ // if (
96
+ // changedFile ===
97
+ // test
98
+ // .replace("./", "web/")
99
+ // .split(".")
100
+ // .slice(0, -1)
101
+ // .concat("mjs")
102
+ // .join(".")
103
+ // ) {
104
+ // pm.launchWeb(test, destinationOfRuntime(test, "web"));
105
+ // }
106
+ // }
107
+ // });
108
+ // }
109
+ // }
110
+ // );
111
+ };
112
+ main();
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,21 @@
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 react_1 = __importDefault(require("react"));
7
+ const Node_js_1 = __importDefault(require("../Node.js"));
8
+ exports.default = (testInput, testSpecifications, testImplementations, testInterface) => {
9
+ return (0, Node_js_1.default)(testInput, testSpecifications, testImplementations, Object.assign({ beforeAll(x) {
10
+ // process.parentPort.postMessage(
11
+ // `/docs/web/src/ClassicalComponent/test.html`
12
+ // );
13
+ return x;
14
+ }, beforeEach: async () => {
15
+ return new Promise((resolve, rej) => {
16
+ resolve(react_1.default.createElement(testInput, {}, []));
17
+ });
18
+ }, andWhen: function (s, whenCB) {
19
+ return whenCB()(s);
20
+ } }, testInterface));
21
+ };
@@ -0,0 +1,19 @@
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 react_1 = __importDefault(require("react"));
7
+ const Node_js_1 = __importDefault(require("../../../Node.js"));
8
+ exports.default = (testImplementations, testSpecifications, testInput) => {
9
+ return (0, Node_js_1.default)(testInput, testSpecifications, testImplementations, {
10
+ beforeEach: async () => {
11
+ return new Promise((resolve, rej) => {
12
+ resolve(react_1.default.createElement(testInput, {}, []));
13
+ });
14
+ },
15
+ andWhen: function (s, whenCB) {
16
+ return whenCB()(s);
17
+ },
18
+ });
19
+ };