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
@@ -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,633 +6,159 @@ 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
+ var mode = process.argv[2] === "-dev" ? "DEV" : "PROD";
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
- const getRunnables = (tests, payload = [new Set(), new Set()]) => {
45
- return tests.reduce((pt, cv, cndx, cry) => {
46
- if (cv[1] === "node") {
47
- pt[0].add(cv[0]);
48
- }
49
- else if (cv[1] === "web") {
50
- pt[1].add(cv[0]);
51
- }
52
- if (cv[2].length) {
53
- getRunnables(cv[2], payload);
54
- }
55
- return pt;
56
- }, 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
+ }
57
59
  };
58
60
  class ITProject {
59
61
  constructor(config) {
60
- this.exitCodes = {};
61
62
  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
- }
63
+ this.config = config;
64
+ Promise.resolve(Promise.all([...this.getSecondaryEndpointsPoints("web")].map(async (sourceFilePath) => {
65
+ const sourceFileSplit = sourceFilePath.split("/");
66
+ const sourceDir = sourceFileSplit.slice(0, -1);
67
+ const sourceFileName = sourceFileSplit[sourceFileSplit.length - 1];
68
+ const sourceFileNameMinusJs = sourceFileName
69
+ .split(".")
70
+ .slice(0, -1)
71
+ .join(".");
72
+ const htmlFilePath = path_1.default.normalize(`${process.cwd()}/${config.outdir}/web/${sourceDir.join("/")}/${sourceFileNameMinusJs}.html`);
73
+ const jsfilePath = `./${sourceFileNameMinusJs}.mjs`;
74
+ return fs_1.default.promises
75
+ .mkdir(path_1.default.dirname(htmlFilePath), { recursive: true })
76
+ .then((x) => fs_1.default.writeFileSync(htmlFilePath, (0, web_html_js_1.default)(jsfilePath, htmlFilePath)));
77
+ })));
78
+ const [nodeEntryPoints, webEntryPoints] = getRunnables(this.config.tests);
79
+ (0, glob_1.glob)(`./${config.outdir}/chunk-*.mjs`, { ignore: "node_modules/**" }).then((chunks) => {
80
+ chunks.forEach((chunk) => {
81
+ fs_1.default.unlinkSync(chunk);
82
+ });
83
+ });
84
+ fs_1.default.copyFileSync("./node_modules/testeranto/dist/prebuild/Report.js", "./docs/Report.js");
85
+ fs_1.default.copyFileSync("./node_modules/testeranto/dist/prebuild/Report.css", "./docs/Report.css");
86
+ fs_1.default.writeFileSync(`${config.outdir}/report.html`, (0, report_html_js_1.default)());
87
+ Promise.all([
88
+ fs_1.default.promises.writeFile(`${config.outdir}/testeranto.json`, JSON.stringify(Object.assign(Object.assign({}, config), { buildDir: process.cwd() + "/" + config.outdir }), null, 2)),
89
+ esbuild_1.default
90
+ .context((0, features_js_1.default)(config))
91
+ .then(async (featuresContext) => {
92
+ if (mode == "DEV") {
93
+ await featuresContext.watch();
94
+ onFeaturesDone();
97
95
  }
98
96
  else {
99
- if (resourceRequest.protocol === "ipc") {
100
- this.allocateViaIpc(resourceRequest);
101
- }
102
- else if (resourceRequest.protocol === "ws") {
103
- this.allocateViaWs(resourceRequest);
104
- }
97
+ featuresContext.rebuild().then((v) => {
98
+ onFeaturesDone();
99
+ });
105
100
  }
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
- }
101
+ return featuresContext;
102
+ }),
103
+ esbuild_1.default
104
+ .context((0, node_js_1.default)(config, nodeEntryPoints))
105
+ .then(async (nodeContext) => {
106
+ if (mode == "DEV") {
107
+ await nodeContext.watch().then((v) => {
108
+ onNodeDone();
109
+ });
115
110
  }
116
111
  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}`;
134
- process.stdin.on('keypress', (str, key) => {
135
- if (key.name === 'q') {
136
- this.initiateShutdown("'q' command");
137
- }
138
- });
139
- process.stdin.on('keypress', (str, key) => {
140
- if (key.name === 'x') {
141
- console.log("Shutting down hard!");
142
- process.exit(-1);
143
- }
144
- });
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);
112
+ nodeContext.rebuild().then((v) => {
113
+ onNodeDone();
276
114
  });
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
- });
468
- });
469
- });
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
115
+ }
116
+ return nodeContext;
117
+ }),
118
+ esbuild_1.default
119
+ .context((0, web_js_1.default)(config, webEntryPoints))
120
+ .then(async (webContext) => {
121
+ if (mode == "DEV") {
122
+ await webContext.watch().then((v) => {
123
+ onWebDone();
504
124
  });
505
- if (ndx === procs.length - 1) {
506
- console.table(procsTable);
507
- res(i);
508
- }
509
- });
510
- });
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;
529
- }
530
- });
531
- }
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
- }
125
+ }
126
+ else {
127
+ webContext.rebuild().then((v) => {
128
+ onWebDone();
543
129
  });
544
130
  }
545
- });
546
- });
131
+ return webContext;
132
+ }),
133
+ ]);
547
134
  }
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
- },
558
- }
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;
566
- }
567
- });
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;
135
+ getSecondaryEndpointsPoints(runtime) {
136
+ const meta = (ts, st) => {
137
+ ts.forEach((t) => {
138
+ if (t[1] === runtime) {
139
+ st.add(t[0]);
582
140
  }
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
- }
589
- }
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
- }
141
+ if (Array.isArray(t[2])) {
142
+ meta(t[2], st);
656
143
  }
657
144
  });
658
- });
145
+ return st;
146
+ };
147
+ return Array.from(meta(this.config.tests, new Set()));
659
148
  }
660
149
  }
661
150
  exports.ITProject = ITProject;
151
+ const getRunnables = (tests, payload = [new Set(), new Set()]) => {
152
+ return tests.reduce((pt, cv, cndx, cry) => {
153
+ if (cv[1] === "node") {
154
+ pt[0].add(cv[0]);
155
+ }
156
+ else if (cv[1] === "web") {
157
+ pt[1].add(cv[0]);
158
+ }
159
+ if (cv[2].length) {
160
+ getRunnables(cv[2], payload);
161
+ }
162
+ return pt;
163
+ }, payload);
164
+ };