testeranto 0.49.9 → 0.62.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 (241) hide show
  1. package/.nvmrc +1 -0
  2. package/README.md +71 -9
  3. package/dist/cjs-shim.js +12 -0
  4. package/dist/common/Features.js +2 -3
  5. package/dist/common/Node.js +53 -61
  6. package/dist/common/Project.js +272 -606
  7. package/dist/common/SubPackages/puppeteer.js +19 -0
  8. package/dist/common/{subPackages → SubPackages}/react/component/node.js +4 -4
  9. package/dist/common/{subPackages → SubPackages}/react/component/web.js +4 -4
  10. package/dist/common/SubPackages/react/jsx/index.js +13 -0
  11. package/dist/common/SubPackages/react/jsx/node.js +10 -0
  12. package/dist/common/SubPackages/react/jsx/web.js +10 -0
  13. package/dist/common/{subPackages → SubPackages}/react-dom/component/node.js +6 -6
  14. package/dist/common/{subPackages → SubPackages}/react-dom/component/web.js +11 -12
  15. package/dist/common/SubPackages/react-dom/jsx/node.js +39 -0
  16. package/dist/common/{subPackages → SubPackages}/react-dom/jsx/web.js +6 -27
  17. package/dist/common/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +2 -2
  18. package/dist/common/{subPackages → SubPackages}/react-test-renderer/component/index.js +26 -15
  19. package/dist/common/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/component}/node.js +3 -5
  20. package/dist/common/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/component}/web.js +3 -5
  21. package/dist/common/{subPackages → SubPackages}/react-test-renderer/fc/node.js +4 -4
  22. package/dist/common/{subPackages → SubPackages}/react-test-renderer/fc/web.js +4 -4
  23. package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx/index.js +8 -2
  24. package/dist/common/{subPackages/react-test-renderer/jsx-promised → SubPackages/react-test-renderer/jsx}/node.js +4 -4
  25. package/dist/common/{subPackages/react → SubPackages/react-test-renderer}/jsx/web.js +4 -4
  26. package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.js +2 -2
  27. package/dist/common/{subPackages/react/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +2 -2
  28. package/dist/common/Types.js +32 -0
  29. package/dist/common/Web.js +41 -112
  30. package/dist/common/electron.js +188 -44
  31. package/dist/common/esbuildConfigs/features.js +14 -0
  32. package/dist/common/esbuildConfigs/index.js +20 -0
  33. package/dist/common/esbuildConfigs/node.js +35 -0
  34. package/dist/common/esbuildConfigs/report.js +48 -0
  35. package/dist/common/esbuildConfigs/tests.js +14 -0
  36. package/dist/common/esbuildConfigs/web.js +50 -0
  37. package/dist/common/lib/abstractBase.js +193 -0
  38. package/dist/common/lib/basebuilder.js +86 -0
  39. package/dist/common/lib/browser.js +26 -0
  40. package/dist/common/lib/classBuilder.js +41 -0
  41. package/dist/common/lib/core.js +52 -0
  42. package/dist/common/lib/index.js +19 -0
  43. package/dist/common/nodeWriterElectron.js +55 -0
  44. package/dist/common/preload.js +22 -21
  45. package/dist/common/report.html.js +31 -0
  46. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  47. package/dist/common/web.html.js +22 -0
  48. package/dist/module/Features.js +2 -3
  49. package/dist/module/Node.js +53 -61
  50. package/dist/module/Project.js +272 -583
  51. package/dist/module/SubPackages/puppeteer.js +14 -0
  52. package/dist/module/{subPackages → SubPackages}/react/component/node.js +3 -3
  53. package/dist/module/{subPackages → SubPackages}/react/component/web.js +3 -3
  54. package/dist/module/SubPackages/react/jsx/index.js +10 -0
  55. package/dist/module/SubPackages/react/jsx/node.js +5 -0
  56. package/dist/module/SubPackages/react/jsx/web.js +5 -0
  57. package/dist/module/{subPackages → SubPackages}/react-dom/component/node.js +5 -5
  58. package/dist/module/{subPackages → SubPackages}/react-dom/component/web.js +10 -11
  59. package/dist/module/SubPackages/react-dom/jsx/node.js +31 -0
  60. package/dist/module/{subPackages → SubPackages}/react-dom/jsx/web.js +5 -26
  61. package/dist/module/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.js +2 -2
  62. package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/index.js +23 -15
  63. package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/node.js +2 -2
  64. package/dist/module/{subPackages → SubPackages}/react-test-renderer/component/web.js +2 -2
  65. package/dist/module/{subPackages → SubPackages}/react-test-renderer/fc/node.js +3 -3
  66. package/dist/module/{subPackages → SubPackages}/react-test-renderer/fc/web.js +3 -3
  67. package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx/index.js +8 -2
  68. package/dist/module/SubPackages/react-test-renderer/jsx/node.js +5 -0
  69. package/dist/module/SubPackages/react-test-renderer/jsx/web.js +5 -0
  70. package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.js +2 -2
  71. package/dist/module/{subPackages/react-test-renderer/jsx → SubPackages/react-test-renderer/jsx-promised}/node.js +1 -1
  72. package/dist/module/Types.js +30 -1
  73. package/dist/module/Web.js +41 -112
  74. package/dist/module/electron.js +189 -45
  75. package/dist/module/esbuildConfigs/features.js +12 -0
  76. package/dist/module/esbuildConfigs/index.js +18 -0
  77. package/dist/module/esbuildConfigs/node.js +30 -0
  78. package/dist/module/esbuildConfigs/report.js +48 -0
  79. package/dist/module/esbuildConfigs/tests.js +12 -0
  80. package/dist/module/esbuildConfigs/web.js +45 -0
  81. package/dist/module/lib/abstractBase.js +185 -0
  82. package/dist/module/lib/basebuilder.js +82 -0
  83. package/dist/module/lib/browser.js +22 -0
  84. package/dist/module/lib/classBuilder.js +37 -0
  85. package/dist/module/lib/core.js +49 -0
  86. package/dist/module/lib/index.js +15 -0
  87. package/dist/module/nodeWriterElectron.js +52 -0
  88. package/dist/module/preload.js +22 -21
  89. package/dist/module/report.html.js +29 -0
  90. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  91. package/dist/module/web.html.js +20 -0
  92. package/dist/prebuild/Report.css +10326 -0
  93. package/dist/prebuild/Report.js +37456 -0
  94. package/dist/types/Features.d.ts +5 -5
  95. package/dist/types/Node.d.ts +4 -11
  96. package/dist/types/NodeWriter.d.ts +1 -1
  97. package/dist/types/Project.d.ts +2 -27
  98. package/dist/types/SubPackages/puppeteer.d.ts +6 -0
  99. package/dist/types/SubPackages/react/component/node.d.ts +7 -0
  100. package/dist/types/SubPackages/react/component/web.d.ts +7 -0
  101. package/dist/types/SubPackages/react/jsx/index.d.ts +15 -0
  102. package/dist/types/SubPackages/react/jsx/node.d.ts +4 -0
  103. package/dist/types/SubPackages/react/jsx/web.d.ts +4 -0
  104. package/dist/types/{subPackages → SubPackages}/react-dom/component/node.d.ts +2 -4
  105. package/dist/types/SubPackages/react-dom/component/web.d.ts +5 -0
  106. package/dist/types/{subPackages → SubPackages}/react-dom/jsx/index.d.ts +3 -3
  107. package/dist/types/SubPackages/react-dom/jsx/node.d.ts +6 -0
  108. package/dist/types/SubPackages/react-dom/jsx/web.d.ts +5 -0
  109. package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +5 -0
  110. package/dist/types/{subPackages → SubPackages}/react-test-renderer/component/index.d.ts +6 -6
  111. package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +9 -0
  112. package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +4 -0
  113. package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +8 -0
  114. package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +8 -0
  115. package/dist/types/{subPackages → SubPackages}/react-test-renderer/jsx/index.d.ts +5 -4
  116. package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +9 -0
  117. package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +9 -0
  118. package/dist/types/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.d.ts +4 -4
  119. package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +5 -0
  120. package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +5 -0
  121. package/dist/types/Types.d.ts +116 -3
  122. package/dist/types/Web.d.ts +4 -11
  123. package/dist/types/esbuildConfigs/features.d.ts +4 -0
  124. package/dist/types/esbuildConfigs/index.d.ts +4 -0
  125. package/dist/types/esbuildConfigs/node.d.ts +4 -0
  126. package/dist/types/esbuildConfigs/report.d.ts +0 -0
  127. package/dist/types/esbuildConfigs/tests.d.ts +4 -0
  128. package/dist/types/esbuildConfigs/web.d.ts +4 -0
  129. package/dist/types/lib/abstractBase.d.ts +102 -0
  130. package/dist/types/lib/basebuilder.d.ts +24 -0
  131. package/dist/types/lib/browser.d.ts +6 -0
  132. package/dist/types/lib/classBuilder.d.ts +6 -0
  133. package/dist/types/lib/core.d.ts +7 -0
  134. package/dist/types/lib/index.d.ts +57 -0
  135. package/dist/types/nodeWriterElectron.d.ts +2 -0
  136. package/dist/types/report.html.d.ts +2 -0
  137. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  138. package/dist/types/web.html.d.ts +2 -0
  139. package/electronBuild.ts +32 -0
  140. package/index.html +30 -0
  141. package/package.json +120 -85
  142. package/src/Features.ts +2 -4
  143. package/src/Node.ts +114 -160
  144. package/src/NodeWriter.ts +1 -4
  145. package/src/Project.ts +610 -753
  146. package/src/Report.tsx +30 -15
  147. package/src/SubPackages/puppeteer.ts +46 -0
  148. package/src/{subPackages → SubPackages}/react/component/node.ts +12 -32
  149. package/src/SubPackages/react/component/web.ts +53 -0
  150. package/src/SubPackages/react/jsx/index.ts +43 -0
  151. package/src/SubPackages/react/jsx/node.ts +29 -0
  152. package/src/SubPackages/react/jsx/web.ts +28 -0
  153. package/src/{subPackages → SubPackages}/react-dom/component/node.ts +11 -25
  154. package/src/{subPackages → SubPackages}/react-dom/component/web.ts +27 -32
  155. package/src/{subPackages → SubPackages}/react-dom/jsx/index.ts +3 -5
  156. package/src/SubPackages/react-dom/jsx/node.ts +68 -0
  157. package/src/{subPackages → SubPackages}/react-dom/jsx/web.ts +19 -62
  158. package/src/{subPackages → SubPackages}/react-test-renderer/MemoExoticComponent/node.ts +9 -28
  159. package/src/{subPackages → SubPackages}/react-test-renderer/component/index.ts +31 -29
  160. package/src/SubPackages/react-test-renderer/component/node.ts +22 -0
  161. package/src/SubPackages/react-test-renderer/component/web.ts +22 -0
  162. package/src/{subPackages → SubPackages}/react-test-renderer/fc/node.ts +14 -28
  163. package/src/{subPackages → SubPackages}/react-test-renderer/fc/web.ts +9 -25
  164. package/src/{subPackages → SubPackages}/react-test-renderer/jsx/index.ts +19 -16
  165. package/src/SubPackages/react-test-renderer/jsx/node.ts +24 -0
  166. package/src/SubPackages/react-test-renderer/jsx/web.ts +20 -0
  167. package/src/{subPackages → SubPackages}/react-test-renderer/jsx-promised/index.ts +7 -15
  168. package/src/SubPackages/react-test-renderer/jsx-promised/node.ts +19 -0
  169. package/src/SubPackages/react-test-renderer/jsx-promised/web.ts +22 -0
  170. package/src/Types.ts +334 -3
  171. package/src/Web.ts +104 -230
  172. package/src/cjs-shim.js +12 -0
  173. package/src/electron.ts +237 -46
  174. package/src/esbuildConfigs/features.ts +18 -0
  175. package/src/esbuildConfigs/index.ts +22 -0
  176. package/src/esbuildConfigs/node.ts +59 -0
  177. package/src/esbuildConfigs/report.ts +51 -0
  178. package/src/esbuildConfigs/tests.ts +20 -0
  179. package/src/esbuildConfigs/web.ts +73 -0
  180. package/src/lib/abstractBase.ts +459 -0
  181. package/src/lib/basebuilder.ts +253 -0
  182. package/src/lib/browser.ts +34 -0
  183. package/src/lib/classBuilder.ts +137 -0
  184. package/src/lib/core.ts +182 -0
  185. package/src/lib/index.ts +116 -0
  186. package/src/nodeWriterElectron.ts +71 -0
  187. package/src/preload.ts +23 -21
  188. package/src/report.html.ts +29 -0
  189. package/src/web.html.ts +20 -0
  190. package/tests/Rectangle.test.ts +189 -0
  191. package/tsconfig.json +19 -6
  192. package/tsconfig.module.json +15 -4
  193. package/tsconfig.types.json +14 -4
  194. package/yarn-error.log +3144 -0
  195. package/dist/common/core.js +0 -397
  196. package/dist/common/subPackages/react/jsx/index.js +0 -26
  197. package/dist/common/subPackages/react-dom/jsx/node.js +0 -95
  198. package/dist/common/subPackages/react-test-renderer/component/node.js +0 -8
  199. package/dist/common/subPackages/react-test-renderer/component/web.js +0 -8
  200. package/dist/module/Report.js +0 -186
  201. package/dist/module/core.js +0 -388
  202. package/dist/module/subPackages/react/jsx/index.js +0 -22
  203. package/dist/module/subPackages/react/jsx/node.js +0 -5
  204. package/dist/module/subPackages/react/jsx/web.js +0 -5
  205. package/dist/module/subPackages/react-dom/jsx/node.js +0 -87
  206. package/dist/module/subPackages/react-test-renderer/jsx/web.js +0 -5
  207. package/dist/module/subPackages/react-test-renderer/jsx-promised/node.js +0 -5
  208. package/dist/types/core.d.ts +0 -220
  209. package/dist/types/subPackages/react/component/node.d.ts +0 -12
  210. package/dist/types/subPackages/react/component/web.d.ts +0 -12
  211. package/dist/types/subPackages/react/jsx/index.d.ts +0 -15
  212. package/dist/types/subPackages/react/jsx/node.d.ts +0 -4
  213. package/dist/types/subPackages/react/jsx/web.d.ts +0 -4
  214. package/dist/types/subPackages/react-dom/component/web.d.ts +0 -19
  215. package/dist/types/subPackages/react-dom/jsx/node.d.ts +0 -8
  216. package/dist/types/subPackages/react-dom/jsx/web.d.ts +0 -5
  217. package/dist/types/subPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -8
  218. package/dist/types/subPackages/react-test-renderer/component/node.d.ts +0 -9
  219. package/dist/types/subPackages/react-test-renderer/component/web.d.ts +0 -9
  220. package/dist/types/subPackages/react-test-renderer/fc/node.d.ts +0 -9
  221. package/dist/types/subPackages/react-test-renderer/fc/web.d.ts +0 -9
  222. package/dist/types/subPackages/react-test-renderer/jsx/node.d.ts +0 -4
  223. package/dist/types/subPackages/react-test-renderer/jsx/web.d.ts +0 -4
  224. package/dist/types/subPackages/react-test-renderer/jsx-promised/node.d.ts +0 -4
  225. package/dist/types/subPackages/react-test-renderer/jsx-promised/web.d.ts +0 -4
  226. package/src/core.ts +0 -1399
  227. package/src/subPackages/react/component/web.ts +0 -80
  228. package/src/subPackages/react/jsx/index.ts +0 -64
  229. package/src/subPackages/react/jsx/node.ts +0 -29
  230. package/src/subPackages/react/jsx/web.ts +0 -29
  231. package/src/subPackages/react-dom/jsx/node.ts +0 -146
  232. package/src/subPackages/react-test-renderer/component/node.ts +0 -30
  233. package/src/subPackages/react-test-renderer/component/web.ts +0 -30
  234. package/src/subPackages/react-test-renderer/jsx/node.ts +0 -31
  235. package/src/subPackages/react-test-renderer/jsx/web.ts +0 -31
  236. package/src/subPackages/react-test-renderer/jsx-promised/node.ts +0 -31
  237. package/src/subPackages/react-test-renderer/jsx-promised/web.ts +0 -31
  238. /package/dist/common/{subPackages → SubPackages}/react-dom/jsx/index.js +0 -0
  239. /package/dist/common/{subPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
  240. /package/dist/module/{subPackages → SubPackages}/react-dom/jsx/index.js +0 -0
  241. /package/dist/module/{subPackages → SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
@@ -1,27 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
@@ -29,18 +6,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
6
  exports.ITProject = void 0;
30
7
  const esbuild_1 = __importDefault(require("esbuild"));
31
8
  const fs_1 = __importDefault(require("fs"));
32
- const fs_promises_exists_1 = __importDefault(require("fs.promises.exists"));
33
9
  const path_1 = __importDefault(require("path"));
34
- const pm2_1 = __importDefault(require("pm2"));
35
10
  const readline_1 = __importDefault(require("readline"));
36
- const ws_1 = require("ws");
37
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
+ const child_process_1 = __importDefault(require("child_process"));
38
18
  readline_1.default.emitKeypressEvents(process.stdin);
39
19
  if (process.stdin.isTTY)
40
20
  process.stdin.setRawMode(true);
41
- const TIMEOUT = 2000;
42
- const OPEN_PORT = "";
43
- let webSocketServer;
44
21
  const getRunnables = (tests, payload = [new Set(), new Set()]) => {
45
22
  return tests.reduce((pt, cv, cndx, cry) => {
46
23
  if (cv[1] === "node") {
@@ -57,80 +34,9 @@ const getRunnables = (tests, payload = [new Set(), new Set()]) => {
57
34
  };
58
35
  class ITProject {
59
36
  constructor(config) {
60
- this.exitCodes = {};
37
+ var _a;
61
38
  this.mode = `up`;
62
- this.ports = {};
63
- this.websockets = {};
64
- this.resourceQueue = [];
65
- this.spinCycle = 0;
66
- this.spinAnimation = "←↖↑↗→↘↓↙";
67
- this.mainLoop = async () => {
68
- if (this.clearScreen) {
69
- console.clear();
70
- }
71
- const procsTable = [];
72
- pm2_1.default.list((err, procs) => {
73
- procs.forEach((proc) => {
74
- var _a, _b;
75
- procsTable.push({
76
- name: proc.name,
77
- pid: proc.pid,
78
- pm_id: proc.pm_id,
79
- mem: (_a = proc.monit) === null || _a === void 0 ? void 0 : _a.memory,
80
- cpu: (_b = proc.monit) === null || _b === void 0 ? void 0 : _b.cpu,
81
- "exit code": this.exitCodes[proc.name]
82
- });
83
- });
84
- console.table(procsTable);
85
- console.table(this.resourceQueue);
86
- console.log("webSocketServer.clients", Object.keys(this.websockets));
87
- const resourceRequest = this.resourceQueue.pop();
88
- if (!resourceRequest) {
89
- if (!this.devMode && this.mode === "up") {
90
- this.initiateShutdown("resource request queue is empty");
91
- }
92
- if (this.mode === "down" &&
93
- (procsTable.every((p) => p.pid === 0 || p.pid === undefined) ||
94
- procsTable.length === 0)) {
95
- this.shutdown();
96
- }
97
- }
98
- else {
99
- if (resourceRequest.protocol === "ipc") {
100
- this.allocateViaIpc(resourceRequest);
101
- }
102
- else if (resourceRequest.protocol === "ws") {
103
- this.allocateViaWs(resourceRequest);
104
- }
105
- }
106
- const upMessage = "Running tests while watching for changes. Use 'q' to initiate shutdown and `x` to kill.";
107
- const downMessage = "Shutdown is in progress. Please wait.";
108
- if (this.devMode) {
109
- if (this.mode === "up") {
110
- console.log(this.spinner(), upMessage);
111
- }
112
- else {
113
- console.log(this.spinner(), downMessage);
114
- }
115
- }
116
- else {
117
- if (this.mode === "up") {
118
- console.log(this.spinner(), upMessage);
119
- }
120
- else {
121
- console.log(this.spinner(), downMessage);
122
- }
123
- }
124
- });
125
- };
126
- this.clearScreen = config.clearScreen;
127
- this.devMode = config.devMode;
128
- // mark each port as open
129
- Object.values(config.ports).forEach((port) => {
130
- this.ports[port] = OPEN_PORT;
131
- });
132
- const testPath = `${process.cwd()}/${config.tests}`;
133
- const featurePath = `${process.cwd()}/${config.features}`;
39
+ this.config = config;
134
40
  process.stdin.on('keypress', (str, key) => {
135
41
  if (key.name === 'q') {
136
42
  this.initiateShutdown("'q' command");
@@ -142,520 +48,280 @@ class ITProject {
142
48
  process.exit(-1);
143
49
  }
144
50
  });
145
- Promise.resolve().then(() => __importStar(require(testPath))).then((tests) => {
146
- this.tests = tests.default;
147
- Promise.resolve().then(() => __importStar(require(featurePath))).then(async (features) => {
148
- this.features = features.default;
149
- await Promise.resolve(Promise.all([
150
- ...this.getSecondaryEndpointsPoints("web")
151
- ]
152
- .map(async (sourceFilePath) => {
153
- const sourceFileSplit = sourceFilePath.split("/");
154
- const sourceDir = sourceFileSplit.slice(0, -1);
155
- const sourceFileName = sourceFileSplit[sourceFileSplit.length - 1];
156
- const sourceFileNameMinusJs = sourceFileName.split(".").slice(0, -1).join(".");
157
- const htmlFilePath = path_1.default.normalize(`${process.cwd()}/${config.outdir}/${sourceDir.join("/")}/${sourceFileNameMinusJs}.html`);
158
- const jsfilePath = `./${sourceFileNameMinusJs}.mjs`;
159
- return fs_1.default.promises.mkdir(path_1.default.dirname(htmlFilePath), { recursive: true }).then(x => fs_1.default.writeFileSync(htmlFilePath, `
160
- <!DOCTYPE html>
161
- <html lang="en">
162
- <head>
163
- <script type="module" src="${jsfilePath}"></script>
164
- </head>
165
-
166
- <body>
167
- <h1>${htmlFilePath}</h1>
168
- <div id="root">
169
-
170
- </div>
171
- </body>
172
-
173
- <footer></footer>
174
-
175
- </html>
176
- `));
177
- })));
178
- const [nodeEntryPoints, webEntryPoints] = getRunnables(this.tests);
179
- const esbuildConfigNode = {
180
- define: {
181
- "process.env.FLUENTFFMPEG_COV": "0"
182
- },
183
- absWorkingDir: process.cwd(),
184
- banner: {
185
- js: `import { createRequire } from 'module';const require = createRequire(import.meta.url);`
186
- },
187
- target: "esnext",
188
- format: "esm",
189
- splitting: true,
190
- outExtension: { '.js': '.mjs' },
191
- platform: "node",
192
- external: [
193
- "tests.test.js",
194
- "features.test.js", "react"
195
- ],
196
- outbase: config.outbase,
197
- outdir: config.outdir,
198
- jsx: 'transform',
199
- entryPoints: [...nodeEntryPoints],
200
- bundle: true,
201
- minify: config.minify === true,
202
- write: true,
203
- loader: {
204
- '.js': 'jsx',
205
- '.png': 'binary',
206
- '.jpg': 'binary',
207
- },
208
- plugins: [
209
- ...(config.nodePlugins || []),
210
- {
211
- name: 'rebuild-notify',
212
- setup(build) {
213
- build.onEnd(result => {
214
- console.log(`node build ended with ${result.errors.length} errors`);
215
- console.log(result);
216
- result.errors.length !== 0 && process.exit(-1);
217
- });
218
- }
219
- },
220
- ],
221
- };
222
- const esbuildConfigWeb = {
223
- target: "esnext",
224
- format: "esm",
225
- splitting: true,
226
- outExtension: { '.js': '.mjs' },
227
- alias: {
228
- react: path_1.default.resolve("./node_modules/react")
229
- },
230
- external: [
231
- "tests.test.js",
232
- "features.test.js",
233
- // "url",
234
- // "react",
235
- "electron",
236
- "path",
237
- "fs",
238
- "stream",
239
- ],
240
- platform: "browser",
241
- outbase: config.outbase,
242
- outdir: config.outdir,
243
- jsx: 'transform',
244
- entryPoints: [
245
- ...webEntryPoints,
246
- testPath,
247
- featurePath,
248
- ],
249
- bundle: true,
250
- minify: config.minify === true,
251
- write: true,
252
- loader: {
253
- '.js': 'jsx',
254
- '.png': 'binary',
255
- '.jpg': 'binary',
256
- },
257
- plugins: [
258
- ...(config.webPlugins || []),
259
- {
260
- name: 'rebuild-notify',
261
- setup(build) {
262
- build.onEnd(result => {
263
- console.log(`web build ended with ${result.errors.length} errors`);
264
- console.log(result);
265
- result.errors.length !== 0 && process.exit(-1);
266
- });
267
- }
268
- },
269
- ],
270
- };
271
- (0, glob_1.glob)('./dist/chunk-*.mjs', { ignore: 'node_modules/**' }).then((chunks) => {
272
- console.log("deleting chunks", chunks);
273
- chunks.forEach((chunk) => {
274
- console.log("deleting chunk", chunk);
275
- fs_1.default.unlinkSync(chunk);
276
- });
277
- });
278
- esbuild_1.default.build({
279
- bundle: true,
280
- entryPoints: ["./node_modules/testeranto/dist/module/Report.js"],
281
- minify: config.minify === true,
282
- outbase: config.outbase,
283
- write: true,
284
- outfile: `${config.outdir}/Report.js`,
285
- external: ["tests.test.js", "features.test.js"]
286
- });
287
- fs_1.default.writeFileSync(`${config.outdir}/report.html`, `
288
- <!DOCTYPE html>
289
- <html lang="en">
290
-
291
- <head>
292
- <meta name="description" content="Webpage description goes here" />
293
- <meta charset="utf-8" />
294
- <title>kokomoBay - testeranto</title>
295
- <meta name="viewport" content="width=device-width, initial-scale=1" />
296
- <meta name="author" content="" />
297
- <link rel="stylesheet" href="./Report.css" />
298
-
299
- <script type="importmap">
300
- {
301
- "imports": {
302
- "tests.test.js": "./tests.test.js",
303
- "features.test.js": "./features.test.js"
304
- }
305
- }
306
- </script>
307
-
308
-
309
- <script src="./Report.js"></script>
310
- </head>
311
-
312
- <body>
313
- <div id="root">
314
- react is loading
315
- </div>
316
- </body>
317
-
318
- </html>
319
- `);
320
- Promise.all([
321
- esbuild_1.default.context(esbuildConfigNode)
322
- .then(async (nodeContext) => {
323
- await nodeContext.watch();
324
- }),
325
- esbuild_1.default.context(esbuildConfigWeb)
326
- .then(async (esbuildWeb) => {
327
- await esbuildWeb.watch();
328
- })
329
- ]).then(() => {
330
- if (config.devMode === false) {
331
- console.log("Your tests were built but not run because devMode was false. Exiting gracefully");
332
- process.exit(0);
333
- }
334
- else {
335
- pm2_1.default.connect(async (err) => {
336
- if (err) {
337
- console.error(err);
338
- process.exit(-1);
339
- }
340
- else {
341
- console.log(`pm2 is connected`);
342
- }
343
- // run a websocket as an alternative to node IPC
344
- webSocketServer = new ws_1.WebSocketServer({
345
- port: 8080,
346
- host: "localhost",
347
- });
348
- webSocketServer.on('open', () => {
349
- console.log('open');
350
- });
351
- webSocketServer.on('close', (data) => {
352
- console.log('webSocketServer close: %s', data);
353
- });
354
- webSocketServer.on('listening', () => {
355
- console.log("webSocketServer listening", webSocketServer.address());
356
- });
357
- webSocketServer.on('connection', (webSocket) => {
358
- webSocket.on('message', (webSocketData) => {
359
- const payload = JSON.parse(webSocketData.valueOf().toString());
360
- const messageType = payload.type;
361
- if (messageType === "testeranto:hola") {
362
- const name = payload.data.requirement.name;
363
- const requestedResources = payload.data;
364
- this.websockets[name] = webSocket;
365
- console.log('hola WS! connected: ' + name + ' in ' + Object.getOwnPropertyNames(this.websockets));
366
- this.requestResource(requestedResources.requirement, 'ws');
367
- }
368
- else if (messageType === "testeranto:adios") {
369
- console.log("adios WS", payload.data.testResourceConfiguration.name);
370
- this.releaseTestResourceWs(payload);
371
- }
372
- });
373
- });
374
- const makePath = (fPath, rt) => {
375
- return path_1.default.resolve("./" + config.outdir + "/" + fPath.replace(path_1.default.extname(fPath), "") + ".mjs");
376
- };
377
- const bootInterval = setInterval(async () => {
378
- const filesToLookup = this.tests
379
- .map(([p, rt]) => {
380
- const filepath = makePath(p, rt);
381
- return {
382
- filepath,
383
- exists: (0, fs_promises_exists_1.default)(filepath),
384
- };
385
- });
386
- const allFilesExist = (await Promise.all(filesToLookup.map((f) => f.exists))).every((b) => b);
387
- if (!allFilesExist) {
388
- console.log(this.spinner(), "waiting for files to build...");
389
- filesToLookup.forEach((f) => {
390
- console.log(f.exists, "\t", f.filepath);
391
- });
392
- }
393
- else {
394
- clearInterval(bootInterval);
395
- pm2_1.default.launchBus((err, pm2_bus) => {
396
- pm2_bus.on("testeranto:hola", (packet) => {
397
- this.requestResource(packet.data.requirement, 'ipc');
398
- });
399
- pm2_bus.on("testeranto:adios", (payload) => {
400
- this.releaseTestResourcePm2(payload.data);
401
- });
402
- });
403
- this
404
- .tests
405
- .reduce((m, [inputFilePath, runtime]) => {
406
- const script = makePath(inputFilePath, runtime);
407
- const partialTestResourceByCommandLineArg = `${script} '${JSON.stringify({
408
- name: inputFilePath,
409
- ports: [],
410
- fs: path_1.default.resolve(process.cwd(), config.outdir, inputFilePath),
411
- })}'`;
412
- if (runtime === "web") {
413
- const fileAsList = inputFilePath.split("/");
414
- const fileListHead = fileAsList.slice(0, -1);
415
- const fname = fileAsList[fileAsList.length - 1];
416
- const fnameOnly = fname.split(".").slice(0, -1).join(".");
417
- const htmlFile = [config.outdir, ...fileListHead, `${fnameOnly}.html`].join("/");
418
- const jsFile = path_1.default.resolve(htmlFile.split(".html")[0] + ".mjs");
419
- console.log("watching", jsFile);
420
- pm2_1.default.start({
421
- script: `yarn electron node_modules/testeranto/dist/common/electron.js ${htmlFile} '${JSON.stringify({
422
- scheduled: true,
423
- name: inputFilePath,
424
- ports: [],
425
- fs: path_1.default.resolve(process.cwd(), config.outdir, inputFilePath),
426
- })}'`,
427
- name: inputFilePath,
428
- autorestart: false,
429
- args: partialTestResourceByCommandLineArg,
430
- watch: [jsFile],
431
- }, (err, proc) => {
432
- if (err) {
433
- console.error(err);
434
- return pm2_1.default.disconnect();
435
- }
436
- });
437
- }
438
- else if (runtime === "node") {
439
- const resolvedPath = path_1.default.resolve(script);
440
- console.log("watching", resolvedPath);
441
- pm2_1.default.start({
442
- name: inputFilePath,
443
- script: `node ${resolvedPath} '${JSON.stringify({
444
- scheduled: true,
445
- name: inputFilePath,
446
- ports: [],
447
- fs: path_1.default.resolve(process.cwd(), config.outdir, inputFilePath),
448
- })}'`,
449
- autorestart: false,
450
- watch: [resolvedPath],
451
- args: partialTestResourceByCommandLineArg
452
- }, (err, proc) => {
453
- if (err) {
454
- console.error(err);
455
- return pm2_1.default.disconnect();
456
- }
457
- });
458
- }
459
- this.exitCodes[inputFilePath] = null;
460
- return [inputFilePath, ...m];
461
- }, []);
462
- setInterval(this.mainLoop, TIMEOUT).unref();
463
- }
464
- }, TIMEOUT).unref();
465
- });
466
- }
467
- });
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) => {
61
+ const sourceFileSplit = sourceFilePath.split("/");
62
+ const sourceDir = sourceFileSplit.slice(0, -1);
63
+ const sourceFileName = sourceFileSplit[sourceFileSplit.length - 1];
64
+ const sourceFileNameMinusJs = sourceFileName.split(".").slice(0, -1).join(".");
65
+ const htmlFilePath = path_1.default.normalize(`${process.cwd()}/${config.outdir}/web/${sourceDir.join("/")}/${sourceFileNameMinusJs}.html`);
66
+ 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)));
68
+ })));
69
+ 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);
72
+ chunks.forEach((chunk) => {
73
+ console.log("deleting chunk", chunk);
74
+ fs_1.default.unlinkSync(chunk);
468
75
  });
469
76
  });
470
- }
471
- requestResource(requirement, protocol) {
472
- this.resourceQueue.push({ requirement, protocol });
473
- }
474
- getSecondaryEndpointsPoints(runtime) {
475
- if (runtime) {
476
- return this.tests
477
- .filter((t) => {
478
- return (t[1] === runtime);
479
- })
480
- .map((tc) => tc[0]);
481
- }
482
- return this.tests
483
- .map((tc) => tc[0]);
484
- }
485
- initiateShutdown(reason) {
486
- console.log("Shutdown initiated because", reason);
487
- this.mode = "down";
488
- }
489
- shutdown() {
490
- let i = 0;
491
- new Promise((res, reh) => {
492
- console.log("final results: ");
493
- const procsTable = [];
494
- pm2_1.default.list((err, procs) => {
495
- procs.forEach((proc, ndx) => {
496
- const exitCode = this.exitCodes[proc.name];
497
- if (exitCode !== 0) {
498
- i++;
499
- }
500
- procsTable.push({
501
- name: proc.name,
502
- pm_id: proc.pm_id,
503
- exitCode
504
- });
505
- if (ndx === procs.length - 1) {
506
- console.table(procsTable);
507
- res(i);
508
- }
509
- });
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");
79
+ fs_1.default.writeFileSync(`${config.outdir}/report.html`, (0, report_html_js_1.default)());
80
+ Promise.all([
81
+ esbuild_1.default.context((0, features_js_1.default)(config))
82
+ .then(async (featuresContext) => {
83
+ console.log("features entry points", config.features);
84
+ await featuresContext.watch();
85
+ return featuresContext;
86
+ }),
87
+ esbuild_1.default.context((0, node_js_1.default)(config, nodeEntryPoints))
88
+ .then(async (nodeContext) => {
89
+ console.log("node entry points", nodeEntryPoints);
90
+ await nodeContext.watch();
91
+ return nodeContext;
92
+ }),
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;
98
+ }),
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));
510
110
  });
511
- }).then((failures) => {
512
- pm2_1.default.stop("all", (e) => console.error(e));
513
- pm2_1.default.disconnect();
514
- console.log(`gracefully exiting with ${failures} failures`);
515
- process.exit(failures);
516
- });
517
- }
518
- spinner() {
519
- this.spinCycle = (this.spinCycle + 1) % this.spinAnimation.length;
520
- return this.spinAnimation[this.spinCycle];
521
- }
522
- async releaseTestResourceWs(payload) {
523
- const name = payload.data.testResourceConfiguration.name;
524
- const failed = payload.data.failed;
525
- this.exitCodes[name] = failed;
526
- Object.keys(this.ports).forEach((port) => {
527
- if (this.ports[port] === name) {
528
- this.ports[port] = OPEN_PORT;
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
529
117
  }
530
118
  });
531
119
  }
532
- async releaseTestResourcePm2(payload) {
533
- const name = payload.testResourceConfiguration.name;
534
- const failed = payload.failed;
535
- this.exitCodes[name] = failed;
536
- pm2_1.default.list((err, processes) => {
537
- processes.forEach((proc) => {
538
- if (proc.name === name) {
539
- Object.keys(this.ports).forEach((port) => {
540
- if (this.ports[port] === name) {
541
- this.ports[port] = OPEN_PORT;
542
- }
543
- });
544
- }
545
- });
546
- });
547
- }
548
- allocateViaWs(resourceRequest) {
549
- const name = resourceRequest.requirement.name;
550
- const testResourceRequirement = resourceRequest.requirement;
551
- const websocket = this.websockets[name];
552
- if ((testResourceRequirement === null || testResourceRequirement === void 0 ? void 0 : testResourceRequirement.ports) === 0) {
553
- websocket.send(JSON.stringify({
554
- data: {
555
- testResourceConfiguration: {
556
- ports: [],
557
- },
120
+ getSecondaryEndpointsPoints(runtime) {
121
+ const meta = (ts, st) => {
122
+ ts.forEach((t) => {
123
+ if (t[1] === runtime) {
124
+ st.add(t[0]);
558
125
  }
559
- }));
560
- }
561
- else if (((testResourceRequirement === null || testResourceRequirement === void 0 ? void 0 : testResourceRequirement.ports) || 0) > 0) {
562
- // clear any port-slots associated with this job
563
- Object.values(this.ports).forEach((jobMaybe, portNumber) => {
564
- if (jobMaybe && jobMaybe === name) {
565
- this.ports[portNumber] = OPEN_PORT;
126
+ if (Array.isArray(t[2])) {
127
+ meta(t[2], st);
566
128
  }
567
129
  });
568
- // find a list of open ports
569
- const foundOpenPorts = Object.keys(this.ports).filter((p) => this.ports[p] === OPEN_PORT);
570
- if (foundOpenPorts.length >= testResourceRequirement.ports) {
571
- const selectionOfPorts = foundOpenPorts.slice(0, testResourceRequirement.ports);
572
- websocket.send(JSON.stringify({
573
- data: {
574
- testResourceConfiguration: {
575
- ports: selectionOfPorts,
576
- },
577
- }
578
- }));
579
- // mark the selected ports as occupied
580
- for (const foundOpenPort of selectionOfPorts) {
581
- this.ports[foundOpenPort] = name;
582
- }
583
- }
584
- else {
585
- console.log(`no port was open so send the ${name} job to the back of the resourceQueue`);
586
- this.resourceQueue.push(resourceRequest);
587
- }
588
- }
130
+ return st;
131
+ };
132
+ return Array.from(meta(this.config.tests, new Set()));
589
133
  }
590
- allocateViaIpc(resourceRequest) {
591
- const pName = resourceRequest.requirement.name;
592
- const testResourceRequirement = resourceRequest.requirement;
593
- pm2_1.default.list((err, processes) => {
594
- console.error(err);
595
- processes.forEach((p) => {
596
- if (p.name === pName && p.pid) {
597
- const message = {
598
- // these fields must be present
599
- id: p.pid,
600
- topic: "some topic",
601
- type: "process:msg",
602
- // Data to be sent
603
- data: {
604
- testResourceConfiguration: {
605
- ports: [],
606
- // fs: fPath,
607
- },
608
- id: p.pm_id,
609
- },
610
- };
611
- if ((testResourceRequirement === null || testResourceRequirement === void 0 ? void 0 : testResourceRequirement.ports) === 0) {
612
- pm2_1.default.sendDataToProcessId(p.pm_id, message, function (err, res) {
613
- // console.log("sendDataToProcessId", err, res, message);
614
- });
615
- }
616
- if (((testResourceRequirement === null || testResourceRequirement === void 0 ? void 0 : testResourceRequirement.ports) || 0) > 0) {
617
- // clear any port-slots associated with this job
618
- Object.values(this.ports).forEach((jobMaybe, portNumber) => {
619
- if (jobMaybe && jobMaybe === pName) {
620
- this.ports[portNumber] = OPEN_PORT;
621
- }
622
- });
623
- // find a list of open ports
624
- const foundOpenPorts = Object.keys(this.ports).filter((p) => this.ports[p] === OPEN_PORT);
625
- // if there are enough open port-slots...
626
- if (foundOpenPorts.length >= testResourceRequirement.ports) {
627
- const selectionOfPorts = foundOpenPorts.slice(0, testResourceRequirement.ports);
628
- const message = {
629
- // these fields must be present
630
- id: p.pid,
631
- topic: "some topic",
632
- // process:msg will be send as 'message' on target process
633
- type: "process:msg",
634
- // Data to be sent
635
- data: {
636
- testResourceConfiguration: {
637
- // fs: fPath,
638
- ports: selectionOfPorts,
639
- },
640
- id: p.pid,
641
- },
642
- };
643
- pm2_1.default.sendDataToProcessId(p.pm_id, message, function (err, res) {
644
- // no-op
645
- });
646
- // mark the selected ports as occupied
647
- for (const foundOpenPort of selectionOfPorts) {
648
- this.ports[foundOpenPort] = p.pid.toString();
649
- }
650
- }
651
- else {
652
- console.log(`no port was open so send the ${p.pid} job to the back of the resourceQueue`);
653
- this.resourceQueue.push(resourceRequest);
654
- }
655
- }
656
- }
657
- });
658
- });
134
+ initiateShutdown(reason) {
135
+ console.log("Shutdown initiated because", reason);
136
+ this.mode = "down";
659
137
  }
660
138
  }
661
139
  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
+ //