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.
Files changed (186) hide show
  1. package/README.md +38 -26
  2. package/dist/cjs-shim.js +2 -2
  3. package/dist/common/Node.js +14 -51
  4. package/dist/common/PM/index.js +71 -0
  5. package/dist/common/PM/main.js +361 -0
  6. package/dist/common/PM/node.js +176 -0
  7. package/dist/common/PM/web.js +174 -0
  8. package/dist/common/Project.js +121 -266
  9. package/dist/common/Puppeteer.js +109 -0
  10. package/dist/common/Reporter.js +119 -0
  11. package/dist/common/Scheduler.js +1 -0
  12. package/dist/common/SubPackages/puppeteer.js +3 -1
  13. package/dist/common/SubPackages/react-dom/component/web.js +98 -45
  14. package/dist/common/SubPackages/react-dom/jsx/web.js +15 -7
  15. package/dist/common/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
  16. package/dist/common/SubPackages/react-test-renderer/component/index.js +0 -1
  17. package/dist/common/SubPackages/react-test-renderer/fc/web.js +1 -1
  18. package/dist/common/SubPackages/react-test-renderer/jsx/index.js +1 -3
  19. package/dist/common/SubPackages/react-test-renderer/jsx/web.js +1 -1
  20. package/dist/common/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
  21. package/dist/common/Types.js +2 -32
  22. package/dist/common/Web.js +25 -37
  23. package/dist/common/esbuildConfigs/index.js +5 -5
  24. package/dist/common/esbuildConfigs/node.js +17 -15
  25. package/dist/common/esbuildConfigs/report.js +12 -47
  26. package/dist/common/esbuildConfigs/tests.js +0 -1
  27. package/dist/common/esbuildConfigs/web.js +17 -12
  28. package/dist/common/lib/abstractBase.js +190 -35
  29. package/dist/common/lib/basebuilder.js +56 -29
  30. package/dist/common/lib/classBuilder.js +8 -5
  31. package/dist/common/lib/core.js +42 -17
  32. package/dist/common/lib/index.js +11 -8
  33. package/dist/common/lib/types.js +2 -0
  34. package/dist/common/preload.js +14 -28
  35. package/dist/common/puppeteerConfiger.js +24 -0
  36. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  37. package/dist/module/Node.js +14 -51
  38. package/dist/module/PM/index.js +67 -0
  39. package/dist/module/PM/main.js +331 -0
  40. package/dist/module/PM/node.js +168 -0
  41. package/dist/module/PM/web.js +167 -0
  42. package/dist/module/Project.js +122 -267
  43. package/dist/module/Puppeteer.js +104 -0
  44. package/dist/module/Reporter.js +114 -0
  45. package/dist/module/Scheduler.js +1 -0
  46. package/dist/module/SubPackages/puppeteer.js +3 -1
  47. package/dist/module/SubPackages/react/jsx/node.js +1 -1
  48. package/dist/module/SubPackages/react/jsx/web.js +1 -1
  49. package/dist/module/SubPackages/react-dom/component/node.js +2 -2
  50. package/dist/module/SubPackages/react-dom/component/web.js +98 -45
  51. package/dist/module/SubPackages/react-dom/jsx/web.js +17 -9
  52. package/dist/module/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
  53. package/dist/module/SubPackages/react-test-renderer/component/index.js +0 -1
  54. package/dist/module/SubPackages/react-test-renderer/fc/web.js +1 -1
  55. package/dist/module/SubPackages/react-test-renderer/jsx/index.js +1 -3
  56. package/dist/module/SubPackages/react-test-renderer/jsx/web.js +1 -1
  57. package/dist/module/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
  58. package/dist/module/Types.js +3 -30
  59. package/dist/module/Web.js +26 -38
  60. package/dist/module/esbuildConfigs/index.js +5 -5
  61. package/dist/module/esbuildConfigs/node.js +17 -15
  62. package/dist/module/esbuildConfigs/report.js +11 -48
  63. package/dist/module/esbuildConfigs/tests.js +0 -1
  64. package/dist/module/esbuildConfigs/web.js +17 -12
  65. package/dist/module/lib/abstractBase.js +190 -35
  66. package/dist/module/lib/basebuilder.js +56 -29
  67. package/dist/module/lib/classBuilder.js +8 -5
  68. package/dist/module/lib/core.js +44 -19
  69. package/dist/module/lib/index.js +11 -8
  70. package/dist/module/preload.js +15 -27
  71. package/dist/module/puppeteerConfiger.js +19 -0
  72. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  73. package/dist/prebuild/Report.css +1616 -584
  74. package/dist/prebuild/Report.js +2635 -2506
  75. package/dist/types/Node.d.ts +3 -2
  76. package/dist/types/PM/index.d.ts +19 -0
  77. package/dist/types/PM/main.d.ts +28 -0
  78. package/dist/types/PM/node.d.ts +26 -0
  79. package/dist/types/PM/web.d.ts +24 -0
  80. package/dist/types/Project.d.ts +1 -2
  81. package/dist/types/Puppeteer.d.ts +1 -0
  82. package/dist/types/Reporter.d.ts +1 -0
  83. package/dist/types/Scheduler.d.ts +0 -0
  84. package/dist/types/SubPackages/puppeteer.d.ts +3 -3
  85. package/dist/types/SubPackages/react/component/node.d.ts +1 -1
  86. package/dist/types/SubPackages/react/component/web.d.ts +1 -1
  87. package/dist/types/SubPackages/react/jsx/index.d.ts +1 -1
  88. package/dist/types/SubPackages/react/jsx/node.d.ts +1 -1
  89. package/dist/types/SubPackages/react/jsx/web.d.ts +2 -2
  90. package/dist/types/SubPackages/react-dom/component/node.d.ts +2 -2
  91. package/dist/types/SubPackages/react-dom/component/web.d.ts +1 -1
  92. package/dist/types/SubPackages/react-dom/jsx/node.d.ts +1 -1
  93. package/dist/types/SubPackages/react-dom/jsx/web.d.ts +1 -1
  94. package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +1 -1
  95. package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +1 -1
  96. package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +1 -1
  97. package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +1 -1
  98. package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +1 -1
  99. package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +1 -1
  100. package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +1 -1
  101. package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +3 -3
  102. package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +1 -1
  103. package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +1 -1
  104. package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +1 -1
  105. package/dist/types/Types.d.ts +19 -100
  106. package/dist/types/Web.d.ts +3 -2
  107. package/dist/types/esbuildConfigs/features.d.ts +1 -1
  108. package/dist/types/esbuildConfigs/index.d.ts +1 -1
  109. package/dist/types/esbuildConfigs/node.d.ts +1 -1
  110. package/dist/types/esbuildConfigs/report.d.ts +4 -0
  111. package/dist/types/esbuildConfigs/tests.d.ts +1 -1
  112. package/dist/types/esbuildConfigs/web.d.ts +1 -1
  113. package/dist/types/lib/abstractBase.d.ts +26 -24
  114. package/dist/types/lib/basebuilder.d.ts +10 -7
  115. package/dist/types/lib/classBuilder.d.ts +4 -3
  116. package/dist/types/lib/core.d.ts +5 -4
  117. package/dist/types/lib/index.d.ts +7 -5
  118. package/dist/types/lib/types.d.ts +62 -0
  119. package/dist/types/preload.d.ts +0 -1
  120. package/dist/types/puppeteerConfiger.d.ts +4 -0
  121. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  122. package/package.json +6 -7
  123. package/src/Node.ts +30 -85
  124. package/src/PM/index.ts +102 -0
  125. package/src/PM/main.ts +420 -0
  126. package/src/PM/node.ts +515 -0
  127. package/src/PM/web.ts +497 -0
  128. package/src/Project.ts +183 -619
  129. package/src/Puppeteer.ts +131 -0
  130. package/src/Report.tsx +158 -44
  131. package/src/Reporter.ts +134 -0
  132. package/src/Scheduler.ts +0 -0
  133. package/src/SubPackages/puppeteer.ts +19 -14
  134. package/src/SubPackages/react/component/node.ts +20 -32
  135. package/src/SubPackages/react/component/web.ts +20 -30
  136. package/src/SubPackages/react/jsx/index.ts +13 -24
  137. package/src/SubPackages/react/jsx/node.ts +5 -8
  138. package/src/SubPackages/react/jsx/web.ts +10 -8
  139. package/src/SubPackages/react-dom/component/node.ts +17 -23
  140. package/src/SubPackages/react-dom/component/web.ts +134 -95
  141. package/src/SubPackages/react-dom/jsx/web.ts +41 -48
  142. package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +27 -37
  143. package/src/SubPackages/react-test-renderer/component/index.ts +16 -30
  144. package/src/SubPackages/react-test-renderer/component/node.ts +5 -11
  145. package/src/SubPackages/react-test-renderer/component/web.ts +5 -11
  146. package/src/SubPackages/react-test-renderer/fc/node.ts +36 -50
  147. package/src/SubPackages/react-test-renderer/fc/web.ts +37 -50
  148. package/src/SubPackages/react-test-renderer/jsx/index.ts +15 -21
  149. package/src/SubPackages/react-test-renderer/jsx/node.ts +6 -10
  150. package/src/SubPackages/react-test-renderer/jsx/web.ts +7 -7
  151. package/src/SubPackages/react-test-renderer/jsx-promised/index.ts +13 -16
  152. package/src/Types.ts +73 -307
  153. package/src/Web.ts +40 -81
  154. package/src/cjs-shim.js +2 -2
  155. package/src/esbuildConfigs/features.ts +3 -4
  156. package/src/esbuildConfigs/index.ts +8 -8
  157. package/src/esbuildConfigs/node.ts +21 -20
  158. package/src/esbuildConfigs/report.ts +15 -51
  159. package/src/esbuildConfigs/tests.ts +3 -9
  160. package/src/esbuildConfigs/web.ts +22 -20
  161. package/src/lib/abstractBase.ts +312 -164
  162. package/src/lib/basebuilder.ts +123 -127
  163. package/src/lib/classBuilder.ts +30 -48
  164. package/src/lib/core.ts +115 -84
  165. package/src/lib/index.ts +58 -56
  166. package/src/lib/types.ts +197 -0
  167. package/src/preload.ts +14 -30
  168. package/src/puppeteerConfiger.ts +26 -0
  169. package/src/web.html.ts +1 -1
  170. package/dist/common/NodeWriter.js +0 -56
  171. package/dist/common/electron.js +0 -196
  172. package/dist/common/lib/browser.js +0 -26
  173. package/dist/common/nodeWriterElectron.js +0 -55
  174. package/dist/module/NodeWriter.js +0 -50
  175. package/dist/module/electron.js +0 -191
  176. package/dist/module/lib/browser.js +0 -22
  177. package/dist/module/nodeWriterElectron.js +0 -52
  178. package/dist/types/NodeWriter.d.ts +0 -2
  179. package/dist/types/lib/browser.d.ts +0 -6
  180. package/dist/types/nodeWriterElectron.d.ts +0 -2
  181. package/src/NodeWriter.ts +0 -69
  182. package/src/electron.ts +0 -250
  183. package/src/lib/browser.ts +0 -34
  184. package/src/nodeWriterElectron.ts +0 -71
  185. package/yarn-error.log +0 -3144
  186. /package/dist/{types/electron.d.ts → module/lib/types.js} +0 -0
@@ -14,108 +14,141 @@ const web_js_1 = __importDefault(require("./esbuildConfigs/web.js"));
14
14
  const features_js_1 = __importDefault(require("./esbuildConfigs/features.js"));
15
15
  const web_html_js_1 = __importDefault(require("./web.html.js"));
16
16
  const report_html_js_1 = __importDefault(require("./report.html.js"));
17
- const child_process_1 = __importDefault(require("child_process"));
17
+ var mode = process.argv[2] === "-dev" ? "DEV" : "PROD";
18
18
  readline_1.default.emitKeypressEvents(process.stdin);
19
19
  if (process.stdin.isTTY)
20
20
  process.stdin.setRawMode(true);
21
- const getRunnables = (tests, payload = [new Set(), new Set()]) => {
22
- return tests.reduce((pt, cv, cndx, cry) => {
23
- if (cv[1] === "node") {
24
- pt[0].add(cv[0]);
25
- }
26
- else if (cv[1] === "web") {
27
- pt[1].add(cv[0]);
28
- }
29
- if (cv[2].length) {
30
- getRunnables(cv[2], payload);
31
- }
32
- return pt;
33
- }, payload);
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
+ }
34
59
  };
35
60
  class ITProject {
36
61
  constructor(config) {
37
- var _a;
38
62
  this.mode = `up`;
39
63
  this.config = config;
40
- process.stdin.on('keypress', (str, key) => {
41
- if (key.name === 'q') {
42
- this.initiateShutdown("'q' command");
43
- }
44
- });
45
- process.stdin.on('keypress', (str, key) => {
46
- if (key.name === 'x') {
47
- console.log("Shutting down hard!");
48
- process.exit(-1);
49
- }
50
- });
51
- const childElectron = child_process_1.default.spawn("yarn", ["electron", "node_modules/testeranto/dist/common/electron.js"]);
52
- // childElectron.stdout.on('data', function (msg) {
53
- // console.log(msg.toString())
54
- // });
55
- const fileStream = fs_1.default.createWriteStream(`./${this.config.outdir}/electron.log`);
56
- (_a = childElectron.stdout) === null || _a === void 0 ? void 0 : _a.pipe(fileStream);
57
- Promise.resolve(Promise.all([
58
- ...this.getSecondaryEndpointsPoints("web"),
59
- ]
60
- .map(async (sourceFilePath) => {
64
+ Promise.resolve(Promise.all([...this.getSecondaryEndpointsPoints("web")].map(async (sourceFilePath) => {
61
65
  const sourceFileSplit = sourceFilePath.split("/");
62
66
  const sourceDir = sourceFileSplit.slice(0, -1);
63
67
  const sourceFileName = sourceFileSplit[sourceFileSplit.length - 1];
64
- const sourceFileNameMinusJs = sourceFileName.split(".").slice(0, -1).join(".");
68
+ const sourceFileNameMinusJs = sourceFileName
69
+ .split(".")
70
+ .slice(0, -1)
71
+ .join(".");
65
72
  const htmlFilePath = path_1.default.normalize(`${process.cwd()}/${config.outdir}/web/${sourceDir.join("/")}/${sourceFileNameMinusJs}.html`);
66
73
  const jsfilePath = `./${sourceFileNameMinusJs}.mjs`;
67
- return fs_1.default.promises.mkdir(path_1.default.dirname(htmlFilePath), { recursive: true }).then(x => fs_1.default.writeFileSync(htmlFilePath, (0, web_html_js_1.default)(jsfilePath, htmlFilePath)));
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)));
68
77
  })));
69
78
  const [nodeEntryPoints, webEntryPoints] = getRunnables(this.config.tests);
70
- (0, glob_1.glob)(`./${config.outdir}/chunk-*.mjs`, { ignore: 'node_modules/**' }).then((chunks) => {
71
- console.log("deleting chunks", chunks);
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
+ // });
97
+ (0, glob_1.glob)(`./${config.outdir}/chunk-*.mjs`, { ignore: "node_modules/**" }).then((chunks) => {
72
98
  chunks.forEach((chunk) => {
73
- console.log("deleting chunk", chunk);
74
99
  fs_1.default.unlinkSync(chunk);
75
100
  });
76
101
  });
77
- fs_1.default.copyFileSync("node_modules/testeranto/dist/prebuild/report.js", "./docs/Report.js");
78
- fs_1.default.copyFileSync("node_modules/testeranto/dist/prebuild/report.css", "./docs/Report.css");
102
+ fs_1.default.copyFileSync("./node_modules/testeranto/dist/prebuild/Report.js", "./docs/Report.js");
103
+ fs_1.default.copyFileSync("./node_modules/testeranto/dist/prebuild/Report.css", "./docs/Report.css");
79
104
  fs_1.default.writeFileSync(`${config.outdir}/report.html`, (0, report_html_js_1.default)());
80
105
  Promise.all([
81
- esbuild_1.default.context((0, features_js_1.default)(config))
106
+ fs_1.default.promises.writeFile(`${config.outdir}/testeranto.json`, JSON.stringify(Object.assign(Object.assign({}, config), { buildDir: process.cwd() + "/" + config.outdir }), null, 2)),
107
+ esbuild_1.default
108
+ .context((0, features_js_1.default)(config))
82
109
  .then(async (featuresContext) => {
83
- console.log("features entry points", config.features);
84
- await featuresContext.watch();
110
+ if (mode == "DEV") {
111
+ await featuresContext.watch();
112
+ onFeaturesDone();
113
+ }
114
+ else {
115
+ featuresContext.rebuild().then((v) => {
116
+ onFeaturesDone();
117
+ });
118
+ }
85
119
  return featuresContext;
86
120
  }),
87
- esbuild_1.default.context((0, node_js_1.default)(config, nodeEntryPoints))
121
+ esbuild_1.default
122
+ .context((0, node_js_1.default)(config, nodeEntryPoints))
88
123
  .then(async (nodeContext) => {
89
- console.log("node entry points", nodeEntryPoints);
90
- await nodeContext.watch();
124
+ if (mode == "DEV") {
125
+ await nodeContext.watch().then((v) => {
126
+ onNodeDone();
127
+ });
128
+ }
129
+ else {
130
+ nodeContext.rebuild().then((v) => {
131
+ onNodeDone();
132
+ });
133
+ }
91
134
  return nodeContext;
92
135
  }),
93
- esbuild_1.default.context((0, web_js_1.default)(config, webEntryPoints))
94
- .then(async (esbuildWeb) => {
95
- console.log("web entry points", webEntryPoints);
96
- await esbuildWeb.watch();
97
- return esbuildWeb;
136
+ esbuild_1.default
137
+ .context((0, web_js_1.default)(config, webEntryPoints))
138
+ .then(async (webContext) => {
139
+ if (mode == "DEV") {
140
+ await webContext.watch().then((v) => {
141
+ onWebDone();
142
+ });
143
+ }
144
+ else {
145
+ webContext.rebuild().then((v) => {
146
+ onWebDone();
147
+ });
148
+ }
149
+ return webContext;
98
150
  }),
99
- ]).then(async (contexts) => {
100
- Promise.all(config.tests.map(async ([test, runtime]) => {
101
- return {
102
- test,
103
- runtime
104
- };
105
- })).then(async (modules) => {
106
- fs_1.default.writeFileSync(`${config.outdir}/testeranto.json`, JSON.stringify({
107
- modules,
108
- buildDir: process.cwd() + "/" + config.outdir
109
- }, null, 2));
110
- });
111
- if (config.devMode === false) {
112
- console.log("Your tests were built but not run because devMode was false. Exiting gracefully");
113
- process.exit(0);
114
- }
115
- else {
116
- // no-op
117
- }
118
- });
151
+ ]);
119
152
  }
120
153
  getSecondaryEndpointsPoints(runtime) {
121
154
  const meta = (ts, st) => {
@@ -131,197 +164,19 @@ class ITProject {
131
164
  };
132
165
  return Array.from(meta(this.config.tests, new Set()));
133
166
  }
134
- initiateShutdown(reason) {
135
- console.log("Shutdown initiated because", reason);
136
- this.mode = "down";
137
- }
138
167
  }
139
168
  exports.ITProject = ITProject;
140
- // pm2.connect(async (err) => {
141
- // if (err) {
142
- // console.error(err);
143
- // process.exit(-1);
144
- // } else {
145
- // console.log(`pm2 is connected`);
146
- // }
147
- // // run a websocket as an alternative to node IPC
148
- // webSocketServer = new WebSocketServer({
149
- // port: 8080,
150
- // host: "localhost",
151
- // });
152
- // webSocketServer.on('open', () => {
153
- // console.log('open');
154
- // });
155
- // webSocketServer.on('close', (data) => {
156
- // console.log('webSocketServer close: %s', data);
157
- // });
158
- // webSocketServer.on('listening', () => {
159
- // console.log("webSocketServer listening", webSocketServer.address());
160
- // });
161
- // webSocketServer.on('connection', (webSocket: WebSocket) => {
162
- // webSocket.on('message', (webSocketData) => {
163
- // const payload = JSON.parse(webSocketData.valueOf().toString() as any);
164
- // const messageType = payload.type;
165
- // if (messageType === "testeranto:hola") {
166
- // const name = payload.data.requirement.name;
167
- // const requestedResources = payload.data;
168
- // this.websockets[name] = webSocket
169
- // console.log('hola WS! connected: ' + name + ' in ' + Object.getOwnPropertyNames(this.websockets))
170
- // this.requestResource(requestedResources.requirement, 'ws');
171
- // } else if (messageType === "testeranto:adios") {
172
- // console.log("adios WS", payload.data.testResourceConfiguration.name);
173
- // this.releaseTestResourceWs(payload as any);
174
- // }
175
- // });
176
- // });
177
- // const makePath = (fPath: string, rt: IRunTime): string => {
178
- // return path.resolve("./" + config.outdir + "/" +
179
- // rt +
180
- // // (rt === "electron" || rt === "chromium" ? "web" : "node") +
181
- // "/" + fPath.replace(path.extname(fPath), "") + ".mjs");
182
- // };
183
- // const bootInterval = setInterval(async () => {
184
- // const filesToLookup = this.tests
185
- // .map(([p, rt]) => {
186
- // const filepath = makePath(p, rt);
187
- // return {
188
- // filepath,
189
- // exists: fsExists(filepath),
190
- // };
191
- // });
192
- // const allFilesExist = (
193
- // await Promise.all(filesToLookup.map((f) => f.exists))
194
- // ).every((b) => b);
195
- // if (!allFilesExist) {
196
- // console.log(this.spinner(), "waiting for files to build...")
197
- // filesToLookup.forEach((f) => {
198
- // console.log(f.exists, "\t", f.filepath);
199
- // })
200
- // } else {
201
- // clearInterval(bootInterval);
202
- // pm2.launchBus((err, pm2_bus) => {
203
- // pm2_bus.on("testeranto:hola", (packet: { data: { requirement: ITTestResourceRequirement } }) => {
204
- // this.requestResource(
205
- // packet.data.requirement,
206
- // 'ipc'
207
- // );
208
- // });
209
- // pm2_bus.on("testeranto:adios", (payload: IAdiosIPC) => {
210
- // this.releaseTestResourcePm2(payload.data);
211
- // });
212
- // });
213
- // this
214
- // .tests
215
- // .reduce((m, [inputFilePath, runtime]) => {
216
- // const script = makePath(inputFilePath, runtime);
217
- // const partialTestResourceByCommandLineArg = `${script} '${JSON.stringify(
218
- // {
219
- // name: inputFilePath,
220
- // ports: [],
221
- // fs: path.resolve(
222
- // process.cwd(),
223
- // config.outdir,
224
- // inputFilePath
225
- // ),
226
- // }
227
- // )}'`;
228
- // if (runtime === "web") {
229
- // pm2.start(electron_pm2_StartOptions(
230
- // partialTestResourceByCommandLineArg,
231
- // inputFilePath,
232
- // config
233
- // ),
234
- // (err, proc) => {
235
- // if (err) {
236
- // console.error(err);
237
- // return pm2.disconnect();
238
- // }
239
- // }
240
- // );
241
- // // } else if (runtime === "chromium") {
242
- // // pm2.start(
243
- // // chromium_pm2_StartOptions(
244
- // // partialTestResourceByCommandLineArg,
245
- // // inputFilePath,
246
- // // config,
247
- // // ),
248
- // // (err, proc) => {
249
- // // if (err) {
250
- // // console.error(err);
251
- // // return pm2.disconnect();
252
- // // }
253
- // // }
254
- // // );
255
- // } else if (runtime === "node") {
256
- // const resolvedPath = path.resolve(script);
257
- // console.log("watching", resolvedPath);
258
- // pm2.start(node_pm2_StartOptions(
259
- // partialTestResourceByCommandLineArg,
260
- // inputFilePath,
261
- // config,
262
- // resolvedPath
263
- // ), (err, proc) => {
264
- // if (err) {
265
- // console.error(err);
266
- // return pm2.disconnect();
267
- // }
268
- // });
269
- // }
270
- // this.exitCodes[inputFilePath] = null;
271
- // return [inputFilePath, ...m];
272
- // }, []);
273
- // setInterval(this.mainLoop, TIMEOUT).unref();
274
- // }
275
- // }, TIMEOUT).unref();
276
- // });
277
- // public requestResource(
278
- // requirement: ITTestResourceRequirement,
279
- // protocol: ISchedulerProtocols
280
- // ) {
281
- // this.resourceQueue.push({ requirement, protocol });
282
- // }
283
- // const OPEN_PORT = "";
284
- // type ISchedulerProtocols = `ipc` | `ws`;
285
- // type IAdios = {
286
- // name: string;
287
- // failed: any;
288
- // testResourceConfiguration: {
289
- // name: string;
290
- // };
291
- // results: {
292
- // fails: any[];
293
- // givens: any[];
294
- // name: string;
295
- // };
296
- // };
297
- // type IAdiosIPC = {
298
- // process: {
299
- // namespace: string;
300
- // versioning: object;
301
- // name: string;
302
- // pm_id: number;
303
- // };
304
- // data: IAdios
305
- // at: string;
306
- // };
307
- // clearScreen: boolean;
308
- // devMode: boolean;
309
- // exitCodes: Record<number, string> = {};
310
- // features: TesterantoFeatures;
311
- // ports: Record<string, string> = {};
312
- // tests: ITestTypes[];
313
- // websockets: Record<string, WebSocket> = {};
314
- // resourceQueue: {
315
- // requirement: ITTestResourceRequirement,
316
- // protocol: ISchedulerProtocols,
317
- // }[] = [];
318
- // private spinCycle = 0;
319
- // private spinAnimation = "←↖↑↗→↘↓↙";
320
- // console.log("sending", JSON.stringify(this.tests));
321
- // childElectron.stdin.write(JSON.stringify(this.tests));
322
- // not necessary
323
- // this.esWebServerDetails = await eWeb.serve({
324
- // servedir: jsonConfig.outdir,
325
- // });
326
- // fs.copyFileSync("node_modules/testeranto/dist/index.css", "index.css")
327
- //
169
+ const getRunnables = (tests, payload = [new Set(), new Set()]) => {
170
+ return tests.reduce((pt, cv, cndx, cry) => {
171
+ if (cv[1] === "node") {
172
+ pt[0].add(cv[0]);
173
+ }
174
+ else if (cv[1] === "web") {
175
+ pt[1].add(cv[0]);
176
+ }
177
+ if (cv[3].length) {
178
+ getRunnables(cv[3], payload);
179
+ }
180
+ return pt;
181
+ }, payload);
182
+ };
@@ -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(`/dist/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) => {