testeranto 0.200.1 → 0.203.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 (740) hide show
  1. package/README.md +49 -1
  2. package/UX/chache/index.md +11 -0
  3. package/design-editor/DesignEditor.tsx +40 -241
  4. package/dist/prebuild/App.css +171 -120
  5. package/dist/prebuild/App.js +47117 -11727
  6. package/dist/prebuild/testeranto.mjs +5048 -2578
  7. package/example/Calculator.go +63 -0
  8. package/example/Calculator.golingvu.adapter.go +81 -0
  9. package/example/Calculator.golingvu.go +67 -0
  10. package/example/Calculator.golingvu.implementation.go +95 -0
  11. package/example/Calculator.golingvu.specification.go +68 -0
  12. package/example/Calculator.pitono.adapter.py +68 -0
  13. package/example/Calculator.pitono.implementation.py +30 -0
  14. package/example/Calculator.pitono.specification.py +154 -0
  15. package/example/Calculator.pitono.test.py +47 -0
  16. package/example/Calculator.py +93 -0
  17. package/example/Calculator.test.adapter.ts +86 -0
  18. package/example/Calculator.test.implementation.ts +82 -0
  19. package/example/Calculator.test.specification.ts +213 -0
  20. package/example/Calculator.test.ts +13 -0
  21. package/example/Calculator.test.types.ts +50 -0
  22. package/example/Calculator.ts +130 -0
  23. package/example/README.md +1 -0
  24. package/example/base_suite_test.go +51 -0
  25. package/example/cmd/main.go +16 -0
  26. package/example/go.mod +9 -0
  27. package/example/main +0 -0
  28. package/example/test_example.py +143 -74
  29. package/example/testeranto/bundles/golang/core/Calculator.golingvu.go +53 -0
  30. package/example/testeranto/metafiles/golang/core.json +198 -0
  31. package/git-integration-plan.md +395 -0
  32. package/go.mod +3 -1
  33. package/golingvu.tmp.txt +68 -0
  34. package/log.txt +85 -0
  35. package/package.json +67 -46
  36. package/scripts/build-example.ts +245 -0
  37. package/src/App.tsx +226 -25
  38. package/src/Helpo.tsx +89 -0
  39. package/src/PM/PM_WithBuild.ts +183 -0
  40. package/src/PM/PM_WithEslintAndTsc.ts +109 -86
  41. package/src/PM/PM_WithGit.ts +632 -0
  42. package/src/PM/PM_WithHelpo.ts +341 -0
  43. package/src/PM/PM_WithProcesses.ts +900 -0
  44. package/src/PM/PM_WithWebSocket.ts +839 -0
  45. package/src/PM/base.ts +63 -1
  46. package/src/PM/golingvuBuild.ts +56 -0
  47. package/src/PM/index.ts +8 -5
  48. package/src/PM/main.ts +735 -1981
  49. package/src/PM/node.ts +18 -18
  50. package/src/PM/pitonoBuild.ts +56 -0
  51. package/src/PM/pure.ts +5 -13
  52. package/src/PM/types.ts +145 -0
  53. package/src/PM/utils.ts +262 -0
  54. package/src/PM/web.ts +8 -8
  55. package/src/README.md +122 -0
  56. package/src/ReportServer.ts +0 -12
  57. package/src/ReportServerLib.ts +0 -147
  58. package/src/Types.ts +1 -0
  59. package/src/app.scss +92 -140
  60. package/src/components/pure/AppFrame.tsx +354 -78
  61. package/src/components/pure/ArtifactTree.tsx +82 -0
  62. package/src/components/pure/BuildLogViewer.tsx +168 -0
  63. package/src/components/pure/DebugEnv.tsx +30 -0
  64. package/src/components/pure/FileTree.tsx +58 -0
  65. package/src/components/pure/FileTreeItem.tsx +49 -0
  66. package/src/components/pure/GitHubLoginButton.tsx +31 -0
  67. package/src/components/pure/GitIntegrationView.tsx +732 -0
  68. package/src/components/pure/HelpoChatDrawer.tsx +222 -0
  69. package/src/components/pure/MagicRobotModal.tsx +136 -0
  70. package/src/components/pure/ProcessDetails.tsx +99 -0
  71. package/src/components/pure/ProcessInput.tsx +67 -0
  72. package/src/components/pure/ProcessList.tsx +89 -0
  73. package/src/components/pure/ProcessLogs.tsx +54 -0
  74. package/src/components/pure/ProcessManager.tsx +38 -46
  75. package/src/components/pure/ProcessManagerView.tsx +44 -373
  76. package/src/components/pure/ProcessManagerViewTypes.ts +10 -0
  77. package/src/components/pure/ProcessSidebar.tsx +88 -0
  78. package/src/components/pure/ProcessTerminal.tsx +51 -0
  79. package/src/components/pure/ProjectPageView.tsx +6 -224
  80. package/src/components/pure/Settings.test.tsx +34 -0
  81. package/src/components/pure/Settings.tsx +163 -0
  82. package/src/components/pure/SignIn.tsx +33 -0
  83. package/src/components/pure/SingleProcessView.tsx +85 -180
  84. package/src/components/pure/TerminalInput.tsx +73 -0
  85. package/src/components/pure/TerminalLogs.tsx +80 -0
  86. package/src/components/pure/TestPageView.test/specification.ts +1 -0
  87. package/src/components/pure/TestPageView.tsx +308 -912
  88. package/src/components/pure/TestPageView_utils.tsx +287 -0
  89. package/src/components/pure/TestTable.tsx +88 -0
  90. package/src/components/pure/ToastNotification.tsx +19 -0
  91. package/src/components/pure/UserProfile.tsx +44 -0
  92. package/src/components/stateful/AuthCallbackPage.tsx +21 -0
  93. package/src/components/stateful/DratoPage.tsx +457 -0
  94. package/src/components/stateful/FeaturesReporter.tsx +3 -1
  95. package/src/components/stateful/FileTree.tsx +58 -58
  96. package/src/components/stateful/GenericXMLEditor/AttributeEditor.tsx +87 -0
  97. package/src/components/stateful/GenericXMLEditor/Drawer.tsx +174 -0
  98. package/src/components/stateful/GenericXMLEditor/GenericPreview.tsx +160 -0
  99. package/src/components/stateful/GenericXMLEditor/GenericTextEditor.tsx +104 -0
  100. package/src/components/stateful/GenericXMLEditor/GenericTree.tsx +104 -0
  101. package/src/components/stateful/GenericXMLEditorPage.tsx +346 -0
  102. package/src/components/stateful/GitIntegrationPage.tsx +263 -0
  103. package/src/components/stateful/GrafeoPage.tsx +563 -0
  104. package/src/components/stateful/ProcessManagerPage.tsx +13 -17
  105. package/src/components/stateful/ProjectPage.tsx +6 -5
  106. package/src/components/stateful/ProjectsPage.tsx +17 -19
  107. package/src/components/stateful/SVGEditor/CircleForm.tsx +68 -0
  108. package/src/components/stateful/SVGEditor/GroupForm.tsx +56 -0
  109. package/src/components/stateful/SVGEditor/RectForm.tsx +74 -0
  110. package/src/components/stateful/SVGEditor/SVGAttributeField.tsx +29 -0
  111. package/src/components/stateful/SVGEditor/SVGAttributesEditor.tsx +91 -0
  112. package/src/components/stateful/SVGEditor/SVGEditorControls.tsx +45 -0
  113. package/src/components/stateful/SVGEditor/SVGElementForm.tsx +45 -0
  114. package/src/components/stateful/SVGEditor/SVGPreview.tsx +227 -0
  115. package/src/components/stateful/SVGEditor/SVGTextEditor.tsx +166 -0
  116. package/src/components/stateful/SVGEditor/SVGTree.tsx +159 -0
  117. package/src/components/stateful/SVGEditor/SVGTypes.ts +36 -0
  118. package/src/components/stateful/SVGEditor/svg.xsd.xml +3038 -0
  119. package/src/components/stateful/SVGEditorPage.tsx +517 -0
  120. package/src/components/stateful/SingleProcessPage.tsx +133 -144
  121. package/src/components/stateful/SkriboPage.tsx +765 -0
  122. package/src/components/stateful/TestPage.tsx +27 -23
  123. package/src/esbuildConfigs/node.ts +1 -1
  124. package/src/example/go.mod +9 -0
  125. package/src/example/main.go +61 -0
  126. package/src/golingvu/PM/golang_test.go +103 -0
  127. package/src/golingvu/README.md +186 -2
  128. package/src/golingvu/base_given.go +89 -2
  129. package/src/golingvu/base_suite.go +48 -2
  130. package/src/golingvu/go.mod +6 -0
  131. package/src/golingvu/golingvu.go +724 -14
  132. package/src/golingvu/types.go +0 -14
  133. package/src/helpo/directives.md +5 -0
  134. package/src/helpo/prompt.txt +38 -0
  135. package/src/hooks/useGitMode.ts +20 -0
  136. package/src/hooks/useTerminalWebSocket.ts +49 -0
  137. package/src/lib/BaseGiven.ts +126 -28
  138. package/src/lib/BaseSuite.test/mock.ts +16 -10
  139. package/src/lib/BaseSuite.test/test.ts +165 -207
  140. package/src/lib/BaseSuite.ts +52 -10
  141. package/src/lib/BaseThen.ts +34 -38
  142. package/src/lib/BaseWhen.ts +9 -2
  143. package/src/lib/Tiposkripto.test/MockTiposkripto.ts +178 -14
  144. package/src/lib/Tiposkripto.test/Tiposkripto.adapter.ts +9 -14
  145. package/src/lib/Tiposkripto.test/Tiposkripto.implementation.ts +78 -38
  146. package/src/lib/Tiposkripto.test/Tiposkripto.specification.ts +51 -8
  147. package/src/lib/Tiposkripto.test/Tiposkripto.types.ts +5 -0
  148. package/src/lib/Tiposkripto.ts +64 -7
  149. package/src/lib/index.ts +7 -0
  150. package/src/lib/pmProxy.test/specification.ts +168 -166
  151. package/src/lib/pmProxy.ts +55 -18
  152. package/src/pitono/PM/python.py +165 -0
  153. package/src/pitono/Pitono.py +298 -0
  154. package/src/pitono/PitonoTest.py +25 -0
  155. package/src/pitono/README.md +21 -0
  156. package/src/pitono/__init__.py +6 -0
  157. package/{pitono → src/pitono}/base_given.py +42 -20
  158. package/{pitono → src/pitono}/base_suite.py +55 -2
  159. package/{pitono → src/pitono}/base_then.py +15 -1
  160. package/{pitono → src/pitono}/base_when.py +15 -1
  161. package/{pitono → src/pitono}/pitono.egg-info/PKG-INFO +25 -0
  162. package/{pitono → src/pitono}/pitono.egg-info/SOURCES.txt +1 -0
  163. package/src/pitono/types.py +87 -0
  164. package/src/services/FileService.ts +677 -0
  165. package/src/services/GitHubAuthService.ts +240 -0
  166. package/src/testeranto.ts +133 -245
  167. package/src/utils/api.ts +15 -13
  168. package/src/utils/gitTest.ts +29 -0
  169. package/src/utils/golingvuMetafile.ts +822 -118
  170. package/src/utils/golingvuWatcher.ts +285 -0
  171. package/src/utils/logFiles.ts +10 -2
  172. package/src/utils/makePrompt.ts +12 -1
  173. package/src/utils/pitonoMetafile.ts +326 -54
  174. package/src/utils/pitonoWatcher.ts +157 -0
  175. package/src/utils.ts +21 -12
  176. package/testeranto/App.css +171 -120
  177. package/testeranto/App.js +47117 -11727
  178. package/testeranto/bundles/node/core/chunk-MJTSYIAQ.mjs +1099 -0
  179. package/testeranto/bundles/node/core/src/lib/BaseSuite.test/node.test.mjs +58 -1147
  180. package/testeranto/bundles/node/core/src/lib/TipoSkripto.test/TipoSkripto.mjs +572 -0
  181. package/testeranto/bundles/node/core/src/lib/pmProxy.test/index.mjs +4795 -0
  182. package/testeranto/bundles/pure/core/chunk-6HR24P27.mjs +1003 -0
  183. package/testeranto/bundles/pure/core/src/Pure.test.mjs +410 -0
  184. package/testeranto/bundles/pure/core/src/lib/BaseSuite.test/pure.test.mjs +57 -1062
  185. package/testeranto/bundles/web/core/MPLUSRounded1c-Black-O75GP5JI.ttf +0 -0
  186. package/testeranto/bundles/web/core/MPLUSRounded1c-Bold-R524Q5BH.ttf +0 -0
  187. package/testeranto/bundles/web/core/MPLUSRounded1c-ExtraBold-C6GRMYVT.ttf +0 -0
  188. package/testeranto/bundles/web/core/MPLUSRounded1c-Light-WKN65Y2C.ttf +0 -0
  189. package/testeranto/bundles/web/core/MPLUSRounded1c-Medium-ZC4DWL7C.ttf +0 -0
  190. package/testeranto/bundles/web/core/MPLUSRounded1c-Regular-DT6EKZ3S.ttf +0 -0
  191. package/testeranto/bundles/web/core/MPLUSRounded1c-Thin-YWDNVG6M.ttf +0 -0
  192. package/testeranto/bundles/web/core/chunk-AZZHJNSU.mjs +30278 -0
  193. package/testeranto/bundles/web/core/chunk-ME6I6FJZ.mjs +3005 -0
  194. package/testeranto/bundles/web/core/src/components/pure/FeaturesReporterView.test/index.html +15 -0
  195. package/testeranto/bundles/web/core/src/components/pure/FeaturesReporterView.test/index.mjs +162 -0
  196. package/testeranto/bundles/web/core/src/components/pure/ProjectPageView.test/index.css +11619 -0
  197. package/testeranto/bundles/web/core/src/components/pure/ProjectPageView.test/index.html +15 -0
  198. package/testeranto/bundles/web/core/src/components/pure/ProjectPageView.test/index.mjs +6924 -0
  199. package/testeranto/bundles/web/core/src/lib/BaseSuite.test/web.test.mjs +71 -1050
  200. package/testeranto/helpo_chat_history.json +1 -0
  201. package/testeranto/metafiles/golang/core.json +42 -47
  202. package/testeranto/metafiles/node/core.json +584 -125
  203. package/testeranto/metafiles/pure/core.json +152 -51
  204. package/testeranto/metafiles/python/core.json +87 -0
  205. package/testeranto/metafiles/web/core.json +16365 -75
  206. package/testeranto/reports/core/config.json +66 -2
  207. package/testeranto/reports/core/example/Calculator.golingvu/golang/exit.log +1 -0
  208. package/testeranto/reports/core/example/Calculator.golingvu/golang/stderr.log +2 -0
  209. package/testeranto/reports/core/example/Calculator.golingvu/golang/stdout.log +1 -0
  210. package/testeranto/reports/core/example/Calculator.pitono.test/python/exit.log +1 -0
  211. package/testeranto/reports/core/example/Calculator.pitono.test/python/stderr.log +11 -0
  212. package/testeranto/reports/core/example/Calculator.pitono.test/python/stdout.log +1 -0
  213. package/testeranto/reports/core/example/Calculator.test/node/exit.log +1 -0
  214. package/testeranto/reports/core/example/Calculator.test/node/lint_errors.txt +2 -0
  215. package/testeranto/reports/core/example/Calculator.test/node/message.txt +16 -0
  216. package/testeranto/reports/core/example/Calculator.test/node/prompt.txt +13 -0
  217. package/testeranto/reports/core/example/Calculator.test/node/stderr.log +33 -0
  218. package/testeranto/reports/core/example/Calculator.test/node/stdout.log +1076 -0
  219. package/testeranto/reports/core/example/Calculator.test/node/tests.json +1109 -0
  220. package/testeranto/reports/core/example/Calculator.test/node/type_errors.txt +34 -0
  221. package/testeranto/reports/core/example/test_example/python/exit.log +1 -0
  222. package/testeranto/reports/core/example/test_example/python/stderr.log +24 -0
  223. package/testeranto/reports/core/src/Pure.test/pure/message.txt +16 -0
  224. package/testeranto/reports/core/src/Pure.test/pure/prompt.txt +13 -0
  225. package/testeranto/reports/core/src/Pure.test/pure/type_errors.txt +86 -0
  226. package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/exit.log +0 -0
  227. package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/info.log +0 -0
  228. package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/lint_errors.txt +0 -0
  229. package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/message.txt +17 -0
  230. package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/prompt.txt +26 -0
  231. package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/type_errors.txt +69 -0
  232. package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/warn.log +0 -0
  233. package/testeranto/reports/core/src/components/pure/ModalContent.test/index/web/debug.log +0 -0
  234. package/testeranto/reports/core/src/components/pure/ModalContent.test/index/web/error.log +0 -0
  235. package/testeranto/reports/core/src/components/pure/ModalContent.test/index/web/exit.log +0 -0
  236. package/testeranto/reports/core/src/components/pure/ModalContent.test/index/web/info.log +0 -0
  237. package/testeranto/reports/core/src/components/pure/ModalContent.test/index/web/lint_errors.txt +16 -0
  238. package/testeranto/reports/core/src/components/pure/ModalContent.test/index/web/message.txt +17 -0
  239. package/testeranto/reports/core/src/components/pure/ModalContent.test/index/web/prompt.txt +27 -0
  240. package/testeranto/reports/core/src/components/pure/ModalContent.test/index/web/type_errors.txt +42 -0
  241. package/testeranto/reports/core/src/components/pure/ModalContent.test/index/web/warn.log +0 -0
  242. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/debug.log +0 -0
  243. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/error.log +0 -0
  244. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/exit.log +0 -0
  245. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/info.log +0 -0
  246. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/lint_errors.txt +30 -0
  247. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/message.txt +17 -0
  248. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/prompt.txt +30 -0
  249. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/type_errors.txt +58 -0
  250. package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/warn.log +0 -0
  251. package/testeranto/reports/core/src/lib/BaseSuite.test/node.test/node/exit.log +1 -1
  252. package/testeranto/reports/core/src/lib/BaseSuite.test/node.test/node/lint_errors.txt +0 -6
  253. package/testeranto/reports/core/src/lib/BaseSuite.test/node.test/node/prompt.txt +9 -12
  254. package/testeranto/reports/core/src/lib/BaseSuite.test/node.test/node/stderr.log +1 -0
  255. package/testeranto/reports/core/src/lib/BaseSuite.test/node.test/node/stdout.log +4 -0
  256. package/testeranto/reports/core/src/lib/BaseSuite.test/node.test/node/tests.json +99 -8
  257. package/testeranto/reports/core/src/lib/BaseSuite.test/node.test/node/type_errors.txt +57 -44
  258. package/testeranto/reports/core/src/lib/BaseSuite.test/pure.test/pure/lint_errors.txt +0 -2
  259. package/testeranto/reports/core/src/lib/BaseSuite.test/pure.test/pure/message.txt +1 -2
  260. package/testeranto/reports/core/src/lib/BaseSuite.test/pure.test/pure/prompt.txt +4 -16
  261. package/testeranto/reports/core/src/lib/BaseSuite.test/pure.test/pure/type_errors.txt +62 -44
  262. package/testeranto/reports/core/src/lib/BaseSuite.test/web.test/web/error.log +0 -1
  263. package/testeranto/reports/core/src/lib/BaseSuite.test/web.test/web/exit.log +0 -1
  264. package/testeranto/reports/core/src/lib/BaseSuite.test/web.test/web/lint_errors.txt +0 -2
  265. package/testeranto/reports/core/src/lib/BaseSuite.test/web.test/web/prompt.txt +13 -13
  266. package/testeranto/reports/core/src/lib/BaseSuite.test/web.test/web/type_errors.txt +57 -44
  267. package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/exit.log +1 -0
  268. package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/lint_errors.txt +0 -0
  269. package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/message.txt +16 -0
  270. package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/prompt.txt +13 -0
  271. package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/stderr.log +88 -0
  272. package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/stdout.log +521 -0
  273. package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/tests.json +166 -0
  274. package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/type_errors.txt +78 -0
  275. package/testeranto/reports/core/src/lib/pmProxy.test/index/node/exit.log +1 -0
  276. package/testeranto/reports/core/src/lib/pmProxy.test/index/node/lint_errors.txt +15 -0
  277. package/testeranto/reports/core/src/lib/pmProxy.test/index/node/message.txt +17 -0
  278. package/testeranto/reports/core/src/lib/pmProxy.test/index/node/prompt.txt +25 -0
  279. package/testeranto/reports/core/src/lib/pmProxy.test/index/node/stderr.log +0 -0
  280. package/testeranto/reports/core/src/lib/pmProxy.test/index/node/stdout.log +2 -0
  281. package/testeranto/reports/core/src/lib/pmProxy.test/index/node/tests.json +31 -0
  282. package/testeranto/reports/core/src/lib/pmProxy.test/index/node/type_errors.txt +62 -0
  283. package/testeranto/reports/core/summary.json +66 -11
  284. package/testeranto.config.ts +38 -44
  285. package/tsc.log +141 -91
  286. package/tsconfig.json +6 -2
  287. package/dist/cjs-shim.js +0 -12
  288. package/dist/common/design-editor/DesignEditor.js +0 -242
  289. package/dist/common/design-editor/index.js +0 -18
  290. package/dist/common/design-editor/server.js +0 -98
  291. package/dist/common/design-editor/types.js +0 -2
  292. package/dist/common/package.json +0 -3
  293. package/dist/common/src/App.js +0 -77
  294. package/dist/common/src/CoreTypes.js +0 -2
  295. package/dist/common/src/Init.js +0 -48
  296. package/dist/common/src/Node.js +0 -40
  297. package/dist/common/src/NodeSidecar.js +0 -15
  298. package/dist/common/src/PM/PM_WithEslintAndTsc.js +0 -192
  299. package/dist/common/src/PM/__tests__/nodeSidecar.testeranto.js +0 -108
  300. package/dist/common/src/PM/__tests__/pureSidecar.testeranto.js +0 -93
  301. package/dist/common/src/PM/__tests__/webSidecar.testeranto.js +0 -93
  302. package/dist/common/src/PM/base.js +0 -257
  303. package/dist/common/src/PM/index.js +0 -6
  304. package/dist/common/src/PM/main.js +0 -1815
  305. package/dist/common/src/PM/node.js +0 -185
  306. package/dist/common/src/PM/nodeSidecar.js +0 -65
  307. package/dist/common/src/PM/pitonoRunner.js +0 -54
  308. package/dist/common/src/PM/pure.js +0 -111
  309. package/dist/common/src/PM/pureSidecar.js +0 -48
  310. package/dist/common/src/PM/sidecar.js +0 -11
  311. package/dist/common/src/PM/types.js +0 -1
  312. package/dist/common/src/PM/web.js +0 -112
  313. package/dist/common/src/PM/webSidecar.js +0 -47
  314. package/dist/common/src/Pure.js +0 -52
  315. package/dist/common/src/Pure.test.js +0 -180
  316. package/dist/common/src/PureSidecar.js +0 -13
  317. package/dist/common/src/ReportServer.js +0 -11
  318. package/dist/common/src/ReportServer.test.ts/index.js +0 -78
  319. package/dist/common/src/ReportServerLib.js +0 -141
  320. package/dist/common/src/Types.js +0 -2
  321. package/dist/common/src/Web.js +0 -61
  322. package/dist/common/src/WebSidecar.js +0 -14
  323. package/dist/common/src/components/DesignEditorPage.js +0 -205
  324. package/dist/common/src/components/SunriseAnimation.js +0 -291
  325. package/dist/common/src/components/SunriseAnimation.test/implementation.js +0 -1
  326. package/dist/common/src/components/SunriseAnimation.test/index.js +0 -1
  327. package/dist/common/src/components/SunriseAnimation.test/interface.js +0 -68
  328. package/dist/common/src/components/SunriseAnimation.test/specification.js +0 -1
  329. package/dist/common/src/components/SunriseAnimation.test/types.js +0 -2
  330. package/dist/common/src/components/TestStatusBadge.js +0 -35
  331. package/dist/common/src/components/pure/AppFrame.js +0 -69
  332. package/dist/common/src/components/pure/AppFrame.test/implementation.js +0 -63
  333. package/dist/common/src/components/pure/AppFrame.test/index.js +0 -14
  334. package/dist/common/src/components/pure/AppFrame.test/specification.js +0 -25
  335. package/dist/common/src/components/pure/AppFrame.test/types.js +0 -3
  336. package/dist/common/src/components/pure/FeaturesReporterView.js +0 -23
  337. package/dist/common/src/components/pure/FeaturesReporterView.test/implementation.js +0 -84
  338. package/dist/common/src/components/pure/FeaturesReporterView.test/index.js +0 -14
  339. package/dist/common/src/components/pure/FeaturesReporterView.test/specification.js +0 -27
  340. package/dist/common/src/components/pure/FeaturesReporterView.test/types.js +0 -2
  341. package/dist/common/src/components/pure/ModalContent.js +0 -86
  342. package/dist/common/src/components/pure/ModalContent.test/implementation.js +0 -35
  343. package/dist/common/src/components/pure/ModalContent.test/index.js +0 -58
  344. package/dist/common/src/components/pure/ModalContent.test/specification.js +0 -19
  345. package/dist/common/src/components/pure/ModalContent.test/types.js +0 -4
  346. package/dist/common/src/components/pure/NavBar.js +0 -44
  347. package/dist/common/src/components/pure/ProcessManager.js +0 -112
  348. package/dist/common/src/components/pure/ProcessManagerView.js +0 -237
  349. package/dist/common/src/components/pure/ProjectPageView.js +0 -181
  350. package/dist/common/src/components/pure/ProjectPageView.test/implementation.js +0 -184
  351. package/dist/common/src/components/pure/ProjectPageView.test/index.js +0 -14
  352. package/dist/common/src/components/pure/ProjectPageView.test/specification.js +0 -32
  353. package/dist/common/src/components/pure/ProjectPageView.test/types.js +0 -4
  354. package/dist/common/src/components/pure/ProjectsPageView.js +0 -72
  355. package/dist/common/src/components/pure/SettingsButton.js +0 -13
  356. package/dist/common/src/components/pure/SingleProcessView.js +0 -214
  357. package/dist/common/src/components/pure/TestPageView.js +0 -628
  358. package/dist/common/src/components/pure/TestPageView.test/implementation.js +0 -157
  359. package/dist/common/src/components/pure/TestPageView.test/index.js +0 -15
  360. package/dist/common/src/components/pure/TestPageView.test/specification.js +0 -26
  361. package/dist/common/src/components/pure/TestPageView.test/types.js +0 -4
  362. package/dist/common/src/components/pure/ThemeCard.js +0 -15
  363. package/dist/common/src/components/stateful/FeaturesReporter.js +0 -59
  364. package/dist/common/src/components/stateful/FileTree.js +0 -40
  365. package/dist/common/src/components/stateful/ProcessManagerPage.js +0 -112
  366. package/dist/common/src/components/stateful/ProjectPage.js +0 -101
  367. package/dist/common/src/components/stateful/ProjectsPage.js +0 -118
  368. package/dist/common/src/components/stateful/SettingsPage.js +0 -72
  369. package/dist/common/src/components/stateful/SingleProcessPage.js +0 -147
  370. package/dist/common/src/components/stateful/TestPage.js +0 -268
  371. package/dist/common/src/components/stateful/TextEditorPage.js +0 -154
  372. package/dist/common/src/defaultConfig.js +0 -19
  373. package/dist/common/src/esbuildConfigs/consoleDetectorPlugin.js +0 -38
  374. package/dist/common/src/esbuildConfigs/eslint-formatter-testeranto.js +0 -21
  375. package/dist/common/src/esbuildConfigs/featuresPlugin.js +0 -39
  376. package/dist/common/src/esbuildConfigs/index.js +0 -21
  377. package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +0 -30
  378. package/dist/common/src/esbuildConfigs/nativeImportDetectorPlugin.js +0 -24
  379. package/dist/common/src/esbuildConfigs/node.js +0 -24
  380. package/dist/common/src/esbuildConfigs/pure.js +0 -42
  381. package/dist/common/src/esbuildConfigs/rebuildPlugin.js +0 -19
  382. package/dist/common/src/esbuildConfigs/web.js +0 -48
  383. package/dist/common/src/init-docs.js +0 -9
  384. package/dist/common/src/lib/BaseGiven.js +0 -99
  385. package/dist/common/src/lib/BaseSuite.js +0 -91
  386. package/dist/common/src/lib/BaseSuite.test/mock.js +0 -61
  387. package/dist/common/src/lib/BaseSuite.test/node.test.js +0 -10
  388. package/dist/common/src/lib/BaseSuite.test/pure.test.js +0 -10
  389. package/dist/common/src/lib/BaseSuite.test/test.js +0 -253
  390. package/dist/common/src/lib/BaseSuite.test/web.test.js +0 -10
  391. package/dist/common/src/lib/BaseThen.js +0 -64
  392. package/dist/common/src/lib/BaseWhen.js +0 -45
  393. package/dist/common/src/lib/Sidecar.js +0 -7
  394. package/dist/common/src/lib/Tiposkripto.js +0 -149
  395. package/dist/common/src/lib/Tiposkripto.test/MockTiposkripto.js +0 -36
  396. package/dist/common/src/lib/Tiposkripto.test/Tiposkripto.adapter.js +0 -35
  397. package/dist/common/src/lib/Tiposkripto.test/Tiposkripto.implementation.js +0 -173
  398. package/dist/common/src/lib/Tiposkripto.test/Tiposkripto.js +0 -11
  399. package/dist/common/src/lib/Tiposkripto.test/Tiposkripto.specification.js +0 -42
  400. package/dist/common/src/lib/Tiposkripto.test/Tiposkripto.types.js +0 -2
  401. package/dist/common/src/lib/abstractBase.test/MockGiven.js +0 -24
  402. package/dist/common/src/lib/abstractBase.test/MockThen.js +0 -16
  403. package/dist/common/src/lib/abstractBase.test/MockWhen.js +0 -20
  404. package/dist/common/src/lib/abstractBase.test/adapter.js +0 -24
  405. package/dist/common/src/lib/abstractBase.test/implementation.js +0 -38
  406. package/dist/common/src/lib/abstractBase.test/index.js +0 -18
  407. package/dist/common/src/lib/abstractBase.test/specification.js +0 -19
  408. package/dist/common/src/lib/abstractBase.test/types.js +0 -2
  409. package/dist/common/src/lib/index.js +0 -31
  410. package/dist/common/src/lib/pmProxy.js +0 -293
  411. package/dist/common/src/lib/pmProxy.test/adapter.js +0 -54
  412. package/dist/common/src/lib/pmProxy.test/implementation.js +0 -137
  413. package/dist/common/src/lib/pmProxy.test/index.js +0 -15
  414. package/dist/common/src/lib/pmProxy.test/mockPM.js +0 -34
  415. package/dist/common/src/lib/pmProxy.test/mockPMBase.js +0 -131
  416. package/dist/common/src/lib/pmProxy.test/specification.js +0 -64
  417. package/dist/common/src/lib/pmProxy.test/types.js +0 -2
  418. package/dist/common/src/lib/types.js +0 -3
  419. package/dist/common/src/mothership/index.js +0 -21
  420. package/dist/common/src/mothership/test.js +0 -83
  421. package/dist/common/src/run.js +0 -49
  422. package/dist/common/src/testeranto.js +0 -283
  423. package/dist/common/src/types/features.js +0 -34
  424. package/dist/common/src/utils/api.js +0 -89
  425. package/dist/common/src/utils/buildTemplates.js +0 -37
  426. package/dist/common/src/utils/featureUtils.js +0 -29
  427. package/dist/common/src/utils/golingvuMetafile.js +0 -116
  428. package/dist/common/src/utils/logFiles.js +0 -52
  429. package/dist/common/src/utils/makePrompt.js +0 -116
  430. package/dist/common/src/utils/pitonoMetafile.js +0 -67
  431. package/dist/common/src/utils/queue.js +0 -36
  432. package/dist/common/src/utils.js +0 -133
  433. package/dist/common/src/web.html.js +0 -18
  434. package/dist/common/testeranto.config.js +0 -98
  435. package/dist/common/tsconfig.common.tsbuildinfo +0 -1
  436. package/dist/module/design-editor/DesignEditor.js +0 -206
  437. package/dist/module/design-editor/index.js +0 -2
  438. package/dist/module/design-editor/server.js +0 -92
  439. package/dist/module/design-editor/types.js +0 -1
  440. package/dist/module/package.json +0 -3
  441. package/dist/module/src/App.js +0 -70
  442. package/dist/module/src/CoreTypes.js +0 -1
  443. package/dist/module/src/Init.js +0 -43
  444. package/dist/module/src/Node.js +0 -33
  445. package/dist/module/src/NodeSidecar.js +0 -11
  446. package/dist/module/src/PM/PM_WithEslintAndTsc.js +0 -185
  447. package/dist/module/src/PM/__tests__/nodeSidecar.testeranto.js +0 -103
  448. package/dist/module/src/PM/__tests__/pureSidecar.testeranto.js +0 -88
  449. package/dist/module/src/PM/__tests__/webSidecar.testeranto.js +0 -88
  450. package/dist/module/src/PM/base.js +0 -250
  451. package/dist/module/src/PM/index.js +0 -2
  452. package/dist/module/src/PM/main.js +0 -1775
  453. package/dist/module/src/PM/node.js +0 -178
  454. package/dist/module/src/PM/nodeSidecar.js +0 -58
  455. package/dist/module/src/PM/pitonoRunner.js +0 -47
  456. package/dist/module/src/PM/pure.js +0 -107
  457. package/dist/module/src/PM/pureSidecar.js +0 -41
  458. package/dist/module/src/PM/sidecar.js +0 -7
  459. package/dist/module/src/PM/types.js +0 -1
  460. package/dist/module/src/PM/web.js +0 -108
  461. package/dist/module/src/PM/webSidecar.js +0 -40
  462. package/dist/module/src/Pure.js +0 -45
  463. package/dist/module/src/Pure.test.js +0 -175
  464. package/dist/module/src/PureSidecar.js +0 -9
  465. package/dist/module/src/ReportServer.js +0 -9
  466. package/dist/module/src/ReportServer.test.ts/index.js +0 -73
  467. package/dist/module/src/ReportServerLib.js +0 -134
  468. package/dist/module/src/Types.js +0 -1
  469. package/dist/module/src/Web.js +0 -54
  470. package/dist/module/src/WebSidecar.js +0 -10
  471. package/dist/module/src/components/DesignEditorPage.js +0 -168
  472. package/dist/module/src/components/SunriseAnimation.js +0 -256
  473. package/dist/module/src/components/SunriseAnimation.test/implementation.js +0 -1
  474. package/dist/module/src/components/SunriseAnimation.test/index.js +0 -1
  475. package/dist/module/src/components/SunriseAnimation.test/interface.js +0 -32
  476. package/dist/module/src/components/SunriseAnimation.test/specification.js +0 -1
  477. package/dist/module/src/components/SunriseAnimation.test/types.js +0 -1
  478. package/dist/module/src/components/TestStatusBadge.js +0 -28
  479. package/dist/module/src/components/pure/AppFrame.js +0 -32
  480. package/dist/module/src/components/pure/AppFrame.test/implementation.js +0 -57
  481. package/dist/module/src/components/pure/AppFrame.test/index.js +0 -9
  482. package/dist/module/src/components/pure/AppFrame.test/specification.js +0 -21
  483. package/dist/module/src/components/pure/AppFrame.test/types.js +0 -2
  484. package/dist/module/src/components/pure/FeaturesReporterView.js +0 -16
  485. package/dist/module/src/components/pure/FeaturesReporterView.test/implementation.js +0 -81
  486. package/dist/module/src/components/pure/FeaturesReporterView.test/index.js +0 -9
  487. package/dist/module/src/components/pure/FeaturesReporterView.test/specification.js +0 -23
  488. package/dist/module/src/components/pure/FeaturesReporterView.test/types.js +0 -1
  489. package/dist/module/src/components/pure/ModalContent.js +0 -79
  490. package/dist/module/src/components/pure/ModalContent.test/implementation.js +0 -32
  491. package/dist/module/src/components/pure/ModalContent.test/index.js +0 -53
  492. package/dist/module/src/components/pure/ModalContent.test/specification.js +0 -15
  493. package/dist/module/src/components/pure/ModalContent.test/types.js +0 -3
  494. package/dist/module/src/components/pure/NavBar.js +0 -37
  495. package/dist/module/src/components/pure/ProcessManager.js +0 -75
  496. package/dist/module/src/components/pure/ProcessManagerView.js +0 -200
  497. package/dist/module/src/components/pure/ProjectPageView.js +0 -174
  498. package/dist/module/src/components/pure/ProjectPageView.test/implementation.js +0 -181
  499. package/dist/module/src/components/pure/ProjectPageView.test/index.js +0 -9
  500. package/dist/module/src/components/pure/ProjectPageView.test/specification.js +0 -28
  501. package/dist/module/src/components/pure/ProjectPageView.test/types.js +0 -3
  502. package/dist/module/src/components/pure/ProjectsPageView.js +0 -65
  503. package/dist/module/src/components/pure/SettingsButton.js +0 -6
  504. package/dist/module/src/components/pure/SingleProcessView.js +0 -214
  505. package/dist/module/src/components/pure/TestPageView.js +0 -591
  506. package/dist/module/src/components/pure/TestPageView.test/implementation.js +0 -121
  507. package/dist/module/src/components/pure/TestPageView.test/index.js +0 -10
  508. package/dist/module/src/components/pure/TestPageView.test/specification.js +0 -22
  509. package/dist/module/src/components/pure/TestPageView.test/types.js +0 -3
  510. package/dist/module/src/components/pure/ThemeCard.js +0 -8
  511. package/dist/module/src/components/stateful/FeaturesReporter.js +0 -22
  512. package/dist/module/src/components/stateful/FileTree.js +0 -33
  513. package/dist/module/src/components/stateful/ProcessManagerPage.js +0 -75
  514. package/dist/module/src/components/stateful/ProjectPage.js +0 -64
  515. package/dist/module/src/components/stateful/ProjectsPage.js +0 -81
  516. package/dist/module/src/components/stateful/SettingsPage.js +0 -35
  517. package/dist/module/src/components/stateful/SingleProcessPage.js +0 -110
  518. package/dist/module/src/components/stateful/TestPage.js +0 -231
  519. package/dist/module/src/components/stateful/TextEditorPage.js +0 -117
  520. package/dist/module/src/defaultConfig.js +0 -17
  521. package/dist/module/src/esbuildConfigs/consoleDetectorPlugin.js +0 -32
  522. package/dist/module/src/esbuildConfigs/eslint-formatter-testeranto.js +0 -18
  523. package/dist/module/src/esbuildConfigs/featuresPlugin.js +0 -34
  524. package/dist/module/src/esbuildConfigs/index.js +0 -19
  525. package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +0 -25
  526. package/dist/module/src/esbuildConfigs/nativeImportDetectorPlugin.js +0 -21
  527. package/dist/module/src/esbuildConfigs/node.js +0 -19
  528. package/dist/module/src/esbuildConfigs/pure.js +0 -37
  529. package/dist/module/src/esbuildConfigs/rebuildPlugin.js +0 -14
  530. package/dist/module/src/esbuildConfigs/web.js +0 -43
  531. package/dist/module/src/init-docs.js +0 -4
  532. package/dist/module/src/lib/BaseGiven.js +0 -95
  533. package/dist/module/src/lib/BaseSuite.js +0 -87
  534. package/dist/module/src/lib/BaseSuite.test/mock.js +0 -54
  535. package/dist/module/src/lib/BaseSuite.test/node.test.js +0 -5
  536. package/dist/module/src/lib/BaseSuite.test/pure.test.js +0 -5
  537. package/dist/module/src/lib/BaseSuite.test/test.js +0 -249
  538. package/dist/module/src/lib/BaseSuite.test/web.test.js +0 -5
  539. package/dist/module/src/lib/BaseThen.js +0 -60
  540. package/dist/module/src/lib/BaseWhen.js +0 -41
  541. package/dist/module/src/lib/Sidecar.js +0 -3
  542. package/dist/module/src/lib/Tiposkripto.js +0 -146
  543. package/dist/module/src/lib/Tiposkripto.test/MockTiposkripto.js +0 -29
  544. package/dist/module/src/lib/Tiposkripto.test/Tiposkripto.adapter.js +0 -32
  545. package/dist/module/src/lib/Tiposkripto.test/Tiposkripto.implementation.js +0 -170
  546. package/dist/module/src/lib/Tiposkripto.test/Tiposkripto.js +0 -6
  547. package/dist/module/src/lib/Tiposkripto.test/Tiposkripto.specification.js +0 -38
  548. package/dist/module/src/lib/Tiposkripto.test/Tiposkripto.types.js +0 -1
  549. package/dist/module/src/lib/abstractBase.test/MockGiven.js +0 -20
  550. package/dist/module/src/lib/abstractBase.test/MockThen.js +0 -12
  551. package/dist/module/src/lib/abstractBase.test/MockWhen.js +0 -16
  552. package/dist/module/src/lib/abstractBase.test/adapter.js +0 -21
  553. package/dist/module/src/lib/abstractBase.test/implementation.js +0 -35
  554. package/dist/module/src/lib/abstractBase.test/index.js +0 -13
  555. package/dist/module/src/lib/abstractBase.test/specification.js +0 -15
  556. package/dist/module/src/lib/abstractBase.test/types.js +0 -1
  557. package/dist/module/src/lib/index.js +0 -26
  558. package/dist/module/src/lib/pmProxy.js +0 -284
  559. package/dist/module/src/lib/pmProxy.test/adapter.js +0 -51
  560. package/dist/module/src/lib/pmProxy.test/implementation.js +0 -134
  561. package/dist/module/src/lib/pmProxy.test/index.js +0 -10
  562. package/dist/module/src/lib/pmProxy.test/mockPM.js +0 -30
  563. package/dist/module/src/lib/pmProxy.test/mockPMBase.js +0 -127
  564. package/dist/module/src/lib/pmProxy.test/specification.js +0 -60
  565. package/dist/module/src/lib/pmProxy.test/types.js +0 -1
  566. package/dist/module/src/lib/types.js +0 -2
  567. package/dist/module/src/mothership/index.js +0 -16
  568. package/dist/module/src/mothership/test.js +0 -78
  569. package/dist/module/src/run.js +0 -49
  570. package/dist/module/src/testeranto.js +0 -245
  571. package/dist/module/src/types/features.js +0 -31
  572. package/dist/module/src/utils/api.js +0 -84
  573. package/dist/module/src/utils/buildTemplates.js +0 -33
  574. package/dist/module/src/utils/featureUtils.js +0 -24
  575. package/dist/module/src/utils/golingvuMetafile.js +0 -109
  576. package/dist/module/src/utils/logFiles.js +0 -47
  577. package/dist/module/src/utils/makePrompt.js +0 -109
  578. package/dist/module/src/utils/pitonoMetafile.js +0 -60
  579. package/dist/module/src/utils/queue.js +0 -32
  580. package/dist/module/src/utils.js +0 -121
  581. package/dist/module/src/web.html.js +0 -16
  582. package/dist/module/testeranto.config.js +0 -96
  583. package/dist/module/tsconfig.module.tsbuildinfo +0 -1
  584. package/dist/types/design-editor/DesignEditor.d.ts +0 -18
  585. package/dist/types/design-editor/server.d.ts +0 -1
  586. package/dist/types/src/App.d.ts +0 -1
  587. package/dist/types/src/CoreTypes.d.ts +0 -52
  588. package/dist/types/src/Init.d.ts +0 -2
  589. package/dist/types/src/Node.d.ts +0 -9
  590. package/dist/types/src/NodeSidecar.d.ts +0 -6
  591. package/dist/types/src/PM/PM_WithEslintAndTsc.d.ts +0 -24
  592. package/dist/types/src/PM/__tests__/nodeSidecar.testeranto.d.ts +0 -2
  593. package/dist/types/src/PM/__tests__/pureSidecar.testeranto.d.ts +0 -2
  594. package/dist/types/src/PM/__tests__/webSidecar.testeranto.d.ts +0 -2
  595. package/dist/types/src/PM/base.d.ts +0 -35
  596. package/dist/types/src/PM/index.d.ts +0 -37
  597. package/dist/types/src/PM/main.d.ts +0 -79
  598. package/dist/types/src/PM/node.d.ts +0 -40
  599. package/dist/types/src/PM/nodeSidecar.d.ts +0 -13
  600. package/dist/types/src/PM/pitonoRunner.d.ts +0 -7
  601. package/dist/types/src/PM/pure.d.ts +0 -43
  602. package/dist/types/src/PM/pureSidecar.d.ts +0 -11
  603. package/dist/types/src/PM/sidecar.d.ts +0 -8
  604. package/dist/types/src/PM/web.d.ts +0 -43
  605. package/dist/types/src/PM/webSidecar.d.ts +0 -11
  606. package/dist/types/src/Pure.d.ts +0 -9
  607. package/dist/types/src/Pure.test.d.ts +0 -2
  608. package/dist/types/src/PureSidecar.d.ts +0 -8
  609. package/dist/types/src/ReportServer.d.ts +0 -1
  610. package/dist/types/src/ReportServer.test.ts/index.d.ts +0 -2
  611. package/dist/types/src/ReportServerLib.d.ts +0 -1
  612. package/dist/types/src/Types.d.ts +0 -118
  613. package/dist/types/src/Web.d.ts +0 -9
  614. package/dist/types/src/WebSidecar.d.ts +0 -8
  615. package/dist/types/src/components/DesignEditorPage.d.ts +0 -1
  616. package/dist/types/src/components/SunriseAnimation.d.ts +0 -5
  617. package/dist/types/src/components/SunriseAnimation.test/interface.d.ts +0 -11
  618. package/dist/types/src/components/SunriseAnimation.test/types.d.ts +0 -39
  619. package/dist/types/src/components/TestStatusBadge.d.ts +0 -15
  620. package/dist/types/src/components/pure/AppFrame.d.ts +0 -11
  621. package/dist/types/src/components/pure/AppFrame.test/implementation.d.ts +0 -3
  622. package/dist/types/src/components/pure/AppFrame.test/index.d.ts +0 -3
  623. package/dist/types/src/components/pure/AppFrame.test/specification.d.ts +0 -3
  624. package/dist/types/src/components/pure/AppFrame.test/types.d.ts +0 -33
  625. package/dist/types/src/components/pure/FeaturesReporterView.d.ts +0 -7
  626. package/dist/types/src/components/pure/FeaturesReporterView.test/implementation.d.ts +0 -3
  627. package/dist/types/src/components/pure/FeaturesReporterView.test/index.d.ts +0 -2
  628. package/dist/types/src/components/pure/FeaturesReporterView.test/specification.d.ts +0 -3
  629. package/dist/types/src/components/pure/FeaturesReporterView.test/types.d.ts +0 -54
  630. package/dist/types/src/components/pure/ModalContent.d.ts +0 -7
  631. package/dist/types/src/components/pure/ModalContent.test/implementation.d.ts +0 -3
  632. package/dist/types/src/components/pure/ModalContent.test/index.d.ts +0 -2
  633. package/dist/types/src/components/pure/ModalContent.test/specification.d.ts +0 -3
  634. package/dist/types/src/components/pure/ModalContent.test/types.d.ts +0 -45
  635. package/dist/types/src/components/pure/NavBar.d.ts +0 -23
  636. package/dist/types/src/components/pure/ProcessManager.d.ts +0 -8
  637. package/dist/types/src/components/pure/ProcessManagerView.d.ts +0 -20
  638. package/dist/types/src/components/pure/ProjectPageView.d.ts +0 -14
  639. package/dist/types/src/components/pure/ProjectPageView.test/implementation.d.ts +0 -3
  640. package/dist/types/src/components/pure/ProjectPageView.test/index.d.ts +0 -2
  641. package/dist/types/src/components/pure/ProjectPageView.test/specification.d.ts +0 -3
  642. package/dist/types/src/components/pure/ProjectPageView.test/types.d.ts +0 -57
  643. package/dist/types/src/components/pure/ProjectsPageView.d.ts +0 -29
  644. package/dist/types/src/components/pure/SettingsButton.d.ts +0 -2
  645. package/dist/types/src/components/pure/TestPageView.d.ts +0 -15
  646. package/dist/types/src/components/pure/TestPageView.test/implementation.d.ts +0 -12
  647. package/dist/types/src/components/pure/TestPageView.test/index.d.ts +0 -3
  648. package/dist/types/src/components/pure/TestPageView.test/specification.d.ts +0 -11
  649. package/dist/types/src/components/pure/TestPageView.test/types.d.ts +0 -65
  650. package/dist/types/src/components/pure/ThemeCard.d.ts +0 -9
  651. package/dist/types/src/components/stateful/FeaturesReporter.d.ts +0 -2
  652. package/dist/types/src/components/stateful/FileTree.d.ts +0 -8
  653. package/dist/types/src/components/stateful/ProcessManagerPage.d.ts +0 -2
  654. package/dist/types/src/components/stateful/ProjectPage.d.ts +0 -1
  655. package/dist/types/src/components/stateful/ProjectsPage.d.ts +0 -1
  656. package/dist/types/src/components/stateful/SettingsPage.d.ts +0 -2
  657. package/dist/types/src/components/stateful/SingleProcessPage.d.ts +0 -2
  658. package/dist/types/src/components/stateful/TestPage.d.ts +0 -1
  659. package/dist/types/src/components/stateful/TextEditorPage.d.ts +0 -1
  660. package/dist/types/src/defaultConfig.d.ts +0 -3
  661. package/dist/types/src/esbuildConfigs/consoleDetectorPlugin.d.ts +0 -2
  662. package/dist/types/src/esbuildConfigs/eslint-formatter-testeranto.d.ts +0 -2
  663. package/dist/types/src/esbuildConfigs/featuresPlugin.d.ts +0 -5
  664. package/dist/types/src/esbuildConfigs/index.d.ts +0 -4
  665. package/dist/types/src/esbuildConfigs/inputFilesPlugin.d.ts +0 -7
  666. package/dist/types/src/esbuildConfigs/nativeImportDetectorPlugin.d.ts +0 -2
  667. package/dist/types/src/esbuildConfigs/node.d.ts +0 -4
  668. package/dist/types/src/esbuildConfigs/pure.d.ts +0 -4
  669. package/dist/types/src/esbuildConfigs/rebuildPlugin.d.ts +0 -6
  670. package/dist/types/src/esbuildConfigs/web.d.ts +0 -4
  671. package/dist/types/src/init-docs.d.ts +0 -1
  672. package/dist/types/src/lib/BaseGiven.d.ts +0 -44
  673. package/dist/types/src/lib/BaseSuite.d.ts +0 -46
  674. package/dist/types/src/lib/BaseSuite.test/mock.d.ts +0 -21
  675. package/dist/types/src/lib/BaseSuite.test/node.test.d.ts +0 -2
  676. package/dist/types/src/lib/BaseSuite.test/pure.test.d.ts +0 -2
  677. package/dist/types/src/lib/BaseSuite.test/test.d.ts +0 -36
  678. package/dist/types/src/lib/BaseSuite.test/web.test.d.ts +0 -2
  679. package/dist/types/src/lib/BaseThen.d.ts +0 -27
  680. package/dist/types/src/lib/BaseWhen.d.ts +0 -27
  681. package/dist/types/src/lib/Sidecar.d.ts +0 -5
  682. package/dist/types/src/lib/Tiposkripto.d.ts +0 -35
  683. package/dist/types/src/lib/Tiposkripto.test/MockTiposkripto.d.ts +0 -15
  684. package/dist/types/src/lib/Tiposkripto.test/Tiposkripto.adapter.d.ts +0 -3
  685. package/dist/types/src/lib/Tiposkripto.test/Tiposkripto.d.ts +0 -2
  686. package/dist/types/src/lib/Tiposkripto.test/Tiposkripto.implementation.d.ts +0 -3
  687. package/dist/types/src/lib/Tiposkripto.test/Tiposkripto.specification.d.ts +0 -3
  688. package/dist/types/src/lib/Tiposkripto.test/Tiposkripto.types.d.ts +0 -53
  689. package/dist/types/src/lib/abstractBase.test/MockGiven.d.ts +0 -9
  690. package/dist/types/src/lib/abstractBase.test/MockThen.d.ts +0 -6
  691. package/dist/types/src/lib/abstractBase.test/MockWhen.d.ts +0 -6
  692. package/dist/types/src/lib/abstractBase.test/adapter.d.ts +0 -3
  693. package/dist/types/src/lib/abstractBase.test/implementation.d.ts +0 -3
  694. package/dist/types/src/lib/abstractBase.test/index.d.ts +0 -2
  695. package/dist/types/src/lib/abstractBase.test/specification.d.ts +0 -3
  696. package/dist/types/src/lib/abstractBase.test/types.d.ts +0 -39
  697. package/dist/types/src/lib/index.d.ts +0 -67
  698. package/dist/types/src/lib/pmProxy.d.ts +0 -12
  699. package/dist/types/src/lib/pmProxy.test/adapter.d.ts +0 -3
  700. package/dist/types/src/lib/pmProxy.test/implementation.d.ts +0 -3
  701. package/dist/types/src/lib/pmProxy.test/index.d.ts +0 -6
  702. package/dist/types/src/lib/pmProxy.test/mockPM.d.ts +0 -10
  703. package/dist/types/src/lib/pmProxy.test/mockPMBase.d.ts +0 -40
  704. package/dist/types/src/lib/pmProxy.test/specification.d.ts +0 -3
  705. package/dist/types/src/lib/pmProxy.test/types.d.ts +0 -42
  706. package/dist/types/src/lib/types.d.ts +0 -24
  707. package/dist/types/src/mothership/index.d.ts +0 -2
  708. package/dist/types/src/mothership/test.d.ts +0 -2
  709. package/dist/types/src/testeranto.d.ts +0 -1
  710. package/dist/types/src/types/features.d.ts +0 -7
  711. package/dist/types/src/utils/api.d.ts +0 -9
  712. package/dist/types/src/utils/buildTemplates.d.ts +0 -1
  713. package/dist/types/src/utils/featureUtils.d.ts +0 -6
  714. package/dist/types/src/utils/golingvuMetafile.d.ts +0 -19
  715. package/dist/types/src/utils/logFiles.d.ts +0 -75
  716. package/dist/types/src/utils/makePrompt.d.ts +0 -2
  717. package/dist/types/src/utils/pitonoMetafile.d.ts +0 -7
  718. package/dist/types/src/utils/queue.d.ts +0 -11
  719. package/dist/types/src/utils.d.ts +0 -20
  720. package/dist/types/src/web.html.d.ts +0 -2
  721. package/dist/types/tsconfig.types.tsbuildinfo +0 -1
  722. package/pitono/__init__.py +0 -54
  723. package/pitono/types.py +0 -78
  724. package/src/golingvu/base_suite_test.go +0 -197
  725. package/src/templates/frontpage.html +0 -340
  726. package/src/templates/frontpage.md +0 -79
  727. package/testeranto/reports/core/src/lib/BaseSuite.test/web.test/web/tests.json +0 -29
  728. /package/{pitono → src/pitono}/core_generator.py +0 -0
  729. /package/{pitono → src/pitono}/pitono.egg-info/dependency_links.txt +0 -0
  730. /package/{pitono → src/pitono}/pitono.egg-info/entry_points.txt +0 -0
  731. /package/{pitono → src/pitono}/pitono.egg-info/top_level.txt +0 -0
  732. /package/{pitono → src/pitono}/pyproject.toml +0 -0
  733. /package/{pitono → src/pitono}/setup.py +0 -0
  734. /package/{pitono → src/pitono}/simple_adapter.py +0 -0
  735. /package/{dist/types/src/PM/types.d.ts → testeranto/helpo_chat_message.txt} +0 -0
  736. /package/{dist/types/src/components/SunriseAnimation.test/implementation.d.ts → testeranto/reports/core/example/test_example/python/stdout.log} +0 -0
  737. /package/{dist/types/src/components/SunriseAnimation.test/index.d.ts → testeranto/reports/core/src/Pure.test/pure/exit.log} +0 -0
  738. /package/{dist/types/src/components/SunriseAnimation.test/specification.d.ts → testeranto/reports/core/src/Pure.test/pure/lint_errors.txt} +0 -0
  739. /package/{dist/types/src/components/pure/SingleProcessView.d.ts → testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/debug.log} +0 -0
  740. /package/{dist/types/src/run.d.ts → testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/error.log} +0 -0
package/src/PM/main.ts CHANGED
@@ -3,1174 +3,78 @@
3
3
  /* eslint-disable @typescript-eslint/no-explicit-any */
4
4
  /* eslint-disable @typescript-eslint/no-unused-vars */
5
5
 
6
- import { ChildProcess, spawn } from "node:child_process";
6
+ import { spawn } from "node:child_process";
7
7
  import ansiColors from "ansi-colors";
8
8
  import net from "net";
9
- import { Page } from "puppeteer-core/lib/esm/puppeteer";
10
- import fs, { watch } from "fs";
11
- import path from "path";
12
- import puppeteer, { ConsoleMessage } from "puppeteer-core";
9
+ import fs from "fs";
10
+ import { ConsoleMessage } from "puppeteer-core";
13
11
  import ansiC from "ansi-colors";
14
- import crypto from "node:crypto";
15
- import { WebSocketServer } from "ws";
16
- import http from "http";
17
- import url from "url";
18
- import mime from "mime-types";
19
12
 
20
13
  import {
21
14
  IFinalResults,
22
- IRunnables,
23
15
  ITTestResourceConfiguration,
16
+ IRunTime,
24
17
  } from "../lib/index.js";
25
- import { getRunnables } from "../utils";
26
- import { IBuiltConfig, IRunTime, ITestTypes } from "../Types.js";
27
- import { Sidecar } from "../lib/Sidecar.js";
18
+ import { webEvaluator } from "../utils";
28
19
  import { Queue } from "../utils/queue.js";
29
20
 
30
- import { PM_WithEslintAndTsc } from "./PM_WithEslintAndTsc.js";
21
+ import { createLogStreams, statusMessagePretty } from "./utils.js";
22
+ import { PM_WithHelpo } from "./PM_WithHelpo.js";
23
+ import path from "node:path";
31
24
 
32
- type IOutputs = Record<
33
- string,
34
- {
35
- entryPoint: string;
36
- inputs: Record<string, string>;
37
- }
38
- >;
39
-
40
- const changes: Record<string, string> = {};
41
- const fileHashes = {};
42
25
  const files: Record<string, Set<string>> = {};
43
26
  const screenshots: Record<string, Promise<Uint8Array>[]> = {};
44
27
 
45
- type LogStreams = {
46
- closeAll: () => void;
47
- writeExitCode: (code: number, error?: Error) => void;
48
- stdout?: fs.WriteStream;
49
- stderr?: fs.WriteStream;
50
- info?: fs.WriteStream;
51
- warn?: fs.WriteStream;
52
- error?: fs.WriteStream;
53
- debug?: fs.WriteStream;
54
- exit: fs.WriteStream;
55
- };
56
-
57
- function runtimeLogs(
58
- runtime: IRunTime,
59
- reportDest: string
60
- ): Record<string, fs.WriteStream> {
61
- const safeDest = reportDest || `testeranto/reports/default_${Date.now()}`;
62
-
63
- try {
64
- if (!fs.existsSync(safeDest)) {
65
- fs.mkdirSync(safeDest, { recursive: true });
66
- }
67
-
68
- if (runtime === "node") {
69
- return {
70
- stdout: fs.createWriteStream(`${safeDest}/stdout.log`),
71
- stderr: fs.createWriteStream(`${safeDest}/stderr.log`),
72
- exit: fs.createWriteStream(`${safeDest}/exit.log`),
73
- };
74
- } else if (runtime === "web") {
75
- return {
76
- info: fs.createWriteStream(`${safeDest}/info.log`),
77
- warn: fs.createWriteStream(`${safeDest}/warn.log`),
78
- error: fs.createWriteStream(`${safeDest}/error.log`),
79
- debug: fs.createWriteStream(`${safeDest}/debug.log`),
80
- exit: fs.createWriteStream(`${safeDest}/exit.log`),
81
- };
82
- } else if (runtime === "pure") {
83
- return {
84
- exit: fs.createWriteStream(`${safeDest}/exit.log`),
85
- };
86
- } else if (runtime === "pitono") {
87
- return {
88
- stdout: fs.createWriteStream(`${safeDest}/stdout.log`),
89
- stderr: fs.createWriteStream(`${safeDest}/stderr.log`),
90
- exit: fs.createWriteStream(`${safeDest}/exit.log`),
91
- };
92
- } else {
93
- throw `unknown runtime: ${runtime}`;
94
- }
95
- } catch (e) {
96
- console.error(`Failed to create log streams in ${safeDest}:`, e);
97
- throw e;
98
- }
99
- }
100
-
101
- function createLogStreams(reportDest: string, runtime: IRunTime): LogStreams {
102
- // Create directory if it doesn't exist
103
- if (!fs.existsSync(reportDest)) {
104
- fs.mkdirSync(reportDest, { recursive: true });
105
- }
106
-
107
- const streams = runtimeLogs(runtime, reportDest);
108
-
109
- // const streams = {
110
- // exit: fs.createWriteStream(`${reportDest}/exit.log`),
111
- const safeDest = reportDest || `testeranto/reports/default_${Date.now()}`;
112
-
113
- try {
114
- if (!fs.existsSync(safeDest)) {
115
- fs.mkdirSync(safeDest, { recursive: true });
116
- }
117
-
118
- const streams = runtimeLogs(runtime, safeDest);
119
- // const streams = {
120
- // exit: fs.createWriteStream(`${safeDest}/exit.log`),
121
- // ...(runtime === "node" || runtime === "pure"
122
- // ? {
123
- // stdout: fs.createWriteStream(`${safeDest}/stdout.log`),
124
- // stderr: fs.createWriteStream(`${safeDest}/stderr.log`),
125
- // }
126
- // : {
127
- // info: fs.createWriteStream(`${safeDest}/info.log`),
128
- // warn: fs.createWriteStream(`${safeDest}/warn.log`),
129
- // error: fs.createWriteStream(`${safeDest}/error.log`),
130
- // debug: fs.createWriteStream(`${safeDest}/debug.log`),
131
- // }),
132
- // };
133
-
134
- return {
135
- ...streams,
136
- closeAll: () => {
137
- Object.values(streams).forEach(
138
- (stream) => !stream.closed && stream.close()
139
- );
140
- },
141
- writeExitCode: (code: number, error?: Error) => {
142
- if (error) {
143
- streams.exit.write(`Error: ${error.message}\n`);
144
- if (error.stack) {
145
- streams.exit.write(`Stack Trace:\n${error.stack}\n`);
146
- }
147
- }
148
- streams.exit.write(`${code}\n`);
149
- },
150
- exit: streams.exit,
151
- };
152
- } catch (e) {
153
- console.error(`Failed to create log streams in ${safeDest}:`, e);
154
- throw e;
155
- }
156
- }
157
-
158
- async function fileHash(filePath, algorithm = "md5") {
159
- return new Promise<string>((resolve, reject) => {
160
- const hash = crypto.createHash(algorithm);
161
- const fileStream = fs.createReadStream(filePath);
162
-
163
- fileStream.on("data", (data) => {
164
- hash.update(data);
165
- });
166
-
167
- fileStream.on("end", () => {
168
- const fileHash = hash.digest("hex");
169
- resolve(fileHash);
170
- });
171
-
172
- fileStream.on("error", (error) => {
173
- reject(`Error reading file: ${error.message}`);
174
- });
175
- });
176
- }
177
-
178
- const statusMessagePretty = (
179
- failures: number,
180
- test: string,
181
- runtime: IRunTime
182
- ) => {
183
- if (failures === 0) {
184
- console.log(ansiC.green(ansiC.inverse(`${runtime} > ${test}`)));
185
- } else if (failures > 0) {
186
- console.log(
187
- ansiC.red(
188
- ansiC.inverse(
189
- `${runtime} > ${test} failed ${failures} times (exit code: ${failures})`
190
- )
191
- )
192
- );
193
- } else {
194
- console.log(
195
- ansiC.red(ansiC.inverse(`${runtime} > ${test} crashed (exit code: -1)`))
196
- );
197
- }
198
- };
199
-
200
- async function writeFileAndCreateDir(filePath, data) {
201
- const dirPath = path.dirname(filePath);
202
-
203
- try {
204
- await fs.promises.mkdir(dirPath, { recursive: true });
205
- await fs.writeFileSync(filePath, data);
206
- } catch (error) {
207
- console.error(`Error writing file: ${error}`);
208
- }
209
- }
210
-
211
- const filesHash = async (files: string[], algorithm = "md5") => {
212
- return new Promise<string>((resolve, reject) => {
213
- resolve(
214
- files.reduce(async (mm: Promise<string>, f) => {
215
- return (await mm) + (await fileHash(f));
216
- }, Promise.resolve(""))
217
- );
218
- });
219
- };
220
-
221
- function isValidUrl(string) {
222
- try {
223
- new URL(string);
224
- return true;
225
- } catch (err) {
226
- return false;
227
- }
228
- }
229
-
230
- // Wait for file to exist, checks every 2 seconds by default
231
- async function pollForFile(path, timeout = 2000) {
232
- const intervalObj = setInterval(function () {
233
- const file = path;
234
- const fileExists = fs.existsSync(file);
235
- if (fileExists) {
236
- clearInterval(intervalObj);
237
- }
238
- }, timeout);
239
- }
240
-
241
- export class PM_Main extends PM_WithEslintAndTsc {
242
- ports: Record<number, string>;
243
- queue: string[];
244
- logStreams: Record<string, ReturnType<typeof createLogStreams>> = {};
245
- webMetafileWatcher: fs.FSWatcher;
246
- nodeMetafileWatcher: fs.FSWatcher;
247
- importMetafileWatcher: fs.FSWatcher;
248
- pitonoMetafileWatcher: fs.FSWatcher;
249
- pureSidecars: Record<number, Sidecar>;
250
- nodeSidecars: Record<number, ChildProcess>;
251
- webSidecars: Record<number, Page>;
252
- sidecars: Record<number, any> = {};
253
- launchers: Record<string, () => void>;
254
-
255
- wss: WebSocketServer;
256
- clients: Set<any> = new Set();
257
- httpServer: http.Server;
258
- runningProcesses: Map<string, ChildProcess> = new Map();
259
- allProcesses: Map<
260
- string,
261
- {
262
- child?: ChildProcess;
263
- status: "running" | "exited" | "error";
264
- exitCode?: number;
265
- error?: string;
266
- command: string;
267
- pid?: number;
268
- timestamp: string;
269
- }
270
- > = new Map();
271
- processLogs: Map<string, string[]> = new Map();
272
-
273
- constructor(configs: IBuiltConfig, name: string, mode: "once" | "dev") {
274
- super(configs, name, mode);
275
-
276
- this.launchers = {};
277
- this.ports = {};
278
- this.queue = [];
279
-
280
- this.nodeSidecars = {};
281
- this.webSidecars = {};
282
- this.pureSidecars = {};
283
-
284
- this.configs.ports.forEach((element) => {
285
- this.ports[element] = ""; // set ports as open
286
- });
287
-
288
- // Create HTTP server
289
- this.httpServer = http.createServer(this.requestHandler.bind(this));
290
-
291
- // Start WebSocket server attached to the HTTP server
292
- this.wss = new WebSocketServer({ server: this.httpServer });
293
-
294
- this.wss.on("connection", (ws) => {
295
- this.clients.add(ws);
296
- console.log("Client connected");
297
-
298
- ws.on("message", (data) => {
299
- try {
300
- const message = JSON.parse(data.toString());
301
- if (message.type === "executeCommand") {
302
- // Validate the command starts with 'aider'
303
- if (message.command && message.command.trim().startsWith("aider")) {
304
- console.log(`Executing command: ${message.command}`);
305
- // Execute the command
306
- const processId = Date.now().toString();
307
- const child = spawn(message.command, {
308
- shell: true,
309
- cwd: process.cwd(),
310
- });
311
-
312
- // Track the process in both maps
313
- this.runningProcesses.set(processId, child);
314
- this.allProcesses.set(processId, {
315
- child,
316
- status: "running",
317
- command: message.command,
318
- pid: child.pid,
319
- timestamp: new Date().toISOString(),
320
- });
321
-
322
- // Initialize logs for this process
323
- this.processLogs.set(processId, []);
324
-
325
- // Broadcast process started
326
- this.broadcast({
327
- type: "processStarted",
328
- processId,
329
- command: message.command,
330
- timestamp: new Date().toISOString(),
331
- logs: [],
332
- });
333
-
334
- // Capture stdout and stderr
335
- child.stdout?.on("data", (data) => {
336
- const logData = data.toString();
337
- // Add to stored logs
338
- const logs = this.processLogs.get(processId) || [];
339
- logs.push(logData);
340
- this.processLogs.set(processId, logs);
341
-
342
- this.broadcast({
343
- type: "processStdout",
344
- processId,
345
- data: logData,
346
- timestamp: new Date().toISOString(),
347
- });
348
- });
349
-
350
- child.stderr?.on("data", (data) => {
351
- const logData = data.toString();
352
- // Add to stored logs
353
- const logs = this.processLogs.get(processId) || [];
354
- logs.push(logData);
355
- this.processLogs.set(processId, logs);
356
-
357
- this.broadcast({
358
- type: "processStderr",
359
- processId,
360
- data: logData,
361
- timestamp: new Date().toISOString(),
362
- });
363
- });
364
-
365
- child.on("error", (error) => {
366
- console.error(`Failed to execute command: ${error}`);
367
- this.runningProcesses.delete(processId);
368
- // Update the process status to error
369
- const processInfo = this.allProcesses.get(processId);
370
- if (processInfo) {
371
- this.allProcesses.set(processId, {
372
- ...processInfo,
373
- status: "error",
374
- error: error.message,
375
- });
376
- }
377
- this.broadcast({
378
- type: "processError",
379
- processId,
380
- error: error.message,
381
- timestamp: new Date().toISOString(),
382
- });
383
- });
384
-
385
- child.on("exit", (code) => {
386
- console.log(`Command exited with code ${code}`);
387
- // Remove from running processes but keep in allProcesses
388
- this.runningProcesses.delete(processId);
389
- // Update the process status to exited
390
- const processInfo = this.allProcesses.get(processId);
391
- if (processInfo) {
392
- this.allProcesses.set(processId, {
393
- ...processInfo,
394
- status: "exited",
395
- exitCode: code,
396
- });
397
- }
398
- this.broadcast({
399
- type: "processExited",
400
- processId,
401
- exitCode: code,
402
- timestamp: new Date().toISOString(),
403
- });
404
- });
405
- } else {
406
- console.error('Invalid command: must start with "aider"');
407
- }
408
- } else if (message.type === "getRunningProcesses") {
409
- // Send list of all processes (both running and completed) with their full logs
410
- const processes = Array.from(this.allProcesses.entries()).map(
411
- ([id, procInfo]) => ({
412
- processId: id,
413
- command: procInfo.command,
414
- pid: procInfo.pid,
415
- status: procInfo.status,
416
- exitCode: procInfo.exitCode,
417
- error: procInfo.error,
418
- timestamp: procInfo.timestamp,
419
- logs: this.processLogs.get(id) || [],
420
- })
421
- );
422
- ws.send(
423
- JSON.stringify({
424
- type: "runningProcesses",
425
- processes,
426
- })
427
- );
428
- } else if (message.type === "getProcess") {
429
- // Send specific process with full logs
430
- const processId = message.processId;
431
- const procInfo = this.allProcesses.get(processId);
432
- if (procInfo) {
433
- ws.send(
434
- JSON.stringify({
435
- type: "processData",
436
- processId,
437
- command: procInfo.command,
438
- pid: procInfo.pid,
439
- status: procInfo.status,
440
- exitCode: procInfo.exitCode,
441
- error: procInfo.error,
442
- timestamp: procInfo.timestamp,
443
- logs: this.processLogs.get(processId) || [],
444
- })
445
- );
446
- }
447
- } else if (message.type === "stdin") {
448
- // Handle stdin input for a process
449
- const processId = message.processId;
450
- const data = message.data;
451
- console.log("Received stdin for process", processId, ":", data);
452
- const childProcess = this.runningProcesses.get(processId);
453
-
454
- if (childProcess && childProcess.stdin) {
455
- console.log("Writing to process stdin");
456
- childProcess.stdin.write(data);
457
- } else {
458
- console.log(
459
- "Cannot write to stdin - process not found or no stdin:",
460
- {
461
- processExists: !!childProcess,
462
- stdinExists: childProcess?.stdin ? true : false,
463
- }
464
- );
465
- }
466
- } else if (message.type === "killProcess") {
467
- // Handle killing a process
468
- const processId = message.processId;
469
- console.log("Received killProcess for process", processId);
470
- const childProcess = this.runningProcesses.get(processId);
471
-
472
- if (childProcess) {
473
- console.log("Killing process");
474
- childProcess.kill("SIGTERM");
475
- // The process exit handler will update the status and broadcast the change
476
- } else {
477
- console.log("Cannot kill process - process not found:", {
478
- processExists: !!childProcess,
479
- });
480
- }
481
- }
482
- } catch (error) {
483
- console.error("Error handling WebSocket message:", error);
484
- }
485
- });
486
-
487
- ws.on("close", () => {
488
- this.clients.delete(ws);
489
- console.log("Client disconnected");
490
- });
491
-
492
- ws.on("error", (error) => {
493
- console.error("WebSocket error:", error);
494
- this.clients.delete(ws);
495
- });
496
- });
497
-
498
- // Start HTTP server
499
- const httpPort = Number(process.env.HTTP_PORT) || 3000;
500
- this.httpServer.listen(httpPort, () => {
501
- console.log(`HTTP server running on http://localhost:${httpPort}`);
502
- });
503
- }
504
-
505
- async stopSideCar(uid: number): Promise<any> {
506
- console.log(ansiC.green(ansiC.inverse(`stopSideCar ${uid}`)));
507
-
508
- Object.entries(this.pureSidecars).forEach(async ([k, v]) => {
509
- if (Number(k) === uid) {
510
- await this.pureSidecars[Number(k)].stop();
511
- delete this.pureSidecars[Number(k)];
512
- }
513
- });
514
-
515
- Object.entries(this.nodeSidecars).forEach(async ([k, v]) => {
516
- if (Number(k) === uid) {
517
- await this.nodeSidecars[Number(k)].send("stop");
518
- delete this.nodeSidecars[Number(k)];
519
- }
520
- });
521
-
522
- Object.entries(this.webSidecars).forEach(async ([k, v]) => {
523
- if (Number(k) === uid) {
524
- (await this.browser.pages()).forEach(async (p) => {
525
- if (p.mainFrame()._id === k) {
526
- await this.webSidecars[Number(k)].close();
527
- delete this.webSidecars[Number(k)];
528
- }
529
- });
530
- }
531
- });
532
-
533
- return;
534
- }
535
-
536
- async launchSideCar(
537
- n: number,
538
- name: string
539
- ): Promise<[number, ITTestResourceConfiguration]> {
540
- const c = this.configs.tests.find(([v, r]) => {
541
- return v === name;
542
- }) as ITestTypes;
543
-
544
- const s = c[3][n];
545
-
546
- const r = s[1];
547
- if (r === "node") {
548
- return this.launchNodeSideCar(s);
549
- } else if (r === "web") {
550
- return this.launchWebSideCar(s);
551
- } else if (r === "pure") {
552
- return this.launchPureSideCar(s);
553
- } else {
554
- throw `unknown runtime ${r}`;
555
- }
556
- }
557
-
558
- mapping(): [string, (...a) => any][] {
559
- return [
560
- ["$", this.$],
561
- ["click", this.click],
562
- ["closePage", this.closePage],
563
- ["createWriteStream", this.createWriteStream],
564
- ["customclose", this.customclose],
565
- ["customScreenShot", this.customScreenShot.bind(this)],
566
- ["end", this.end],
567
- ["existsSync", this.existsSync],
568
- ["focusOn", this.focusOn],
569
- ["getAttribute", this.getAttribute],
570
- ["getInnerHtml", this.getInnerHtml],
571
- // ["setValue", this.setValue],
572
- ["goto", this.goto.bind(this)],
573
- ["isDisabled", this.isDisabled],
574
- ["launchSideCar", this.launchSideCar.bind(this)],
575
- ["mkdirSync", this.mkdirSync],
576
- ["newPage", this.newPage],
577
- ["page", this.page],
578
- ["pages", this.pages],
579
- ["screencast", this.screencast],
580
- ["screencastStop", this.screencastStop],
581
- ["stopSideCar", this.stopSideCar.bind(this)],
582
- ["typeInto", this.typeInto],
583
- ["waitForSelector", this.waitForSelector],
584
- ["write", this.write],
585
- ["writeFileSync", this.writeFileSync],
586
- ];
587
- }
588
-
589
- async start() {
590
- // set up the "pure" listeners
591
- this.mapping().forEach(async ([command, func]) => {
592
- globalThis[command] = func;
593
- });
594
-
595
- if (!fs.existsSync(`testeranto/reports/${this.name}`)) {
596
- fs.mkdirSync(`testeranto/reports/${this.name}`);
597
- }
598
-
599
- const executablePath = "/opt/homebrew/bin/chromium";
600
-
601
- try {
602
- this.browser = await puppeteer.launch({
603
- slowMo: 1,
604
- waitForInitialPage: false,
605
- executablePath,
606
- headless: true,
607
- defaultViewport: null, // Disable default 800x600 viewport
608
- dumpio: false,
609
- devtools: false,
610
-
611
- args: [
612
- "--allow-file-access-from-files",
613
- "--allow-insecure-localhost",
614
- "--allow-running-insecure-content",
615
- "--auto-open-devtools-for-tabs",
616
- "--disable-dev-shm-usage",
617
- "--disable-extensions",
618
- "--disable-features=site-per-process",
619
- "--disable-gpu",
620
- "--disable-setuid-sandbox",
621
- "--disable-site-isolation-trials",
622
- "--disable-web-security",
623
- "--no-first-run",
624
- "--no-sandbox",
625
- "--no-startup-window",
626
- "--reduce-security-for-testing",
627
- "--remote-allow-origins=*",
628
- "--start-maximized",
629
- "--unsafely-treat-insecure-origin-as-secure=*",
630
- `--remote-debugging-port=3234`,
631
- // "--disable-features=IsolateOrigins,site-per-process",
632
- // "--disable-features=IsolateOrigins",
633
- // "--disk-cache-dir=/dev/null",
634
- // "--disk-cache-size=1",
635
- // "--no-zygote",
636
- // "--remote-allow-origins=ws://localhost:3234",
637
- // "--single-process",
638
- // "--start-maximized",
639
- // "--unsafely-treat-insecure-origin-as-secure",
640
- // "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
641
- ],
642
- });
643
- } catch (e) {
644
- console.error(e);
645
- console.error(
646
- "could not start chrome via puppeter. Check this path: ",
647
- executablePath
648
- );
649
- }
650
-
651
- const { nodeEntryPoints, webEntryPoints, pureEntryPoints, pitonoEntryPoints } =
652
- this.getRunnables(this.configs.tests, this.name);
653
-
654
- [
655
- [
656
- nodeEntryPoints,
657
- this.launchNode,
658
- "node",
659
- (w) => {
660
- this.nodeMetafileWatcher = w;
661
- },
662
- ],
663
- [
664
- webEntryPoints,
665
- this.launchWeb,
666
- "web",
667
- (w) => {
668
- this.webMetafileWatcher = w;
669
- },
670
- ],
671
- [
672
- pureEntryPoints,
673
- this.launchPure,
674
- "pure",
675
- (w) => {
676
- this.importMetafileWatcher = w;
677
- },
678
- ],
679
- [
680
- pitonoEntryPoints,
681
- this.launchPitono,
682
- "pitono",
683
- (w) => {
684
- this.pitonoMetafileWatcher = w;
685
- },
686
- ],
687
- ].forEach(
688
- async ([eps, launcher, runtime, watcher]: [
689
- Record<string, string>,
690
- (src: string, dest: string) => Promise<void>,
691
- IRunTime,
692
- (f: fs.FSWatcher) => void
693
- ]) => {
694
- let metafile: string;
695
- if (runtime === "pitono") {
696
- metafile = `./testeranto/metafiles/python/core.json`;
697
- // Ensure the directory exists before trying to watch
698
- const metafileDir = path.dirname(metafile);
699
- if (!fs.existsSync(metafileDir)) {
700
- fs.mkdirSync(metafileDir, { recursive: true });
701
- }
702
- } else {
703
- metafile = `./testeranto/metafiles/${runtime}/${this.name}.json`;
704
- }
705
-
706
- // Only poll for file if it's not a pitono runtime
707
- if (runtime !== "pitono") {
708
- await pollForFile(metafile);
709
- }
710
-
711
- Object.entries(eps).forEach(
712
- async ([inputFile, outputFile]: [string, string]) => {
713
- // await pollForFile(outputFile);\
714
-
715
- this.launchers[inputFile] = () => launcher(inputFile, outputFile);
716
- this.launchers[inputFile]();
717
-
718
- try {
719
- watch(outputFile, async (e, filename) => {
720
- const hash = await fileHash(outputFile);
721
- if (fileHashes[inputFile] !== hash) {
722
- fileHashes[inputFile] = hash;
723
- console.log(
724
- ansiC.yellow(ansiC.inverse(`< ${e} ${filename}`))
725
- );
726
- // launcher(inputFile, outputFile);
727
- this.launchers[inputFile]();
728
- }
729
- });
730
- } catch (e) {
731
- console.error(e);
732
- }
733
- }
734
- );
735
-
736
- this.metafileOutputs(runtime);
737
-
738
- // For pitono, we need to wait for the file to be created
739
- if (runtime === "pitono") {
740
- // Use polling to wait for the file to exist
741
- const checkFileExists = () => {
742
- if (fs.existsSync(metafile)) {
743
- console.log(
744
- ansiC.green(ansiC.inverse(`Pitono metafile found: ${metafile}`))
745
- );
746
- // Set up the watcher once the file exists
747
- watcher(
748
- watch(metafile, async (e, filename) => {
749
- console.log(
750
- ansiC.yellow(ansiC.inverse(`< ${e} ${filename} (${runtime})`))
751
- );
752
- this.metafileOutputs(runtime);
753
- })
754
- );
755
- // Read the metafile immediately
756
- this.metafileOutputs(runtime);
757
- } else {
758
- // Check again after a delay
759
- setTimeout(checkFileExists, 1000);
760
- }
761
- };
762
- // Start checking for the file
763
- checkFileExists();
764
- } else {
765
- // For other runtimes, only set up watcher if the file exists
766
- if (fs.existsSync(metafile)) {
767
- watcher(
768
- watch(metafile, async (e, filename) => {
769
- console.log(
770
- ansiC.yellow(ansiC.inverse(`< ${e} ${filename} (${runtime})`))
771
- );
772
- this.metafileOutputs(runtime);
773
- })
774
- );
775
- }
776
- }
777
- }
778
- );
779
-
780
- // Object.keys(this.configs.externalTests).forEach((et) => {
781
- // this.launchExternalTest(et, this.configs.externalTests[et]);
782
- // });
783
- }
784
-
785
- // async launchExternalTest(
786
- // externalTestName: string,
787
- // externalTest: {
788
- // watch: string[];
789
- // exec: string;
790
- // }
791
- // ) {
792
- // // fs.mkdirSync(`testeranto/externalTests/${externalTestName}`);
793
- // // exec(externalTest.exec, (error, stdout, stderr) => {
794
- // // if (error) {
795
- // // fs.writeFileSync(
796
- // // `testeranto/externalTests/${externalTestName}/exitcode.txt`,
797
- // // `${error.name}\n${error.message}\n${error.code}\n`
798
- // // );
799
- // // } else {
800
- // // fs.writeFileSync(
801
- // // `testeranto/externalTests/${externalTestName}/exitcode.txt`,
802
- // // `0`
803
- // // );
804
- // // }
805
- // // fs.writeFileSync(
806
- // // `testeranto/externalTests/${externalTestName}/stdout.txt`,
807
- // // stdout
808
- // // );
809
- // // fs.writeFileSync(
810
- // // `testeranto/externalTests/${externalTestName}/stderr.txt`,
811
- // // stderr
812
- // // );
813
- // // });
814
- // }
815
-
816
- async stop() {
817
- console.log(ansiC.inverse("Testeranto-Run is shutting down gracefully..."));
818
- this.mode = "once";
819
- this.nodeMetafileWatcher.close();
820
- this.webMetafileWatcher.close();
821
- this.importMetafileWatcher.close();
822
- if (this.pitonoMetafileWatcher) {
823
- this.pitonoMetafileWatcher.close();
824
- }
825
-
826
- // Close any remaining log streams
827
- Object.values(this.logStreams || {}).forEach((logs) => logs.closeAll());
828
-
829
- // Close WebSocket server
830
- this.wss.close(() => {
831
- console.log("WebSocket server closed");
832
- });
833
-
834
- // Close all client connections
835
- this.clients.forEach((client) => {
836
- client.terminate();
837
- });
838
- this.clients.clear();
839
-
840
- // Close HTTP server
841
- this.httpServer.close(() => {
842
- console.log("HTTP server closed");
843
- });
844
-
845
- this.checkForShutdown();
846
- }
847
-
848
- getRunnables = (
849
- tests: ITestTypes[],
850
- testName: string,
851
- payload = {
852
- nodeEntryPoints: {},
853
- nodeEntryPointSidecars: {},
854
- webEntryPoints: {},
855
- webEntryPointSidecars: {},
856
- pureEntryPoints: {},
857
- pureEntryPointSidecars: {},
858
- }
859
- ): IRunnables => {
860
- return getRunnables(tests, testName, payload);
861
- };
862
-
863
- async metafileOutputs(platform: IRunTime) {
864
- let metafilePath: string;
865
- if (platform === "pitono") {
866
- metafilePath = `./testeranto/metafiles/python/core.json`;
867
- } else {
868
- metafilePath = `./testeranto/metafiles/${platform}/${this.name}.json`;
869
- }
870
-
871
- // Check if the file exists
872
- if (!fs.existsSync(metafilePath)) {
873
- if (platform === "pitono") {
874
- console.log(
875
- ansiC.yellow(ansiC.inverse(`Pitono metafile not found yet: ${metafilePath}`))
876
- );
877
- }
878
- return;
879
- }
880
-
881
- let metafile;
882
- try {
883
- const fileContent = fs.readFileSync(metafilePath).toString();
884
- const parsedData = JSON.parse(fileContent);
885
- // Handle different metafile structures
886
- if (platform === "pitono") {
887
- // Pitono metafile might be the entire content or have a different structure
888
- metafile = parsedData.metafile || parsedData;
889
- } else {
890
- metafile = parsedData.metafile;
891
- }
892
- if (!metafile) {
893
- console.log(
894
- ansiC.yellow(ansiC.inverse(`No metafile found in ${metafilePath}`))
895
- );
896
- return;
897
- }
898
- } catch (error) {
899
- console.error(`Error reading metafile at ${metafilePath}:`, error);
900
- return;
901
- }
902
-
903
- const outputs: IOutputs = metafile.outputs;
904
-
905
- Object.keys(outputs).forEach(async (k) => {
906
- const pattern = `testeranto/bundles/${platform}/${this.name}/${this.configs.src}`;
907
- if (!k.startsWith(pattern)) {
908
- return false;
909
- }
910
-
911
- const addableFiles = Object.keys(outputs[k].inputs).filter((i) => {
912
- if (!fs.existsSync(i)) return false;
913
- if (i.startsWith("node_modules")) return false;
914
- if (i.startsWith("./node_modules")) return false;
915
-
916
- return true;
917
- });
918
-
919
- const f = `${k.split(".").slice(0, -1).join(".")}/`;
920
-
921
- if (!fs.existsSync(f)) {
922
- fs.mkdirSync(f);
923
- }
924
-
925
- const entrypoint = outputs[k].entryPoint;
926
-
927
- if (entrypoint) {
928
- const changeDigest = await filesHash(addableFiles);
929
-
930
- if (changeDigest === changes[entrypoint]) {
931
- // skip
932
- } else {
933
- changes[entrypoint] = changeDigest;
934
- this.tscCheck({
935
- platform,
936
- addableFiles,
937
- entrypoint: entrypoint,
938
- });
939
- this.eslintCheck(entrypoint, platform, addableFiles);
940
- this.makePrompt(entrypoint, addableFiles, platform);
941
- }
942
- }
943
- });
944
- }
945
-
946
- launchPure = async (src: string, dest: string) => {
947
- console.log(ansiC.green(ansiC.inverse(`pure < ${src}`)));
28
+ export class PM_Main extends PM_WithHelpo {
29
+ private async setupTestEnvironment(
30
+ src: string,
31
+ runtime: IRunTime
32
+ ): Promise<{
33
+ reportDest: string;
34
+ testConfig: any;
35
+ testConfigResource: any;
36
+ portsToUse: string[];
37
+ testResources: string;
38
+ }> {
948
39
  this.bddTestIsRunning(src);
949
40
 
950
41
  const reportDest = `testeranto/reports/${this.name}/${src
951
42
  .split(".")
952
43
  .slice(0, -1)
953
- .join(".")}/pure`;
44
+ .join(".")}/${runtime}`;
954
45
 
955
46
  if (!fs.existsSync(reportDest)) {
956
47
  fs.mkdirSync(reportDest, { recursive: true });
957
48
  }
958
49
 
959
- const destFolder = dest.replace(".mjs", "");
960
-
961
- let argz = "";
962
-
963
- const testConfig = this.configs.tests.find((t) => {
964
- return t[0] === src;
965
- });
966
-
967
- if (!testConfig) {
968
- console.log(ansiC.inverse("missing test config! Exiting ungracefully!"));
969
- process.exit(-1);
970
- }
971
- const testConfigResource = testConfig[2];
972
-
973
- const portsToUse: string[] = [];
974
- if (testConfigResource.ports === 0) {
975
- argz = JSON.stringify({
976
- scheduled: true,
977
- name: src,
978
- ports: portsToUse,
979
- fs: reportDest,
980
- browserWSEndpoint: this.browser.wsEndpoint(),
981
- });
982
- } else if (testConfigResource.ports > 0) {
983
- const openPorts = Object.entries(this.ports).filter(
984
- ([portnumber, status]) => status === ""
985
- );
986
-
987
- if (openPorts.length >= testConfigResource.ports) {
988
- for (let i = 0; i < testConfigResource.ports; i++) {
989
- portsToUse.push(openPorts[i][0]);
990
-
991
- this.ports[openPorts[i][0]] = src; // port is now claimed
992
- }
993
-
994
- argz = JSON.stringify({
995
- scheduled: true,
996
- name: src,
997
- ports: portsToUse,
998
- fs: destFolder,
999
- browserWSEndpoint: this.browser.wsEndpoint(),
1000
- });
1001
- } else {
1002
- this.queue.push(src);
1003
- return [Math.random(), argz];
1004
- }
1005
- } else {
1006
- console.error("negative port makes no sense", src);
1007
- process.exit(-1);
1008
- }
1009
-
1010
- const builtfile = dest;
1011
-
1012
- // const webSideCares: Page[] = [];
1013
-
1014
- // fs.writeFileSync(
1015
- // `${reportDest}/stdlog.txt`,
1016
- // "THIS FILE IS AUTO GENERATED. IT IS PURPOSEFULLY LEFT BLANK."
1017
- // );
1018
-
1019
- // await Promise.all(
1020
- // testConfig[3].map(async (sidecar) => {
1021
- // if (sidecar[1] === "web") {
1022
- // const s = await this.launchWebSideCar(
1023
- // sidecar[0],
1024
- // destinationOfRuntime(sidecar[0], "web", this.configs),
1025
- // sidecar
1026
- // );
1027
- // webSideCares.push(s);
1028
- // return s;
1029
- // }
1030
-
1031
- // if (sidecar[1] === "node") {
1032
- // return this.launchNodeSideCar(
1033
- // sidecar[0],
1034
- // destinationOfRuntime(sidecar[0], "node", this.configs),
1035
- // sidecar
1036
- // );
1037
- // }
1038
- // })
1039
- // );
1040
-
1041
- const logs = createLogStreams(reportDest, "pure");
1042
-
1043
- try {
1044
- await import(`${builtfile}?cacheBust=${Date.now()}`).then((module) => {
1045
- // Override console methods to redirect logs
1046
- // Only override stdout/stderr methods for pure runtime
1047
- const originalConsole = { ...console };
1048
-
1049
- // console.log = (...args) => {
1050
- // logs.stdout.write(args.join(" ") + "\n");
1051
- // originalConsole.log(...args);
1052
- // };
1053
-
1054
- // console.error = (...args) => {
1055
- // logs.stderr.write(args.join(" ") + "\n");
1056
- // originalConsole.error(...args);
1057
- // };
1058
-
1059
- return module.default
1060
- .then((defaultModule) => {
1061
- defaultModule
1062
- .receiveTestResourceConfig(argz)
1063
- .then(async (results: IFinalResults) => {
1064
- // this.receiveFeatures(results.features, destFolder, src, "pure");
1065
- // this.receiveFeaturesV2(reportDest, src, "pure");
1066
-
1067
- statusMessagePretty(results.fails, src, "pure");
1068
- this.bddTestIsNowDone(src, results.fails);
1069
- })
1070
- .catch((e1) => {
1071
- console.log(
1072
- ansiC.red(`launchPure - ${src} errored with: ${e1.stack}`)
1073
- );
1074
- this.bddTestIsNowDone(src, -1);
1075
- statusMessagePretty(-1, src, "pure");
1076
- });
1077
- // .finally(() => {
1078
- // // webSideCares.forEach((webSideCar) => webSideCar.close());
1079
- // });
1080
- })
1081
- .catch((e2) => {
1082
- console.log(
1083
- ansiColors.red(
1084
- `pure ! ${src} failed to execute. No "tests.json" file was generated. Check the logs for more info`
1085
- )
1086
- );
1087
-
1088
- logs.exit.write(e2.stack);
1089
- logs.exit.write(-1);
1090
- this.bddTestIsNowDone(src, -1);
1091
- statusMessagePretty(-1, src, "pure");
1092
- // console.error(e);
1093
- })
1094
- .finally((x) => {
1095
- // const fileSet = files[src] || new Set();
1096
- // fs.writeFileSync(
1097
- // reportDest + "/manifest.json",
1098
- // JSON.stringify(Array.from(fileSet))
1099
- // );
1100
- });
1101
- });
1102
- } catch (e3) {
1103
- logs.writeExitCode(-1, e3);
1104
- console.log(
1105
- ansiC.red(
1106
- ansiC.inverse(
1107
- `${src} 1 errored with: ${e3}. Check logs for more info`
1108
- )
1109
- )
1110
- );
1111
-
1112
- logs.exit.write(e3.stack);
1113
- logs.exit.write("-1");
1114
- this.bddTestIsNowDone(src, -1);
1115
- statusMessagePretty(-1, src, "pure");
1116
- }
1117
-
1118
- for (let i = 0; i <= portsToUse.length; i++) {
1119
- if (portsToUse[i]) {
1120
- this.ports[portsToUse[i]] = ""; //port is open again
1121
- }
1122
- }
1123
- };
1124
-
1125
- launchNode = async (src: string, dest: string) => {
1126
- console.log(ansiC.green(ansiC.inverse(`node < ${src}`)));
1127
- this.bddTestIsRunning(src);
1128
-
1129
- const reportDest = `testeranto/reports/${this.name}/${src
1130
- .split(".")
1131
- .slice(0, -1)
1132
- .join(".")}/node`;
1133
- if (!fs.existsSync(reportDest)) {
1134
- fs.mkdirSync(reportDest, { recursive: true });
1135
- }
1136
-
1137
- // const destFolder = dest.replace(".mjs", "");
1138
-
1139
- let testResources = "";
1140
-
1141
- const testConfig = this.configs.tests.find((t) => {
1142
- return t[0] === src;
1143
- });
1144
-
50
+ const testConfig = this.configs.tests.find((t) => t[0] === src);
1145
51
  if (!testConfig) {
1146
52
  console.log(
1147
53
  ansiC.inverse(`missing test config! Exiting ungracefully for '${src}'`)
1148
54
  );
1149
55
  process.exit(-1);
1150
56
  }
1151
- const testConfigResource = testConfig[2];
1152
57
 
58
+ const testConfigResource = testConfig[2];
1153
59
  const portsToUse: string[] = [];
60
+ let testResources = "";
61
+
1154
62
  if (testConfigResource.ports === 0) {
1155
- const t: ITTestResourceConfiguration = {
63
+ testResources = JSON.stringify({
1156
64
  name: src,
1157
- // ports: portsToUse.map((v) => Number(v)),
1158
65
  ports: [],
1159
66
  fs: reportDest,
1160
67
  browserWSEndpoint: this.browser.wsEndpoint(),
1161
- };
1162
-
1163
- testResources = JSON.stringify(t);
68
+ });
1164
69
  } else if (testConfigResource.ports > 0) {
1165
- const openPorts: [string, string][] = Object.entries(this.ports).filter(
1166
- ([portnumber, portopen]) => portopen === ""
70
+ const openPorts = Object.entries(this.ports).filter(
71
+ ([, status]) => status === ""
1167
72
  );
1168
73
 
1169
74
  if (openPorts.length >= testConfigResource.ports) {
1170
75
  for (let i = 0; i < testConfigResource.ports; i++) {
1171
- portsToUse.push(openPorts[i][0]); // Convert string port to number
1172
-
1173
- this.ports[openPorts[i][0]] = src; // port is now claimed
76
+ portsToUse.push(openPorts[i][0]);
77
+ this.ports[openPorts[i][0]] = src;
1174
78
  }
1175
79
 
1176
80
  testResources = JSON.stringify({
@@ -1183,95 +87,66 @@ export class PM_Main extends PM_WithEslintAndTsc {
1183
87
  } else {
1184
88
  console.log(
1185
89
  ansiC.red(
1186
- `node: cannot run ${src} because there are no open ports ATM. This job will be enqueued and run again run a port is available`
90
+ `${runtime}: cannot run ${src} because there are no open ports ATM. This job will be enqueued and run again when a port is available`
1187
91
  )
1188
92
  );
1189
93
  this.queue.push(src);
1190
- return [Math.random(), argz]; // Add this return
94
+ throw new Error("No ports available");
1191
95
  }
1192
96
  } else {
1193
97
  console.error("negative port makes no sense", src);
1194
98
  process.exit(-1);
1195
99
  }
1196
100
 
1197
- const builtfile = dest;
1198
-
1199
- let haltReturns = false;
1200
-
1201
- const ipcfile = "/tmp/tpipe_" + Math.random();
1202
- const child = spawn(
1203
- "node",
1204
- // "node",
1205
- [
1206
- // "--inspect-brk",
1207
- builtfile,
1208
- testResources,
1209
- ipcfile,
1210
- ],
1211
- {
1212
- stdio: ["pipe", "pipe", "pipe", "ipc"],
1213
- }
1214
- );
1215
-
1216
- let buffer: Buffer<ArrayBufferLike> = new Buffer("");
1217
-
1218
- const server = net.createServer((socket) => {
1219
- const queue = new Queue<string[]>();
1220
-
1221
- socket.on("data", (data) => {
1222
- buffer = Buffer.concat([buffer, data]);
1223
-
1224
- for (let b = 0; b < buffer.length + 1; b++) {
1225
- const c = buffer.slice(0, b);
1226
- let d;
1227
- try {
1228
- d = JSON.parse(c.toString());
101
+ return {
102
+ reportDest,
103
+ testConfig,
104
+ testConfigResource,
105
+ portsToUse,
106
+ testResources,
107
+ };
108
+ }
1229
109
 
1230
- queue.enqueue(d);
1231
- buffer = buffer.slice(b, buffer.length + 1);
1232
- b = 0;
1233
- } catch (e) {
1234
- // b++;
1235
- }
1236
- }
110
+ private cleanupPorts(portsToUse: string[]) {
111
+ portsToUse.forEach((port) => {
112
+ this.ports[port] = "";
113
+ });
114
+ }
1237
115
 
1238
- while (queue.size() > 0) {
1239
- const message = queue.dequeue();
116
+ private createIpcServer(
117
+ onData: (data: Buffer) => void,
118
+ ipcfile: string
119
+ ): Promise<net.Server> {
120
+ return new Promise((resolve, reject) => {
121
+ const server = net.createServer((socket) => {
122
+ socket.on("data", onData);
123
+ });
1240
124
 
1241
- if (message) {
1242
- // set up the "node" listeners
1243
- this.mapping().forEach(async ([command, func]) => {
1244
- if (message[0] === command) {
1245
- const x = message.slice(1, -1);
1246
- const r = await this[command](...x);
1247
-
1248
- if (!haltReturns) {
1249
- child.send(
1250
- JSON.stringify({
1251
- payload: r,
1252
- key: message[message.length - 1],
1253
- })
1254
- );
1255
- }
1256
- }
1257
- });
1258
- }
1259
- }
125
+ server.listen(ipcfile, (err) => {
126
+ if (err) reject(err);
127
+ else resolve(server);
1260
128
  });
1261
- });
1262
129
 
1263
- const logs = createLogStreams(reportDest, "node");
130
+ server.on("error", reject);
131
+ });
132
+ }
1264
133
 
1265
- server.listen(ipcfile, () => {
1266
- // Only handle stdout/stderr for node runtime
134
+ private handleChildProcess(
135
+ child: ChildProcess,
136
+ logs: LogStreams,
137
+ reportDest: string,
138
+ src: string,
139
+ runtime: IRunTime
140
+ ): Promise<void> {
141
+ return new Promise((resolve, reject) => {
1267
142
  child.stdout?.on("data", (data) => {
1268
- logs.stdout?.write(data); // Add null check
143
+ logs.stdout?.write(data);
1269
144
  });
1270
145
 
1271
146
  child.stderr?.on("data", (data) => {
1272
- logs.stderr?.write(data); // Add null check
147
+ logs.stderr?.write(data);
1273
148
  });
1274
- child.on("error", (err) => {});
149
+
1275
150
  child.on("close", (code) => {
1276
151
  const exitCode = code === null ? -1 : code;
1277
152
  if (exitCode < 0) {
@@ -1283,45 +158,24 @@ export class PM_Main extends PM_WithEslintAndTsc {
1283
158
  logs.writeExitCode(exitCode);
1284
159
  }
1285
160
  logs.closeAll();
1286
- server.close();
1287
-
1288
- if (!files[src]) {
1289
- files[src] = new Set();
1290
- }
1291
161
 
1292
- if (exitCode === 255) {
162
+ if (exitCode === 0) {
163
+ this.bddTestIsNowDone(src, 0);
164
+ statusMessagePretty(0, src, runtime);
165
+ resolve();
166
+ } else {
1293
167
  console.log(
1294
168
  ansiColors.red(
1295
- `node ! ${src} failed to execute. No "tests.json" file was generated. Check ${reportDest}/stderr.log for more info`
169
+ `${runtime} ! ${src} failed to execute. Check ${reportDest}/stderr.log for more info`
1296
170
  )
1297
171
  );
1298
- this.bddTestIsNowDone(src, -1);
1299
- statusMessagePretty(-1, src, "node");
1300
- return;
1301
- } else if (exitCode === 0) {
1302
- this.bddTestIsNowDone(src, 0);
1303
- statusMessagePretty(0, src, "node");
1304
- } else {
1305
172
  this.bddTestIsNowDone(src, exitCode);
1306
- statusMessagePretty(exitCode, src, "node");
173
+ statusMessagePretty(exitCode, src, runtime);
174
+ reject(new Error(`Process exited with code ${exitCode}`));
1307
175
  }
1308
-
1309
- haltReturns = true;
1310
176
  });
1311
- child.on("exit", (code) => {
1312
- haltReturns = true;
1313
177
 
1314
- for (let i = 0; i <= portsToUse.length; i++) {
1315
- if (portsToUse[i]) {
1316
- this.ports[portsToUse[i]] = ""; //port is open again
1317
- }
1318
- }
1319
- });
1320
178
  child.on("error", (e) => {
1321
- console.log("error");
1322
-
1323
- haltReturns = true;
1324
-
1325
179
  console.log(
1326
180
  ansiC.red(
1327
181
  ansiC.inverse(
@@ -1330,898 +184,798 @@ export class PM_Main extends PM_WithEslintAndTsc {
1330
184
  )
1331
185
  );
1332
186
  this.bddTestIsNowDone(src, -1);
1333
- statusMessagePretty(-1, src, "node");
187
+ statusMessagePretty(-1, src, runtime);
188
+ reject(e);
1334
189
  });
1335
190
  });
1336
- };
1337
-
1338
- launchWebSideCar = async (
1339
- testConfig: ITestTypes
1340
- ): Promise<[number, Page]> => {
1341
- const src = testConfig[0];
1342
- const dest = src.split(".").slice(0, -1).join(".");
1343
- // const d = dest + ".mjs";
191
+ }
1344
192
 
1345
- const destFolder = dest.replace(".mjs", "");
193
+ launchPure = async (src: string, dest: string) => {
194
+ console.log(ansiC.green(ansiC.inverse(`pure < ${src}`)));
1346
195
 
1347
- console.log(ansiC.green(ansiC.inverse(`launchWebSideCar ${src}`)));
196
+ const processId = `pure-${src}-${Date.now()}`;
197
+ const command = `pure test: ${src}`;
1348
198
 
1349
- // const fileStreams2: fs.WriteStream[] = [];
1350
- // const doneFileStream2: Promise<any>[] = [];
199
+ // Create the promise
200
+ const purePromise = (async () => {
201
+ this.bddTestIsRunning(src);
1351
202
 
1352
- const logs = createLogStreams(dest, "web");
203
+ const reportDest = `testeranto/reports/${this.name}/${src
204
+ .split(".")
205
+ .slice(0, -1)
206
+ .join(".")}/pure`;
1353
207
 
1354
- return new Promise((res, rej) => {
1355
- this.browser
1356
- .newPage()
1357
- .then(async (page) => {
1358
- this.mapping().forEach(async ([command, func]) => {
1359
- page.exposeFunction(command, func);
1360
- });
208
+ if (!fs.existsSync(reportDest)) {
209
+ fs.mkdirSync(reportDest, { recursive: true });
210
+ }
1361
211
 
1362
- const close = () => {
1363
- if (!files[src]) {
1364
- files[src] = new Set();
1365
- }
1366
- // files[src].add(filepath);
212
+ const destFolder = dest.replace(".mjs", "");
1367
213
 
1368
- // fs.writeFileSync(
1369
- // destFolder + "/manifest.json",
1370
- // JSON.stringify(Array.from(files[src]))
1371
- // );
214
+ let argz = "";
1372
215
 
1373
- delete files[src];
216
+ const testConfig = this.configs.tests.find((t) => {
217
+ return t[0] === src;
218
+ });
1374
219
 
1375
- Promise.all(screenshots[src] || []).then(() => {
1376
- delete screenshots[src];
1377
- page.close();
1378
- });
1379
- };
220
+ if (!testConfig) {
221
+ console.log(
222
+ ansiC.inverse("missing test config! Exiting ungracefully!")
223
+ );
224
+ process.exit(-1);
225
+ }
226
+ const testConfigResource = testConfig[2];
1380
227
 
1381
- page.on("pageerror", (err: Error) => {
1382
- console.debug(`Error from ${src}: [${err.name}] `);
1383
- console.debug(`Error from ${src}: [${err.name}] `);
1384
- if (err.cause) {
1385
- console.debug(`Error from ${src} cause: [${err.cause}] `);
1386
- }
1387
- if (err.stack) {
1388
- console.debug(`Error from stack ${src}: [${err.stack}] `);
1389
- }
1390
- console.debug(`Error from message ${src}: [${err.message}] `);
1391
- this.bddTestIsNowDone(src, -1);
1392
- close();
1393
- });
228
+ const portsToUse: string[] = [];
229
+ if (testConfigResource.ports === 0) {
230
+ argz = JSON.stringify({
231
+ scheduled: true,
232
+ name: src,
233
+ ports: portsToUse,
234
+ fs: reportDest,
235
+ browserWSEndpoint: this.browser.wsEndpoint(),
236
+ });
237
+ } else if (testConfigResource.ports > 0) {
238
+ const openPorts = Object.entries(this.ports).filter(
239
+ ([portnumber, status]) => status === ""
240
+ );
1394
241
 
1395
- page.on("console", (log: ConsoleMessage) => {
1396
- const msg = `${log.text()}\n${JSON.stringify(
1397
- log.location()
1398
- )}\n${JSON.stringify(log.stackTrace())}\n`;
1399
- switch (log.type()) {
1400
- case "info":
1401
- logs.info?.write(msg);
1402
- break;
1403
- case "warn":
1404
- logs.warn?.write(msg);
1405
- break;
1406
- case "error":
1407
- logs.error?.write(msg);
1408
- break;
1409
- case "debug":
1410
- logs.debug?.write(msg);
1411
- break;
1412
- default:
1413
- break;
1414
- }
1415
- });
242
+ if (openPorts.length >= testConfigResource.ports) {
243
+ for (let i = 0; i < testConfigResource.ports; i++) {
244
+ portsToUse.push(openPorts[i][0]);
1416
245
 
1417
- await page.goto(`file://${`${destFolder}.html`}`, {});
246
+ this.ports[openPorts[i][0]] = src; // port is now claimed
247
+ }
1418
248
 
1419
- const webArgz = JSON.stringify({
1420
- name: dest,
1421
- ports: [].toString(),
1422
- fs: dest,
249
+ argz = JSON.stringify({
250
+ scheduled: true,
251
+ name: src,
252
+ ports: portsToUse,
253
+ fs: destFolder,
1423
254
  browserWSEndpoint: this.browser.wsEndpoint(),
1424
255
  });
256
+ } else {
257
+ this.queue.push(src);
258
+ return [Math.random(), argz];
259
+ }
260
+ } else {
261
+ console.error("negative port makes no sense", src);
262
+ process.exit(-1);
263
+ }
1425
264
 
1426
- const d = `${dest}?cacheBust=${Date.now()}`;
265
+ const builtfile = dest;
1427
266
 
1428
- const evaluation = `
1429
- import('${d}').then(async (x) => {
267
+ const logs = createLogStreams(reportDest, "pure");
1430
268
 
1431
269
  try {
1432
- return await (await x.default).receiveTestResourceConfig(${webArgz})
1433
- } catch (e) {
1434
- console.log("fail", e.toString())
1435
- }
1436
- })`;
1437
-
1438
- await page
1439
- .evaluate(evaluation)
1440
- .then(async ({ fails, failed, features }: IFinalResults) => {
1441
- // this.receiveFeatures(features, destFolder, src, "web");
1442
- // this.receiveFeaturesV2(reportDest, src, "web");
1443
-
1444
- statusMessagePretty(fails, src, "web");
1445
- this.bddTestIsNowDone(src, fails);
270
+ await import(`${builtfile}?cacheBust=${Date.now()}`).then((module) => {
271
+ return module.default
272
+ .then((defaultModule) => {
273
+ return defaultModule
274
+ .receiveTestResourceConfig(argz)
275
+ .then(async (results: IFinalResults) => {
276
+ // Ensure the test results are properly processed
277
+ // The receiveTestResourceConfig should handle creating tests.json
278
+ statusMessagePretty(results.fails, src, "pure");
279
+ this.bddTestIsNowDone(src, results.fails);
280
+ return results.fails;
281
+ });
1446
282
  })
1447
- .catch((e) => {
283
+ .catch((e2) => {
1448
284
  console.log(
1449
- ansiC.red(
1450
- ansiC.inverse(`launchWebSidecar - ${src} errored with: ${e}`)
285
+ ansiColors.red(
286
+ `pure ! ${src} failed to execute. No "tests.json" file was generated. Check the logs for more info`
1451
287
  )
1452
288
  );
1453
- })
1454
- .finally(() => {
1455
- this.bddTestIsNowDone(src, -1);
1456
- close();
1457
- });
1458
289
 
1459
- return page;
1460
-
1461
- // return page;
1462
- })
1463
- .then(async (page) => {
1464
- await page.goto(`file://${`${dest}.html`}`, {});
290
+ // Create a minimal tests.json even on failure
291
+ const testsJsonPath = `${reportDest}/tests.json`;
292
+ if (!fs.existsSync(testsJsonPath)) {
293
+ fs.writeFileSync(
294
+ testsJsonPath,
295
+ JSON.stringify(
296
+ {
297
+ tests: [],
298
+ features: [],
299
+ givens: [],
300
+ fullPath: src,
301
+ },
302
+ null,
303
+ 2
304
+ )
305
+ );
306
+ }
1465
307
 
1466
- res([Math.random(), page]);
308
+ logs.exit.write(e2.stack);
309
+ logs.exit.write(-1);
310
+ this.bddTestIsNowDone(src, -1);
311
+ statusMessagePretty(-1, src, "pure");
312
+ throw e2;
313
+ });
1467
314
  });
1468
- });
1469
- };
1470
-
1471
- launchNodeSideCar = async (
1472
- sidecar: ITestTypes
1473
- ): Promise<[number, ITTestResourceConfiguration]> => {
1474
- const src = sidecar[0];
1475
- const dest =
1476
- process.cwd() + `/testeranto/bundles/node/${this.name}/${sidecar[0]}`;
1477
- const d = dest + ".mjs";
1478
- console.log(ansiC.green(ansiC.inverse(`launchNodeSideCar ${sidecar[0]}`)));
1479
-
1480
- const destFolder = dest.replace(".ts", "");
1481
-
1482
- const reportDest = `testeranto/reports/${this.name}/${src
1483
- .split(".")
1484
- .slice(0, -1)
1485
- .join(".")}/node`;
1486
-
1487
- const argz: ITTestResourceConfiguration = {
1488
- name: sidecar[0],
1489
- ports: [],
1490
- fs: destFolder,
1491
- browserWSEndpoint: this.browser.wsEndpoint(),
1492
- };
1493
-
1494
- const testReq: { ports: number } = sidecar[2];
1495
-
1496
- const logs = createLogStreams(dest, "node");
315
+ } catch (e3) {
316
+ // Create a minimal tests.json even on uncaught errors
317
+ const testsJsonPath = `${reportDest}/tests.json`;
318
+ if (!fs.existsSync(testsJsonPath)) {
319
+ fs.writeFileSync(
320
+ testsJsonPath,
321
+ JSON.stringify(
322
+ {
323
+ tests: [],
324
+ features: [],
325
+ givens: [],
326
+ fullPath: src,
327
+ },
328
+ null,
329
+ 2
330
+ )
331
+ );
332
+ }
1497
333
 
1498
- const portsToUse: number[] = [];
1499
- if (testReq.ports === 0) {
1500
- // argz = {
1501
- // name: sidecar[0],
1502
- // ports: portsToUse,
1503
- // fs: destFolder,
1504
- // browserWSEndpoint: this.browser.wsEndpoint(),
1505
- // };
1506
- } else if (testReq.ports > 0) {
1507
- const openPorts = Object.entries(this.ports).filter(
1508
- ([portnumber, portopen]) => portopen === ""
1509
- );
334
+ logs.writeExitCode(-1, e3);
335
+ console.log(
336
+ ansiC.red(
337
+ ansiC.inverse(
338
+ `${src} 1 errored with: ${e3}. Check logs for more info`
339
+ )
340
+ )
341
+ );
1510
342
 
1511
- if (openPorts.length >= testReq.ports) {
1512
- for (let i = 0; i < testReq.ports; i++) {
1513
- portsToUse.push(Number(openPorts[i][0])); // Convert string port to number
343
+ logs.exit.write(e3.stack);
344
+ logs.exit.write("-1");
345
+ this.bddTestIsNowDone(src, -1);
346
+ statusMessagePretty(-1, src, "pure");
347
+ throw e3;
348
+ } finally {
349
+ // Generate prompt files for Pure tests
350
+ await this.generatePromptFiles(reportDest, src);
1514
351
 
1515
- this.ports[openPorts[i][0]] = src; // port is now closed
352
+ for (let i = 0; i <= portsToUse.length; i++) {
353
+ if (portsToUse[i]) {
354
+ this.ports[portsToUse[i]] = ""; // port is open again
355
+ }
1516
356
  }
357
+ }
358
+ })();
359
+
360
+ // Add to process manager
361
+ this.addPromiseProcess(
362
+ processId,
363
+ purePromise,
364
+ command,
365
+ "bdd-test",
366
+ src,
367
+ "pure"
368
+ );
369
+ };
1517
370
 
1518
- argz.ports = portsToUse;
371
+ launchNode = async (src: string, dest: string) => {
372
+ console.log(ansiC.green(ansiC.inverse(`node < ${src}`)));
1519
373
 
1520
- const builtfile = destFolder + ".mjs";
374
+ const processId = `node-${src}-${Date.now()}`;
375
+ const command = `node test: ${src}`;
1521
376
 
1522
- let haltReturns = false;
377
+ const nodePromise = (async () => {
378
+ try {
379
+ const { reportDest, testResources, portsToUse } =
380
+ await this.setupTestEnvironment(src, "node");
1523
381
 
1524
- let buffer: Buffer<ArrayBufferLike> = new Buffer("");
382
+ const builtfile = dest;
383
+ const ipcfile = "/tmp/tpipe_" + Math.random();
384
+ const logs = createLogStreams(reportDest, "node");
1525
385
 
1526
- const server = net.createServer((socket) => {
1527
- socket.on("data", (data) => {
1528
- buffer = Buffer.concat([buffer, data]);
386
+ let buffer = Buffer.from("");
387
+ const queue = new Queue<string[]>();
1529
388
 
1530
- const messages: string[][] = [];
1531
- for (let b = 0; b < buffer.length + 1; b++) {
1532
- const c = buffer.slice(0, b);
1533
- let d;
1534
- try {
1535
- d = JSON.parse(c.toString());
389
+ const onData = (data: Buffer) => {
390
+ buffer = Buffer.concat([buffer, data]);
1536
391
 
1537
- messages.push(d);
1538
- buffer = buffer.slice(b, buffer.length + 1);
1539
- b = 0;
1540
- } catch (e) {
1541
- // b++;
1542
- }
392
+ // Process complete JSON messages
393
+ for (let b = 0; b < buffer.length + 1; b++) {
394
+ const c = buffer.slice(0, b);
395
+ try {
396
+ const d = JSON.parse(c.toString());
397
+ queue.enqueue(d);
398
+ buffer = buffer.slice(b);
399
+ b = 0;
400
+ } catch (e) {
401
+ // Continue processing
1543
402
  }
403
+ }
1544
404
 
1545
- messages.forEach(async (payload) => {
405
+ // Process messages
406
+ while (queue.size() > 0) {
407
+ const message = queue.dequeue();
408
+ if (message) {
1546
409
  this.mapping().forEach(async ([command, func]) => {
1547
- if (payload[0] === command) {
1548
- const x = payload.slice(1, -1);
1549
- const r = await this[command](...x);
1550
-
1551
- if (!haltReturns) {
410
+ if (message[0] === command) {
411
+ const args = message.slice(1, -1);
412
+ try {
413
+ const result = await (this as any)[command](...args);
1552
414
  child.send(
1553
415
  JSON.stringify({
1554
- payload: r,
1555
- key: payload[payload.length - 1],
416
+ payload: result,
417
+ key: message[message.length - 1],
1556
418
  })
1557
419
  );
420
+ } catch (error) {
421
+ console.error(`Error handling command ${command}:`, error);
1558
422
  }
1559
423
  }
1560
424
  });
1561
- });
1562
- });
1563
- });
425
+ }
426
+ }
427
+ };
1564
428
 
1565
- const child = spawn("node", [builtfile, JSON.stringify(argz)], {
429
+ const server = await this.createIpcServer(onData, ipcfile);
430
+ const child = spawn("node", [builtfile, testResources, ipcfile], {
1566
431
  stdio: ["pipe", "pipe", "pipe", "ipc"],
1567
- // silent: true
1568
432
  });
1569
433
 
1570
- const p = "/tmp/tpipe" + Math.random();
1571
-
1572
- server.listen(p, () => {
1573
- child.on("close", (code) => {
1574
- server.close();
1575
- haltReturns = true;
1576
- });
1577
- child.on("exit", (code) => {
1578
- haltReturns = true;
1579
-
1580
- for (let i = 0; i <= portsToUse.length; i++) {
1581
- if (portsToUse[i]) {
1582
- this.ports[portsToUse[i]] = ""; //port is open again
1583
- }
1584
- }
1585
- });
1586
- child.on("error", (e) => {
1587
- if (fs.existsSync(p)) {
1588
- fs.rmSync(p);
1589
- }
434
+ try {
435
+ await this.handleChildProcess(child, logs, reportDest, src, "node");
1590
436
 
1591
- haltReturns = true;
437
+ // Generate prompt files for Node tests
438
+ await this.generatePromptFiles(reportDest, src);
439
+ } finally {
440
+ server.close();
441
+ this.cleanupPorts(portsToUse);
442
+ }
443
+ } catch (error) {
444
+ if (error.message !== "No ports available") {
445
+ throw error;
446
+ }
447
+ }
448
+ })();
449
+
450
+ this.addPromiseProcess(
451
+ processId,
452
+ nodePromise,
453
+ command,
454
+ "bdd-test",
455
+ src,
456
+ "node"
457
+ );
458
+ };
1592
459
 
1593
- console.log(
1594
- ansiC.red(
1595
- ansiC.inverse(
1596
- `launchNodeSideCar - ${src} errored with: ${e.name}. Check logs for more info`
1597
- )
1598
- )
1599
- );
1600
- logs.error?.write(e.toString() + "\n");
1601
- // this.bddTestIsNowDone(src, -1);
1602
- // statusMessagePretty(-1, src);
1603
- });
1604
- });
460
+ launchWeb = async (src: string, dest: string) => {
461
+ console.log(ansiC.green(ansiC.inverse(`web < ${src}`)));
1605
462
 
1606
- child.send({ path: p });
463
+ const processId = `web-${src}-${Date.now()}`;
464
+ const command = `web test: ${src}`;
1607
465
 
1608
- const r = Math.random();
1609
- this.nodeSidecars[r] = child;
1610
- return [r, argz];
1611
- } else {
1612
- console.log(
1613
- ansiC.red(
1614
- `cannot ${src} because there are no open ports. the job will be unqueued`
1615
- )
1616
- );
466
+ // Create the promise
467
+ const webPromise = (async () => {
468
+ this.bddTestIsRunning(src);
1617
469
 
1618
- this.queue.push(sidecar[0]);
1619
- return [Math.random(), argz];
470
+ const reportDest = `testeranto/reports/${this.name}/${src
471
+ .split(".")
472
+ .slice(0, -1)
473
+ .join(".")}/web`;
474
+ if (!fs.existsSync(reportDest)) {
475
+ fs.mkdirSync(reportDest, { recursive: true });
1620
476
  }
1621
- } else {
1622
- console.error("negative port makes no sense", sidecar[0]);
1623
- process.exit(-1);
1624
- }
1625
- };
1626
477
 
1627
- stopPureSideCar = async (uid: number) => {
1628
- console.log(ansiC.green(ansiC.inverse(`stopPureSideCar ${uid}`)));
1629
- await this.sidecars[uid].shutdown();
1630
- return;
1631
- };
478
+ const destFolder = dest.replace(".mjs", "");
1632
479
 
1633
- launchPureSideCar = async (
1634
- sidecar: ITestTypes
1635
- ): Promise<[number, ITTestResourceConfiguration]> => {
1636
- console.log(ansiC.green(ansiC.inverse(`launchPureSideCar ${sidecar[0]}`)));
480
+ const webArgz = JSON.stringify({
481
+ name: src,
482
+ ports: [].toString(),
483
+ fs: reportDest,
484
+ browserWSEndpoint: this.browser.wsEndpoint(),
485
+ });
1637
486
 
1638
- const r = Math.random();
487
+ const d = `${dest}?cacheBust=${Date.now()}`;
488
+
489
+ const logs = createLogStreams(reportDest, "web");
490
+
491
+ return new Promise<void>((resolve, reject) => {
492
+ this.browser
493
+ .newPage()
494
+ .then((page) => {
495
+ page.on("console", (log: ConsoleMessage) => {
496
+ const msg = `${log.text()}\n`;
497
+
498
+ switch (log.type()) {
499
+ case "info":
500
+ logs.info?.write(msg);
501
+ break;
502
+ case "warn":
503
+ logs.warn?.write(msg);
504
+ break;
505
+ case "error":
506
+ logs.error?.write(msg);
507
+ break;
508
+ case "debug":
509
+ logs.debug?.write(msg);
510
+ break;
511
+ default:
512
+ break;
513
+ }
514
+ });
1639
515
 
1640
- const dest =
1641
- process.cwd() + `/testeranto/bundles/pure/${this.name}/${sidecar[0]}`;
1642
- const builtfile = dest.split(".").slice(0, -1).concat("mjs").join(".");
516
+ page.on("close", () => {
517
+ logs.writeExitCode(0);
518
+ logs.closeAll();
519
+ });
1643
520
 
1644
- const destFolder = dest.replace(".mjs", "");
521
+ this.mapping().forEach(async ([command, func]) => {
522
+ if (command === "page") {
523
+ page.exposeFunction(command, (x?) => {
524
+ if (x) {
525
+ return func(x);
526
+ } else {
527
+ return func(page.mainFrame()._id);
528
+ }
529
+ });
530
+ } else {
531
+ return page.exposeFunction(command, func);
532
+ }
533
+ });
1645
534
 
1646
- let argz: ITTestResourceConfiguration;
535
+ return page;
536
+ })
537
+ .then(async (page) => {
538
+ const close = () => {
539
+ if (!files[src]) {
540
+ files[src] = new Set();
541
+ }
1647
542
 
1648
- const z = sidecar[2];
1649
- const testConfigResource: { ports: number } = sidecar[2];
1650
- const src = sidecar[0];
543
+ delete files[src];
1651
544
 
1652
- const portsToUse: number[] = [];
1653
- if (testConfigResource.ports === 0) {
1654
- argz = {
1655
- // scheduled: true,
1656
- name: src,
1657
- ports: portsToUse,
1658
- fs: destFolder,
1659
- browserWSEndpoint: this.browser.wsEndpoint(),
1660
- };
1661
- } else if (testConfigResource.ports > 0) {
1662
- const openPorts = Object.entries(this.ports).filter(
1663
- ([portnumber, portopen]) => portopen === ""
1664
- );
1665
- if (openPorts.length >= testConfigResource.ports) {
1666
- for (let i = 0; i < testConfigResource.ports; i++) {
1667
- portsToUse.push(Number(openPorts[i][0]));
545
+ Promise.all(screenshots[src] || []).then(() => {
546
+ delete screenshots[src];
547
+ page.close();
548
+ });
549
+ };
1668
550
 
1669
- this.ports[openPorts[i][0]] = src; // port is now claimed
1670
- }
551
+ page.on("pageerror", (err: Error) => {
552
+ logs.writeExitCode(-1, err);
553
+ console.log(
554
+ ansiColors.red(
555
+ `web ! ${src} failed to execute No "tests.json" file was generated. Check ${reportDest}/error.log for more info`
556
+ )
557
+ );
558
+ this.bddTestIsNowDone(src, -1);
559
+ close();
560
+ reject(err);
561
+ });
1671
562
 
1672
- argz = {
1673
- // scheduled: true,
1674
- name: src,
1675
- // ports: [3333],
1676
- ports: portsToUse,
1677
- fs: ".",
1678
- browserWSEndpoint: this.browser.wsEndpoint(),
1679
- };
1680
- } else {
1681
- this.queue.push(src);
1682
- // return;
1683
- }
1684
- } else {
1685
- console.error("negative port makes no sense", src);
1686
- process.exit(-1);
1687
- }
563
+ await page.goto(`file://${`${destFolder}.html`}`, {});
1688
564
 
1689
- // const builtfile = dest + ".mjs";
565
+ await page
566
+ .evaluate(webEvaluator(d, webArgz))
567
+ .then(async ({ fails, failed, features }: IFinalResults) => {
568
+ statusMessagePretty(fails, src, "web");
569
+ this.bddTestIsNowDone(src, fails);
570
+ resolve();
571
+ })
572
+ .catch((e) => {
573
+ console.log(ansiC.red(ansiC.inverse(e.stack)));
574
+ console.log(
575
+ ansiC.red(
576
+ ansiC.inverse(
577
+ `web ! ${src} failed to execute. No "tests.json" file was generated. Check logs for more info`
578
+ )
579
+ )
580
+ );
1690
581
 
1691
- await import(`${builtfile}?cacheBust=${Date.now()}`).then((module) => {
1692
- if (!this.pureSidecars) this.pureSidecars = {};
1693
- this.pureSidecars[r] = module.default;
1694
- this.pureSidecars[r].start(argz);
1695
- });
582
+ // Create a minimal tests.json even on failure
583
+ const testsJsonPath = `${reportDest}/tests.json`;
584
+ if (!fs.existsSync(testsJsonPath)) {
585
+ fs.writeFileSync(
586
+ testsJsonPath,
587
+ JSON.stringify(
588
+ {
589
+ tests: [],
590
+ features: [],
591
+ givens: [],
592
+ fullPath: src,
593
+ },
594
+ null,
595
+ 2
596
+ )
597
+ );
598
+ }
1696
599
 
1697
- return [r, argz];
1698
- // for (let i = 0; i <= portsToUse.length; i++) {
1699
- // if (portsToUse[i]) {
1700
- // this.ports[portsToUse[i]] = "true"; //port is open again
1701
- // }
1702
- // }
600
+ this.bddTestIsNowDone(src, -1);
601
+ reject(e);
602
+ })
603
+ .finally(async () => {
604
+ // Generate prompt files for Web tests
605
+ await this.generatePromptFiles(reportDest, src);
606
+ close();
607
+ });
608
+ })
609
+ .catch((error) => {
610
+ reject(error);
611
+ });
612
+ });
613
+ })();
614
+
615
+ // Add to process manager
616
+ this.addPromiseProcess(
617
+ processId,
618
+ webPromise,
619
+ command,
620
+ "bdd-test",
621
+ src,
622
+ "web"
623
+ );
1703
624
  };
1704
625
 
1705
- launchPitono = async (src: string, dest: string) => {
1706
- console.log(ansiC.green(ansiC.inverse(`pitono < ${src}`)));
1707
- this.bddTestIsRunning(src);
626
+ launchPython = async (src: string, dest: string) => {
627
+ console.log(ansiC.green(ansiC.inverse(`python < ${src}`)));
1708
628
 
1709
- const reportDest = `testeranto/reports/${this.name}/${src
1710
- .split(".")
1711
- .slice(0, -1)
1712
- .join(".")}/pitono`;
1713
- if (!fs.existsSync(reportDest)) {
1714
- fs.mkdirSync(reportDest, { recursive: true });
1715
- }
629
+ const processId = `python-${src}-${Date.now()}`;
630
+ const command = `python test: ${src}`;
1716
631
 
1717
- const logs = createLogStreams(reportDest, "node"); // Use node-style logs for pitono
632
+ const pythonPromise = (async () => {
633
+ try {
634
+ const { reportDest, testResources, portsToUse } =
635
+ await this.setupTestEnvironment(src, "python");
1718
636
 
1719
- try {
1720
- // Execute the Python test using the pitono runner
1721
- const { PitonoRunner } = await import('./pitonoRunner');
1722
- const runner = new PitonoRunner(this.configs, this.name);
1723
- await runner.run();
1724
-
1725
- this.bddTestIsNowDone(src, 0);
1726
- statusMessagePretty(0, src, "pitono");
1727
- } catch (error) {
1728
- logs.writeExitCode(-1, error);
1729
- console.log(
1730
- ansiC.red(
1731
- ansiC.inverse(
1732
- `${src} errored with: ${error}. Check logs for more info`
1733
- )
1734
- )
1735
- );
1736
- this.bddTestIsNowDone(src, -1);
1737
- statusMessagePretty(-1, src, "pitono");
1738
- }
1739
- };
637
+ const logs = createLogStreams(reportDest, "python");
1740
638
 
1741
- launchWeb = async (src: string, dest: string) => {
1742
- console.log(ansiC.green(ansiC.inverse(`web < ${src}`)));
1743
- this.bddTestIsRunning(src);
639
+ // Determine Python command
640
+ const venvPython = `./venv/bin/python3`;
641
+ const pythonCommand = fs.existsSync(venvPython)
642
+ ? venvPython
643
+ : "python3";
1744
644
 
1745
- const reportDest = `testeranto/reports/${this.name}/${src
1746
- .split(".")
1747
- .slice(0, -1)
1748
- .join(".")}/web`;
1749
- if (!fs.existsSync(reportDest)) {
1750
- fs.mkdirSync(reportDest, { recursive: true });
1751
- }
645
+ const ipcfile = "/tmp/tpipe_python_" + Math.random();
646
+ const child = spawn(pythonCommand, [src, testResources, ipcfile], {
647
+ stdio: ["pipe", "pipe", "pipe", "ipc"],
648
+ });
1752
649
 
1753
- const destFolder = dest.replace(".mjs", "");
650
+ // IPC server setup is similar to Node
651
+ let buffer = Buffer.from("");
652
+ const queue = new Queue<string[]>();
1754
653
 
1755
- const webArgz = JSON.stringify({
1756
- name: src,
1757
- ports: [].toString(),
1758
- fs: reportDest,
1759
- browserWSEndpoint: this.browser.wsEndpoint(),
1760
- });
654
+ const onData = (data: Buffer) => {
655
+ buffer = Buffer.concat([buffer, data]);
1761
656
 
1762
- const d = `${dest}?cacheBust=${Date.now()}`;
1763
-
1764
- const logs = createLogStreams(reportDest, "web");
1765
-
1766
- this.browser
1767
- .newPage()
1768
- .then((page) => {
1769
- page.on("console", (log: ConsoleMessage) => {
1770
- const msg = `${log.text()}\n`;
1771
-
1772
- switch (log.type()) {
1773
- case "info":
1774
- logs.info?.write(msg);
1775
- break;
1776
- case "warn":
1777
- logs.warn?.write(msg);
1778
- break;
1779
- case "error":
1780
- logs.error?.write(msg);
1781
- break;
1782
- case "debug":
1783
- logs.debug?.write(msg);
1784
- break;
1785
- default:
1786
- break;
657
+ for (let b = 0; b < buffer.length + 1; b++) {
658
+ const c = buffer.slice(0, b);
659
+ try {
660
+ const d = JSON.parse(c.toString());
661
+ queue.enqueue(d);
662
+ buffer = buffer.slice(b);
663
+ b = 0;
664
+ } catch (e) {
665
+ // Continue processing
666
+ }
1787
667
  }
1788
- });
1789
668
 
1790
- page.on("close", () => {
1791
- logs.writeExitCode(0); // Web tests exit with 0 unless there's an error
1792
- logs.closeAll();
1793
- logs.closeAll();
1794
- });
1795
- this.mapping().forEach(async ([command, func]) => {
1796
- if (command === "page") {
1797
- page.exposeFunction(command, (x?) => {
1798
- if (x) {
1799
- return func(x);
1800
- } else {
1801
- return func(page.mainFrame()._id);
1802
- }
1803
- });
1804
- } else {
1805
- return page.exposeFunction(command, func);
669
+ while (queue.size() > 0) {
670
+ const message = queue.dequeue();
671
+ if (message) {
672
+ this.mapping().forEach(async ([command, func]) => {
673
+ if (message[0] === command) {
674
+ const args = message.slice(1, -1);
675
+ try {
676
+ const result = await (this as any)[command](...args);
677
+ child.send(
678
+ JSON.stringify({
679
+ payload: result,
680
+ key: message[message.length - 1],
681
+ })
682
+ );
683
+ } catch (error) {
684
+ console.error(`Error handling command ${command}:`, error);
685
+ }
686
+ }
687
+ });
688
+ }
1806
689
  }
1807
- });
690
+ };
1808
691
 
1809
- return page;
1810
- })
1811
- .then(async (page) => {
1812
- const close = () => {
1813
- if (!files[src]) {
1814
- files[src] = new Set();
1815
- }
1816
- // files[t].add(filepath);
692
+ const server = await this.createIpcServer(onData, ipcfile);
1817
693
 
1818
- // fs.writeFileSync(
1819
- // destFolder + "/manifest.json",
1820
- // JSON.stringify(Array.from(files[src]))
1821
- // );
1822
- delete files[src];
694
+ try {
695
+ await this.handleChildProcess(child, logs, reportDest, src, "python");
1823
696
 
1824
- Promise.all(screenshots[src] || []).then(() => {
1825
- delete screenshots[src];
1826
- page.close();
1827
- });
697
+ // Generate prompt files for Python tests
698
+ await this.generatePromptFiles(reportDest, src);
699
+ } finally {
700
+ server.close();
701
+ this.cleanupPorts(portsToUse);
702
+ }
703
+ } catch (error) {
704
+ if (error.message !== "No ports available") {
705
+ throw error;
706
+ }
707
+ }
708
+ })();
709
+
710
+ this.addPromiseProcess(
711
+ processId,
712
+ pythonPromise,
713
+ command,
714
+ "bdd-test",
715
+ src,
716
+ "python"
717
+ );
718
+ };
1828
719
 
1829
- return;
1830
- };
720
+ launchGolang = async (src: string, dest: string) => {
721
+ console.log(ansiC.green(ansiC.inverse(`goland < ${src}`)));
1831
722
 
1832
- page.on("pageerror", (err: Error) => {
1833
- logs.writeExitCode(-1, err);
1834
- console.log(
1835
- ansiColors.red(
1836
- `web ! ${src} failed to execute No "tests.json" file was generated. Check ${reportDest}/error.log for more info`
1837
- )
1838
- );
1839
- this.bddTestIsNowDone(src, -1);
1840
- close();
1841
- });
723
+ const processId = `golang-${src}-${Date.now()}`;
724
+ const command = `golang test: ${src}`;
1842
725
 
1843
- // page.on("console", (log: ConsoleMessage) => {});
726
+ const golangPromise = (async () => {
727
+ try {
728
+ const { reportDest, testResources, portsToUse } =
729
+ await this.setupTestEnvironment(src, "golang");
1844
730
 
1845
- await page.goto(`file://${`${destFolder}.html`}`, {});
731
+ const logs = createLogStreams(reportDest, "golang");
1846
732
 
1847
- await page
1848
- .evaluate(
1849
- `
1850
- import('${d}').then(async (x) => {
1851
- try {
1852
- return await (await x.default).receiveTestResourceConfig(${webArgz})
1853
- } catch (e) {
1854
- console.log("web run failure", e.toString())
1855
- }
1856
- })
1857
- `
1858
- )
1859
- .then(async ({ fails, failed, features }: IFinalResults) => {
1860
- statusMessagePretty(fails, src, "web");
1861
- this.bddTestIsNowDone(src, fails);
1862
- // close();
1863
- })
1864
- .catch((e) => {
1865
- console.log(ansiC.red(ansiC.inverse(e.stack)));
733
+ // Create IPC file path
734
+ const ipcfile =
735
+ "/tmp/tpipe_golang_" + Math.random().toString(36).substring(2);
1866
736
 
1867
- console.log(
1868
- ansiC.red(
1869
- ansiC.inverse(
1870
- `web ! ${src} failed to execute. No "tests.json" file was generated. Check logs for more info`
1871
- )
1872
- )
1873
- );
1874
- this.bddTestIsNowDone(src, -1);
1875
- })
1876
- .finally(() => {
1877
- // process.exit(-1);
1878
- close();
1879
- });
737
+ let buffer = Buffer.from("");
738
+ const queue = new Queue<string[]>();
1880
739
 
1881
- return page;
1882
- });
1883
- };
740
+ const onData = (data: Buffer) => {
741
+ buffer = Buffer.concat([buffer, data]);
1884
742
 
1885
- receiveFeaturesV2 = (
1886
- reportDest: string,
1887
- srcTest: string,
1888
- platform: IRunTime
1889
- ) => {
1890
- const featureDestination = path.resolve(
1891
- process.cwd(),
1892
- "reports",
1893
- "features",
1894
- "strings",
1895
- srcTest.split(".").slice(0, -1).join(".") + ".features.txt"
1896
- );
743
+ // Process complete JSON messages
744
+ for (let b = 0; b < buffer.length + 1; b++) {
745
+ const c = buffer.slice(0, b);
746
+ try {
747
+ const d = JSON.parse(c.toString());
748
+ queue.enqueue(d);
749
+ buffer = buffer.slice(b);
750
+ b = 0;
751
+ } catch (e) {
752
+ // Continue processing
753
+ }
754
+ }
1897
755
 
1898
- // Read and parse the test report
1899
- const testReportPath = `${reportDest}/tests.json`;
1900
- if (!fs.existsSync(testReportPath)) {
1901
- console.error(`tests.json not found at: ${testReportPath}`);
1902
- return;
1903
- }
756
+ // Process messages
757
+ while (queue.size() > 0) {
758
+ const message = queue.dequeue();
759
+ if (message) {
760
+ this.mapping().forEach(async ([command, func]) => {
761
+ if (message[0] === command) {
762
+ const args = message.slice(1, -1);
763
+ try {
764
+ const result = await (this as any)[command](...args);
765
+ // Send response back through IPC
766
+ // This would need to be implemented based on your IPC protocol
767
+ } catch (error) {
768
+ console.error(`Error handling command ${command}:`, error);
769
+ }
770
+ }
771
+ });
772
+ }
773
+ }
774
+ };
1904
775
 
1905
- const testReport = JSON.parse(fs.readFileSync(testReportPath, "utf8"));
776
+ // Create IPC server like in launchNode
777
+ const server = await this.createIpcServer(onData, ipcfile);
1906
778
 
1907
- // Add full path information to each test
1908
- if (testReport.tests) {
1909
- testReport.tests.forEach((test) => {
1910
- // Add the full path to each test
1911
- test.fullPath = path.resolve(process.cwd(), srcTest);
1912
- });
1913
- }
779
+ // For Go tests, we need to run from the directory containing the go.mod file
780
+ // Find the nearest go.mod file by walking up the directory tree
781
+ let currentDir = path.dirname(src);
782
+ let goModDir = null;
1914
783
 
1915
- // Add full path to the report itself
1916
- testReport.fullPath = path.resolve(process.cwd(), srcTest);
1917
-
1918
- // Write the modified report back
1919
- fs.writeFileSync(testReportPath, JSON.stringify(testReport, null, 2));
1920
-
1921
- testReport.features
1922
- .reduce(async (mm, featureStringKey) => {
1923
- const accum = await mm;
1924
-
1925
- const isUrl = isValidUrl(featureStringKey);
1926
-
1927
- if (isUrl) {
1928
- const u = new URL(featureStringKey);
1929
-
1930
- if (u.protocol === "file:") {
1931
- const newPath = `${process.cwd()}/testeranto/features/internal/${path.relative(
1932
- process.cwd(),
1933
- u.pathname
1934
- )}`;
1935
-
1936
- // await fs.promises.mkdir(path.dirname(newPath), { recursive: true });
1937
-
1938
- // try {
1939
- // await fs.unlinkSync(newPath);
1940
- // // console.log(`Removed existing link at ${newPath}`);
1941
- // } catch (error) {
1942
- // if (error.code !== "ENOENT") {
1943
- // // throw error;
1944
- // }
1945
- // }
1946
-
1947
- // fs.symlink(u.pathname, newPath, (err) => {
1948
- // if (err) {
1949
- // // console.error("Error creating symlink:", err);
1950
- // } else {
1951
- // // console.log("Symlink created successfully");
1952
- // }
1953
- // });
1954
- accum.files.push(u.pathname);
1955
- } else if (u.protocol === "http:" || u.protocol === "https:") {
1956
- const newPath = `${process.cwd()}/testeranto/features/external/${
1957
- u.hostname
1958
- }${u.pathname}`;
1959
-
1960
- const body = await this.configs.featureIngestor(featureStringKey);
1961
-
1962
- writeFileAndCreateDir(newPath, body);
1963
- accum.files.push(newPath);
784
+ while (currentDir !== path.parse(currentDir).root) {
785
+ if (fs.existsSync(path.join(currentDir, "go.mod"))) {
786
+ goModDir = currentDir;
787
+ break;
1964
788
  }
1965
- } else {
1966
- await fs.promises.mkdir(path.dirname(featureDestination), {
1967
- recursive: true,
1968
- });
789
+ currentDir = path.dirname(currentDir);
790
+ }
1969
791
 
1970
- accum.strings.push(featureStringKey);
792
+ if (!goModDir) {
793
+ console.error(`Could not find go.mod file for test ${src}`);
794
+ // Try running from the test file's directory as a fallback
795
+ goModDir = path.dirname(src);
796
+ console.error(`Falling back to: ${goModDir}`);
1971
797
  }
1972
798
 
1973
- return accum;
1974
- }, Promise.resolve({ files: [] as string[], strings: [] as string[] }))
799
+ // Get the relative path to the test file from the go.mod directory
800
+ const relativeTestPath = path.relative(goModDir, src);
801
+
802
+ // Run go test from the directory containing go.mod
803
+ const child = spawn(
804
+ "go",
805
+ ["test", "-v", "-json", "./" + path.dirname(relativeTestPath)],
806
+ {
807
+ stdio: ["pipe", "pipe", "pipe"],
808
+ env: {
809
+ ...process.env,
810
+ TEST_RESOURCES: testResources,
811
+ IPC_FILE: ipcfile,
812
+ GO111MODULE: "on",
813
+ },
814
+ cwd: goModDir,
815
+ }
816
+ );
1975
817
 
1976
- .then(({ files, strings }: { files: string[]; strings: string[] }) => {
1977
- // Markdown files must be referenced in the prompt but string style features are already present in the tests.json file
818
+ await this.handleChildProcess(child, logs, reportDest, src, "golang");
1978
819
 
1979
- fs.writeFileSync(
1980
- `testeranto/reports/${this.name}/${srcTest
1981
- .split(".")
1982
- .slice(0, -1)
1983
- .join(".")}/${platform}/featurePrompt.txt`,
1984
- files
1985
- .map((f) => {
1986
- return `/read ${f}`;
1987
- })
1988
- .join("\n")
1989
- );
1990
- });
820
+ // Generate prompt files for Golang tests
821
+ await this.generatePromptFiles(reportDest, src);
1991
822
 
1992
- // const f: Record<string, string> = {};
823
+ // Ensure tests.json exists by parsing the go test JSON output
824
+ await this.processGoTestOutput(reportDest, src);
1993
825
 
1994
- testReport.givens.forEach((g) => {
1995
- if (g.failed === true) {
1996
- this.summary[srcTest].failingFeatures[g.key] = g.features;
826
+ // Clean up
827
+ server.close();
828
+ try {
829
+ fs.unlinkSync(ipcfile);
830
+ } catch (e) {
831
+ // Ignore errors during cleanup
832
+ }
833
+ this.cleanupPorts(portsToUse);
834
+ } catch (error) {
835
+ if (error.message !== "No ports available") {
836
+ throw error;
837
+ }
1997
838
  }
1998
- });
1999
-
2000
- // this.summary[srcTest].failingFeatures = f;
2001
- this.writeBigBoard();
839
+ })();
840
+
841
+ this.addPromiseProcess(
842
+ processId,
843
+ golangPromise,
844
+ command,
845
+ "bdd-test",
846
+ src,
847
+ "golang"
848
+ );
2002
849
  };
2003
850
 
2004
- requestHandler(req: http.IncomingMessage, res: http.ServerResponse) {
2005
- // Parse the URL
2006
- const parsedUrl = url.parse(req.url || "/");
2007
- let pathname = parsedUrl.pathname || "/";
2008
-
2009
- // Handle root path
2010
- if (pathname === "/") {
2011
- pathname = "/index.html";
2012
- }
851
+ private async processGoTestOutput(
852
+ reportDest: string,
853
+ src: string
854
+ ): Promise<void> {
855
+ const testsJsonPath = `${reportDest}/tests.json`;
2013
856
 
2014
- // Remove leading slash
2015
- let filePath = pathname.substring(1);
2016
-
2017
- // Determine which directory to serve from
2018
- if (filePath.startsWith("reports/")) {
2019
- // Serve from reports directory
2020
- filePath = `testeranto/${filePath}`;
2021
- } else if (filePath.startsWith("metafiles/")) {
2022
- // Serve from metafiles directory
2023
- filePath = `testeranto/${filePath}`;
2024
- } else if (filePath === "projects.json") {
2025
- // Serve projects.json
2026
- filePath = `testeranto/${filePath}`;
2027
- } else {
2028
- // For frontend assets, try multiple possible locations
2029
- // First, try the dist directory
2030
- const possiblePaths = [
2031
- `dist/${filePath}`,
2032
- `testeranto/dist/${filePath}`,
2033
- `../dist/${filePath}`,
2034
- `./${filePath}`,
2035
- ];
2036
-
2037
- // Find the first existing file
2038
- let foundPath = null;
2039
- for (const possiblePath of possiblePaths) {
2040
- if (fs.existsSync(possiblePath)) {
2041
- foundPath = possiblePath;
2042
- break;
2043
- }
2044
- }
857
+ // Parse the stdout.log to extract test results from JSON output
858
+ const stdoutPath = `${reportDest}/stdout.log`;
859
+ if (fs.existsSync(stdoutPath)) {
860
+ try {
861
+ const stdoutContent = fs.readFileSync(stdoutPath, "utf-8");
862
+ const lines = stdoutContent.split("\n").filter((line) => line.trim());
863
+
864
+ const testResults = {
865
+ tests: [],
866
+ features: [],
867
+ givens: [],
868
+ fullPath: path.resolve(process.cwd(), src),
869
+ };
2045
870
 
2046
- if (foundPath) {
2047
- filePath = foundPath;
2048
- } else {
2049
- // If no file found, serve index.html for SPA routing
2050
- const indexPath = this.findIndexHtml();
2051
- if (indexPath) {
2052
- fs.readFile(indexPath, (err, data) => {
2053
- if (err) {
2054
- res.writeHead(404, { "Content-Type": "text/plain" });
2055
- res.end("404 Not Found");
2056
- return;
871
+ // Parse each JSON line from go test output
872
+ for (const line of lines) {
873
+ try {
874
+ const event = JSON.parse(line);
875
+ if (event.Action === "pass" || event.Action === "fail") {
876
+ testResults.tests.push({
877
+ name: event.Test || event.Package,
878
+ status: event.Action === "pass" ? "passed" : "failed",
879
+ time: event.Elapsed ? `${event.Elapsed}s` : "0s",
880
+ });
2057
881
  }
2058
- res.writeHead(200, { "Content-Type": "text/html" });
2059
- res.end(data);
2060
- });
2061
- return;
2062
- } else {
2063
- res.writeHead(404, { "Content-Type": "text/plain" });
2064
- res.end("404 Not Found");
2065
- return;
2066
- }
2067
- }
2068
- }
2069
-
2070
- // Check if file exists
2071
- fs.exists(filePath, (exists) => {
2072
- if (!exists) {
2073
- // For SPA routing, serve index.html if the path looks like a route
2074
- if (!pathname.includes(".") && pathname !== "/") {
2075
- const indexPath = this.findIndexHtml();
2076
- if (indexPath) {
2077
- fs.readFile(indexPath, (err, data) => {
2078
- if (err) {
2079
- res.writeHead(404, { "Content-Type": "text/plain" });
2080
- res.end("404 Not Found");
2081
- return;
2082
- }
2083
- res.writeHead(200, { "Content-Type": "text/html" });
2084
- res.end(data);
2085
- });
2086
- return;
2087
- } else {
2088
- // Serve a simple message if index.html is not found
2089
- res.writeHead(200, { "Content-Type": "text/html" });
2090
- res.end(`
2091
- <html>
2092
- <body>
2093
- <h1>Testeranto is running</h1>
2094
- <p>Frontend files are not built yet. Run 'npm run build' to build the frontend.</p>
2095
- </body>
2096
- </html>
2097
- `);
2098
- return;
882
+ } catch (e) {
883
+ // Skip non-JSON lines
2099
884
  }
2100
885
  }
2101
- res.writeHead(404, { "Content-Type": "text/plain" });
2102
- res.end("404 Not Found");
2103
- return;
2104
- }
2105
-
2106
- // Read and serve the file
2107
- fs.readFile(filePath, (err, data) => {
2108
- if (err) {
2109
- res.writeHead(500, { "Content-Type": "text/plain" });
2110
- res.end("500 Internal Server Error");
2111
- return;
2112
- }
2113
-
2114
- // Get MIME type
2115
- const mimeType = mime.lookup(filePath) || "application/octet-stream";
2116
- res.writeHead(200, { "Content-Type": mimeType });
2117
- res.end(data);
2118
- });
2119
- });
2120
- }
2121
886
 
2122
- findIndexHtml(): string | null {
2123
- const possiblePaths = [
2124
- "dist/index.html",
2125
- "testeranto/dist/index.html",
2126
- "../dist/index.html",
2127
- "./index.html",
2128
- ];
2129
-
2130
- for (const path of possiblePaths) {
2131
- if (fs.existsSync(path)) {
2132
- return path;
887
+ fs.writeFileSync(testsJsonPath, JSON.stringify(testResults, null, 2));
888
+ return;
889
+ } catch (error) {
890
+ console.error("Error processing go test output:", error);
2133
891
  }
2134
892
  }
2135
- return null;
2136
- }
2137
893
 
2138
- broadcast(message: any) {
2139
- const data =
2140
- typeof message === "string" ? message : JSON.stringify(message);
2141
- this.clients.forEach((client) => {
2142
- if (client.readyState === 1) {
2143
- // WebSocket.OPEN
2144
- client.send(data);
2145
- }
2146
- });
894
+ // Fallback: create a basic tests.json if processing fails
895
+ const basicTestResult = {
896
+ tests: [],
897
+ features: [],
898
+ givens: [],
899
+ fullPath: path.resolve(process.cwd(), src),
900
+ };
901
+ fs.writeFileSync(testsJsonPath, JSON.stringify(basicTestResult, null, 2));
2147
902
  }
2148
903
 
2149
- checkQueue() {
2150
- const x = this.queue.pop();
2151
- if (!x) {
2152
- ansiC.inverse(`The following queue is empty`);
2153
- return;
2154
- }
2155
- const test = this.configs.tests.find((t) => t[0] === x);
2156
- if (!test) throw `test is undefined ${x}`;
904
+ private async generatePromptFiles(
905
+ reportDest: string,
906
+ src: string
907
+ ): Promise<void> {
908
+ try {
909
+ // Ensure the report directory exists
910
+ if (!fs.existsSync(reportDest)) {
911
+ fs.mkdirSync(reportDest, { recursive: true });
912
+ }
2157
913
 
2158
- // const [src, runtime, ...xx]: [string, IRunTime, ...any] = test;
2159
- this.launchers[test[0]]();
2160
- }
914
+ // Create message.txt
915
+ const messagePath = `${reportDest}/message.txt`;
916
+ const messageContent = `There are 3 types of test reports.
917
+ 1) bdd (highest priority)
918
+ 2) type checker
919
+ 3) static analysis (lowest priority)
2161
920
 
2162
- checkForShutdown = () => {
2163
- // console.log(ansiC.inverse(JSON.stringify(this.summary, null, 2)));
921
+ "tests.json" is the detailed result of the bdd tests.
922
+ if these files do not exist, then something has gone badly wrong and needs to be addressed.
2164
923
 
2165
- this.checkQueue();
924
+ "type_errors.txt" is the result of the type checker.
925
+ if this file does not exist, then type check passed without errors;
2166
926
 
2167
- console.log(
2168
- ansiC.inverse(
2169
- `The following jobs are awaiting resources: ${JSON.stringify(
2170
- this.queue
2171
- )}`
2172
- )
2173
- );
2174
- console.log(
2175
- ansiC.inverse(`The status of ports: ${JSON.stringify(this.ports)}`)
2176
- );
927
+ "lint_errors.txt" is the result of the static analysis.
928
+ if this file does not exist, then static analysis passed without errors;
2177
929
 
2178
- this.writeBigBoard();
930
+ BDD failures are the highest priority. Focus on passing BDD tests before addressing other concerns.
931
+ Do not add error throwing/catching to the tests themselves.`;
2179
932
 
2180
- if (this.mode === "dev") return;
933
+ fs.writeFileSync(messagePath, messageContent);
2181
934
 
2182
- let inflight = false;
935
+ // Create prompt.txt
936
+ const promptPath = `${reportDest}/prompt.txt`;
2183
937
 
2184
- Object.keys(this.summary).forEach((k) => {
2185
- if (this.summary[k].prompt === "?") {
2186
- console.log(ansiC.blue(ansiC.inverse(`🕕 prompt ${k}`)));
2187
- inflight = true;
2188
- }
2189
- });
938
+ const promptContent = `/read node_modules/testeranto/docs/index.md
939
+ /read node_modules/testeranto/docs/style.md
940
+ /read node_modules/testeranto/docs/testing.ai.txt
941
+ /read node_modules/testeranto/src/CoreTypes.ts
2190
942
 
2191
- Object.keys(this.summary).forEach((k) => {
2192
- if (this.summary[k].runTimeErrors === "?") {
2193
- console.log(ansiC.blue(ansiC.inverse(`🕕 runTimeError ${k}`)));
2194
- inflight = true;
2195
- }
2196
- });
943
+ /read ${reportDest}/tests.json
944
+ /read ${reportDest}/type_errors.txt
945
+ /read ${reportDest}/lint_errors.txt
2197
946
 
2198
- Object.keys(this.summary).forEach((k) => {
2199
- if (this.summary[k].staticErrors === "?") {
2200
- console.log(ansiC.blue(ansiC.inverse(`🕕 staticErrors ${k}`)));
2201
- inflight = true;
2202
- }
2203
- });
947
+ /read ${reportDest}/stdout.log
948
+ /read ${reportDest}/stderr.log
949
+ /read ${reportDest}/exit.log
950
+ /read ${reportDest}/message.txt`;
2204
951
 
2205
- Object.keys(this.summary).forEach((k) => {
2206
- if (this.summary[k].typeErrors === "?") {
2207
- console.log(ansiC.blue(ansiC.inverse(`🕕 typeErrors ${k}`)));
2208
- inflight = true;
2209
- }
2210
- });
952
+ fs.writeFileSync(promptPath, promptContent);
953
+ } catch (error) {
954
+ console.error(`Failed to generate prompt files for ${src}:`, error);
955
+ }
956
+ }
2211
957
 
2212
- this.writeBigBoard();
958
+ private getGolangSourceFiles(src: string): string[] {
959
+ // Get all .go files in the same directory as the test
960
+ const testDir = path.dirname(src);
961
+ const files: string[] = [];
2213
962
 
2214
- if (!inflight) {
2215
- if (this.browser) {
2216
- if (this.browser) {
2217
- this.browser.disconnect().then(() => {
2218
- console.log(
2219
- ansiC.inverse(`${this.name} has been tested. Goodbye.`)
2220
- );
2221
- process.exit();
2222
- });
963
+ try {
964
+ const dirContents = fs.readdirSync(testDir);
965
+ dirContents.forEach((file) => {
966
+ if (file.endsWith(".go")) {
967
+ files.push(path.join(testDir, file));
2223
968
  }
2224
- }
969
+ });
970
+ } catch (error) {
971
+ console.error(`Error reading directory ${testDir}:`, error);
2225
972
  }
2226
- };
973
+
974
+ // Always include the main test file
975
+ if (!files.includes(src)) {
976
+ files.push(src);
977
+ }
978
+
979
+ return files;
980
+ }
2227
981
  }