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