testeranto 0.200.1 → 0.202.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.
- package/README.md +26 -1
- package/design-editor/DesignEditor.tsx +40 -241
- package/dist/common/design-editor/DesignEditor.js +33 -198
- package/dist/common/src/App.js +158 -16
- package/dist/common/src/PM/PM_WithBuild.js +135 -0
- package/dist/common/src/PM/PM_WithEslintAndTsc.js +79 -67
- package/dist/common/src/PM/PM_WithGit.js +517 -0
- package/dist/common/src/PM/PM_WithProcesses.js +519 -0
- package/dist/common/src/PM/PM_WithWebSocket.js +535 -0
- package/dist/common/src/PM/base.js +62 -0
- package/dist/common/src/PM/main.js +533 -1676
- package/dist/common/src/PM/metafileOutputs.js +78 -0
- package/dist/common/src/PM/node.js +0 -6
- package/dist/common/src/PM/pure.js +0 -8
- package/dist/common/src/PM/types.js +1 -0
- package/dist/common/src/PM/utils.js +210 -0
- package/dist/common/src/PM/web.js +0 -6
- package/dist/common/src/ReportServer.js +0 -10
- package/dist/common/src/ReportServerLib.js +0 -140
- package/dist/common/src/components/pure/AppFrame.js +68 -56
- package/dist/common/src/components/pure/ArtifactTree.js +80 -0
- package/dist/common/src/components/pure/BuildLogViewer.js +106 -0
- package/dist/common/src/components/pure/DebugEnv.js +30 -0
- package/dist/common/src/components/pure/FileTree.js +34 -0
- package/dist/common/src/components/pure/FileTreeItem.js +29 -0
- package/dist/common/src/components/pure/GitHubLoginButton.js +18 -0
- package/dist/common/src/components/pure/GitIntegrationView.js +342 -0
- package/dist/common/src/components/pure/ProcessManager.js +1 -0
- package/dist/common/src/components/pure/ProcessManagerView.js +73 -74
- package/dist/common/src/components/pure/ProjectPageView.js +4 -117
- package/dist/common/src/components/pure/Settings.js +121 -0
- package/dist/common/src/components/pure/Settings.test.js +34 -0
- package/dist/common/src/components/pure/SignIn.js +22 -0
- package/dist/common/src/components/pure/SingleProcessView.js +166 -213
- package/dist/common/src/components/pure/TestPageView.js +113 -368
- package/dist/common/src/components/pure/TestPageView_utils.js +117 -0
- package/dist/common/src/components/pure/TestTable.js +33 -0
- package/dist/common/src/components/pure/ToastNotification.js +14 -0
- package/dist/common/src/components/pure/UserProfile.js +27 -0
- package/dist/common/src/components/stateful/AuthCallbackPage.js +51 -0
- package/dist/common/src/components/stateful/FeaturesReporter.js +2 -1
- package/dist/common/src/components/stateful/FileTree.js +58 -39
- package/dist/common/src/components/stateful/GitIntegrationPage.js +12 -0
- package/dist/common/src/components/stateful/ProcessManagerPage.js +13 -15
- package/dist/common/src/components/stateful/ProjectPage.js +6 -5
- package/dist/common/src/components/stateful/ProjectsPage.js +17 -19
- package/dist/common/src/components/stateful/SingleProcessPage.js +16 -26
- package/dist/common/src/components/stateful/TestPage.js +7 -5
- package/dist/common/src/hooks/useGitMode.js +21 -0
- package/dist/common/src/lib/BaseSuite.test/mock.js +15 -8
- package/dist/common/src/lib/BaseSuite.test/test.js +56 -80
- package/dist/common/src/lib/Tiposkripto.js +24 -0
- package/dist/common/src/lib/Tiposkripto.test/MockTiposkripto.js +154 -10
- package/dist/common/src/lib/Tiposkripto.test/Tiposkripto.adapter.js +6 -12
- package/dist/common/src/lib/Tiposkripto.test/Tiposkripto.implementation.js +63 -23
- package/dist/common/src/lib/Tiposkripto.test/Tiposkripto.specification.js +14 -6
- package/dist/common/src/lib/pmProxy.test/specification.js +167 -52
- package/dist/common/src/services/FileService.js +505 -0
- package/dist/common/src/services/GitHubAuthService.js +184 -0
- package/dist/common/src/testeranto.js +38 -97
- package/dist/common/src/utils/api.js +12 -8
- package/dist/common/src/utils/gitTest.js +27 -0
- package/dist/common/src/utils.js +23 -13
- package/dist/common/testeranto.config.js +21 -17
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/design-editor/DesignEditor.js +33 -199
- package/dist/module/src/App.js +121 -15
- package/dist/module/src/PM/PM_WithBuild.js +128 -0
- package/dist/module/src/PM/PM_WithEslintAndTsc.js +79 -67
- package/dist/module/src/PM/PM_WithGit.js +477 -0
- package/dist/module/src/PM/PM_WithProcesses.js +479 -0
- package/dist/module/src/PM/PM_WithWebSocket.js +528 -0
- package/dist/module/src/PM/base.js +62 -0
- package/dist/module/src/PM/main.js +533 -1676
- package/dist/module/src/PM/metafileOutputs.js +78 -0
- package/dist/module/src/PM/node.js +0 -6
- package/dist/module/src/PM/pure.js +0 -8
- package/dist/module/src/PM/types.js +1 -1
- package/dist/module/src/PM/utils.js +196 -0
- package/dist/module/src/PM/web.js +0 -6
- package/dist/module/src/ReportServer.js +1 -9
- package/dist/module/src/ReportServerLib.js +1 -134
- package/dist/module/src/components/pure/AppFrame.js +66 -24
- package/dist/module/src/components/pure/ArtifactTree.js +80 -0
- package/dist/module/src/components/pure/BuildLogViewer.js +99 -0
- package/dist/module/src/components/pure/DebugEnv.js +23 -0
- package/dist/module/src/components/pure/FileTree.js +27 -0
- package/dist/module/src/components/pure/FileTreeItem.js +22 -0
- package/dist/module/src/components/pure/GitHubLoginButton.js +11 -0
- package/dist/module/src/components/pure/GitIntegrationView.js +305 -0
- package/dist/module/src/components/pure/ProcessManager.js +1 -0
- package/dist/module/src/components/pure/ProcessManagerView.js +74 -75
- package/dist/module/src/components/pure/ProjectPageView.js +5 -118
- package/dist/module/src/components/pure/Settings.js +84 -0
- package/dist/module/src/components/pure/Settings.test.js +29 -0
- package/dist/module/src/components/pure/SignIn.js +15 -0
- package/dist/module/src/components/pure/SingleProcessView.js +130 -214
- package/dist/module/src/components/pure/TestPageView.js +97 -352
- package/dist/module/src/components/pure/TestPageView_utils.js +109 -0
- package/dist/module/src/components/pure/TestTable.js +26 -0
- package/dist/module/src/components/pure/ToastNotification.js +7 -0
- package/dist/module/src/components/pure/UserProfile.js +20 -0
- package/dist/module/src/components/stateful/AuthCallbackPage.js +14 -0
- package/dist/module/src/components/stateful/FeaturesReporter.js +2 -1
- package/dist/module/src/components/stateful/FileTree.js +59 -33
- package/dist/module/src/components/stateful/GitIntegrationPage.js +5 -0
- package/dist/module/src/components/stateful/ProcessManagerPage.js +13 -15
- package/dist/module/src/components/stateful/ProjectPage.js +6 -5
- package/dist/module/src/components/stateful/ProjectsPage.js +16 -18
- package/dist/module/src/components/stateful/SingleProcessPage.js +16 -26
- package/dist/module/src/components/stateful/TestPage.js +8 -6
- package/dist/module/src/hooks/useGitMode.js +17 -0
- package/dist/module/src/lib/BaseSuite.test/mock.js +15 -8
- package/dist/module/src/lib/BaseSuite.test/test.js +56 -80
- package/dist/module/src/lib/Tiposkripto.js +24 -0
- package/dist/module/src/lib/Tiposkripto.test/MockTiposkripto.js +154 -10
- package/dist/module/src/lib/Tiposkripto.test/Tiposkripto.adapter.js +6 -12
- package/dist/module/src/lib/Tiposkripto.test/Tiposkripto.implementation.js +63 -23
- package/dist/module/src/lib/Tiposkripto.test/Tiposkripto.specification.js +14 -6
- package/dist/module/src/lib/pmProxy.test/specification.js +167 -52
- package/dist/module/src/services/FileService.js +468 -0
- package/dist/module/src/services/GitHubAuthService.js +180 -0
- package/dist/module/src/testeranto.js +38 -97
- package/dist/module/src/utils/api.js +10 -7
- package/dist/module/src/utils/gitTest.js +23 -0
- package/dist/module/src/utils.js +21 -12
- package/dist/module/testeranto.config.js +21 -17
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/App.css +94 -121
- package/dist/prebuild/App.js +44601 -11225
- package/dist/prebuild/testeranto.mjs +3113 -2256
- package/dist/types/design-editor/DesignEditor.d.ts +1 -18
- package/dist/types/src/App.d.ts +18 -0
- package/dist/types/src/PM/PM_WithBuild.d.ts +13 -0
- package/dist/types/src/PM/PM_WithEslintAndTsc.d.ts +2 -4
- package/dist/types/src/PM/PM_WithGit.d.ts +27 -0
- package/dist/types/src/PM/PM_WithProcesses.d.ts +29 -0
- package/dist/types/src/PM/PM_WithWebSocket.d.ts +108 -0
- package/dist/types/src/PM/base.d.ts +1 -1
- package/dist/types/src/PM/index.d.ts +0 -2
- package/dist/types/src/PM/main.d.ts +6 -77
- package/dist/types/src/PM/metafileOutputs.d.ts +0 -0
- package/dist/types/src/PM/node.d.ts +0 -2
- package/dist/types/src/PM/pure.d.ts +0 -2
- package/dist/types/src/PM/types.d.ts +118 -0
- package/dist/types/src/PM/utils.d.ts +35 -0
- package/dist/types/src/PM/web.d.ts +0 -2
- package/dist/types/src/Pure.d.ts +6 -1
- package/dist/types/src/ReportServer.d.ts +0 -1
- package/dist/types/src/ReportServerLib.d.ts +0 -1
- package/dist/types/src/Types.d.ts +1 -0
- package/dist/types/src/components/pure/ArtifactTree.d.ts +0 -0
- package/dist/types/src/components/pure/BuildLogViewer.d.ts +7 -0
- package/dist/types/src/components/pure/DebugEnv.d.ts +2 -0
- package/dist/types/src/components/pure/FileTree.d.ts +6 -0
- package/dist/types/src/components/pure/FileTreeItem.d.ts +8 -0
- package/dist/types/src/components/pure/GitHubLoginButton.d.ts +8 -0
- package/dist/types/src/components/pure/GitIntegrationView.d.ts +1 -0
- package/dist/types/src/components/pure/Settings.d.ts +1 -0
- package/dist/types/src/components/pure/Settings.test.d.ts +1 -0
- package/dist/types/src/components/pure/SignIn.d.ts +1 -0
- package/dist/types/src/components/pure/SingleProcessView.d.ts +10 -0
- package/dist/types/src/components/pure/TestPageView.d.ts +2 -1
- package/dist/types/src/components/pure/TestPageView_utils.d.ts +23 -0
- package/dist/types/src/components/pure/TestTable.d.ts +16 -0
- package/dist/types/src/components/pure/ToastNotification.d.ts +6 -0
- package/dist/types/src/components/pure/UserProfile.d.ts +2 -0
- package/dist/types/src/components/stateful/AuthCallbackPage.d.ts +2 -0
- package/dist/types/src/components/stateful/FileTree.d.ts +0 -8
- package/dist/types/src/components/stateful/GitIntegrationPage.d.ts +1 -0
- package/dist/types/src/hooks/useGitMode.d.ts +7 -0
- package/dist/types/src/lib/BaseSuite.test/mock.d.ts +2 -2
- package/dist/types/src/lib/BaseSuite.test/test.d.ts +4 -3
- package/dist/types/src/lib/Tiposkripto.d.ts +2 -0
- package/dist/types/src/lib/Tiposkripto.test/MockTiposkripto.d.ts +3 -0
- package/dist/types/src/lib/Tiposkripto.test/Tiposkripto.types.d.ts +5 -0
- package/dist/types/src/lib/index.d.ts +6 -0
- package/dist/types/src/services/FileService.d.ts +34 -0
- package/dist/types/src/services/GitHubAuthService.d.ts +32 -0
- package/dist/types/src/utils/api.d.ts +1 -0
- package/dist/types/src/utils/gitTest.d.ts +11 -0
- package/dist/types/src/utils.d.ts +3 -3
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/example/__pycache__/Calculator.cpython-313.pyc +0 -0
- package/example/vendor/github.com/adamwong246/testeranto/src/golingvu/README.md +187 -0
- package/example/vendor/github.com/adamwong246/testeranto/src/golingvu/base_given.go +163 -0
- package/example/vendor/github.com/adamwong246/testeranto/src/golingvu/base_suite.go +85 -0
- package/example/vendor/github.com/adamwong246/testeranto/src/golingvu/base_then.go +21 -0
- package/example/vendor/github.com/adamwong246/testeranto/src/golingvu/base_when.go +21 -0
- package/example/vendor/github.com/adamwong246/testeranto/src/golingvu/golingvu.go +554 -0
- package/example/vendor/github.com/adamwong246/testeranto/src/golingvu/test_adapter.go +33 -0
- package/example/vendor/github.com/adamwong246/testeranto/src/golingvu/types.go +72 -0
- package/example/vendor/modules.txt +5 -0
- package/git-integration-plan.md +395 -0
- package/package.json +26 -14
- package/src/App.tsx +169 -18
- package/src/PM/PM_WithBuild.ts +171 -0
- package/src/PM/PM_WithEslintAndTsc.ts +109 -86
- package/src/PM/PM_WithGit.ts +585 -0
- package/src/PM/PM_WithProcesses.ts +639 -0
- package/src/PM/PM_WithWebSocket.ts +631 -0
- package/src/PM/base.ts +63 -1
- package/src/PM/index.ts +8 -5
- package/src/PM/main.ts +672 -2050
- package/src/PM/metafileOutputs.ts +90 -0
- package/src/PM/node.ts +18 -18
- package/src/PM/pure.ts +5 -13
- package/src/PM/types.ts +145 -0
- package/src/PM/utils.ts +256 -0
- package/src/PM/web.ts +8 -8
- package/src/README.md +122 -0
- package/src/ReportServer.ts +0 -12
- package/src/ReportServerLib.ts +0 -147
- package/src/Types.ts +1 -0
- package/src/app.scss +14 -164
- package/src/components/pure/AppFrame.tsx +237 -71
- package/src/components/pure/ArtifactTree.tsx +82 -0
- package/src/components/pure/BuildLogViewer.tsx +168 -0
- package/src/components/pure/DebugEnv.tsx +30 -0
- package/src/components/pure/FileTree.tsx +58 -0
- package/src/components/pure/FileTreeItem.tsx +49 -0
- package/src/components/pure/GitHubLoginButton.tsx +31 -0
- package/src/components/pure/GitIntegrationView.tsx +443 -0
- package/src/components/pure/ProcessManager.tsx +6 -5
- package/src/components/pure/ProcessManagerView.tsx +162 -166
- package/src/components/pure/ProjectPageView.tsx +6 -224
- package/src/components/pure/Settings.test.tsx +34 -0
- package/src/components/pure/Settings.tsx +163 -0
- package/src/components/pure/SignIn.tsx +33 -0
- package/src/components/pure/SingleProcessView.tsx +231 -235
- package/src/components/pure/TestPageView.test/specification.ts +1 -0
- package/src/components/pure/TestPageView.tsx +317 -826
- package/src/components/pure/TestPageView_utils.tsx +285 -0
- package/src/components/pure/TestTable.tsx +88 -0
- package/src/components/pure/ToastNotification.tsx +19 -0
- package/src/components/pure/UserProfile.tsx +44 -0
- package/src/components/stateful/AuthCallbackPage.tsx +21 -0
- package/src/components/stateful/FeaturesReporter.tsx +3 -1
- package/src/components/stateful/FileTree.tsx +58 -58
- package/src/components/stateful/GitIntegrationPage.tsx +8 -0
- package/src/components/stateful/ProcessManagerPage.tsx +13 -17
- package/src/components/stateful/ProjectPage.tsx +6 -5
- package/src/components/stateful/ProjectsPage.tsx +17 -19
- package/src/components/stateful/SVGEditor/CircleForm.tsx +68 -0
- package/src/components/stateful/SVGEditor/GroupForm.tsx +56 -0
- package/src/components/stateful/SVGEditor/RectForm.tsx +74 -0
- package/src/components/stateful/SVGEditor/SVGAttributeField.tsx +29 -0
- package/src/components/stateful/SVGEditor/SVGAttributesEditor.tsx +73 -0
- package/src/components/stateful/SVGEditor/SVGEditorControls.tsx +45 -0
- package/src/components/stateful/SVGEditor/SVGElementForm.tsx +45 -0
- package/src/components/stateful/SVGEditor/SVGPreview.tsx +225 -0
- package/src/components/stateful/SVGEditor/SVGTextEditor.tsx +166 -0
- package/src/components/stateful/SVGEditor/SVGTree.tsx +159 -0
- package/src/components/stateful/SVGEditor/SVGTypes.ts +36 -0
- package/src/components/stateful/SVGEditor/svg.xsd.xml +3038 -0
- package/src/components/stateful/SVGEditorPage.tsx +503 -0
- package/src/components/stateful/SingleProcessPage.tsx +18 -31
- package/src/components/stateful/TestPage.tsx +25 -22
- package/src/golingvu/golingvu.go +38 -2
- package/src/hooks/useGitMode.ts +20 -0
- package/src/lib/BaseSuite.test/mock.ts +16 -10
- package/src/lib/BaseSuite.test/test.ts +144 -103
- package/src/lib/Tiposkripto.test/MockTiposkripto.ts +178 -14
- package/src/lib/Tiposkripto.test/Tiposkripto.adapter.ts +9 -14
- package/src/lib/Tiposkripto.test/Tiposkripto.implementation.ts +78 -38
- package/src/lib/Tiposkripto.test/Tiposkripto.specification.ts +51 -9
- package/src/lib/Tiposkripto.test/Tiposkripto.types.ts +5 -0
- package/src/lib/Tiposkripto.ts +27 -0
- package/src/lib/index.ts +7 -0
- package/src/lib/pmProxy.test/specification.ts +168 -166
- package/src/pitono/PM/__pycache__/python.cpython-313.pyc +0 -0
- package/src/pitono/__pycache__/Pitono.cpython-313.pyc +0 -0
- package/src/pitono/__pycache__/__init__.cpython-313.pyc +0 -0
- package/src/pitono/__pycache__/base_given.cpython-313.pyc +0 -0
- package/src/pitono/__pycache__/base_suite.cpython-313.pyc +0 -0
- package/src/pitono/__pycache__/base_then.cpython-313.pyc +0 -0
- package/src/pitono/__pycache__/base_when.cpython-313.pyc +0 -0
- package/src/pitono/__pycache__/core_generator.cpython-313.pyc +0 -0
- package/src/pitono/__pycache__/simple_adapter.cpython-313.pyc +0 -0
- package/src/pitono/__pycache__/types.cpython-313.pyc +0 -0
- package/src/services/FileService.ts +542 -0
- package/src/services/GitHubAuthService.ts +240 -0
- package/src/testeranto.ts +62 -140
- package/src/utils/api.ts +15 -13
- package/src/utils/gitTest.ts +29 -0
- package/src/utils.ts +21 -12
- package/testeranto/App.css +94 -121
- package/testeranto/App.js +44601 -11225
- package/testeranto/bundles/golang/core/Calculator.golingvu.go +53 -0
- package/testeranto/bundles/golang/core/Calculator.golingvu.golingvu.go +53 -0
- package/testeranto/bundles/node/core/chunk-RIM6RECA.mjs +1170 -0
- package/testeranto/bundles/node/core/chunk-VXVF7WFO.mjs +4321 -0
- package/testeranto/bundles/node/core/example/Calculator.test.mjs +503 -0
- package/testeranto/bundles/node/core/src/lib/BaseSuite.test/node.test.mjs +94 -1231
- package/testeranto/bundles/node/core/src/lib/TipoSkripto.test/TipoSkripto.mjs +574 -0
- package/testeranto/bundles/node/core/src/lib/pmProxy.test/index.mjs +482 -0
- package/testeranto/bundles/pure/core/chunk-XYOCRDEQ.mjs +1080 -0
- package/testeranto/bundles/pure/core/src/Pure.test.mjs +410 -0
- package/testeranto/bundles/pure/core/src/lib/BaseSuite.test/pure.test.mjs +93 -1146
- package/testeranto/bundles/python/core/Calculator.pitono.test.py +24 -0
- package/testeranto/bundles/python/core/test_example.py +24 -0
- package/testeranto/bundles/web/core/MPLUSRounded1c-Black-O75GP5JI.ttf +0 -0
- package/testeranto/bundles/web/core/MPLUSRounded1c-Bold-R524Q5BH.ttf +0 -0
- package/testeranto/bundles/web/core/MPLUSRounded1c-ExtraBold-C6GRMYVT.ttf +0 -0
- package/testeranto/bundles/web/core/MPLUSRounded1c-Light-WKN65Y2C.ttf +0 -0
- package/testeranto/bundles/web/core/MPLUSRounded1c-Medium-ZC4DWL7C.ttf +0 -0
- package/testeranto/bundles/web/core/MPLUSRounded1c-Regular-DT6EKZ3S.ttf +0 -0
- package/testeranto/bundles/web/core/MPLUSRounded1c-Thin-YWDNVG6M.ttf +0 -0
- package/testeranto/bundles/web/core/chunk-DFRN4SYZ.mjs +2297 -0
- package/testeranto/bundles/web/core/chunk-JMDLMADH.mjs +27996 -0
- package/testeranto/bundles/web/core/chunk-LQMU5NCG.mjs +3082 -0
- package/testeranto/bundles/web/core/chunk-Q5TONB2Z.mjs +6874 -0
- package/testeranto/bundles/web/core/src/components/pure/FeaturesReporterView.test/index.mjs +164 -0
- package/testeranto/bundles/web/core/src/components/pure/ModalContent.test/index.css +11697 -0
- package/testeranto/bundles/web/core/src/components/pure/ModalContent.test/index.mjs +336 -0
- package/testeranto/bundles/web/core/src/components/pure/ProjectPageView.test/index.css +11697 -0
- package/testeranto/bundles/web/core/src/components/pure/ProjectPageView.test/index.mjs +517 -0
- package/testeranto/bundles/web/core/src/lib/BaseSuite.test/web.test.mjs +107 -1134
- package/testeranto/metafiles/golang/core.json +3 -3
- package/testeranto/metafiles/node/core.json +474 -31
- package/testeranto/metafiles/pure/core.json +144 -28
- package/testeranto/metafiles/python/core.json +11 -0
- package/testeranto/metafiles/web/core.json +15829 -45
- package/testeranto/reports/core/config.json +40 -0
- package/testeranto/reports/core/src/Pure.test/pure/exit.log +0 -0
- package/testeranto/reports/core/src/Pure.test/pure/lint_errors.txt +0 -0
- package/testeranto/reports/core/src/Pure.test/pure/prompt.txt +14 -0
- package/testeranto/reports/core/src/Pure.test/pure/type_errors.txt +73 -0
- package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/debug.log +0 -0
- package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/error.log +91 -0
- package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/exit.log +1 -0
- package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/info.log +2 -0
- package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/tests.json +68 -0
- package/testeranto/reports/core/src/components/pure/FeaturesReporterView.test/index/web/warn.log +0 -0
- package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/debug.log +0 -0
- package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/error.log +30 -0
- package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/exit.log +1 -0
- package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/info.log +2 -0
- package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/tests.json +88 -0
- package/testeranto/reports/core/src/components/pure/ProjectPageView.test/index/web/warn.log +0 -0
- package/testeranto/reports/core/src/lib/BaseSuite.test/node.test/node/lint_errors.txt +0 -6
- package/testeranto/reports/core/src/lib/BaseSuite.test/node.test/node/prompt.txt +0 -11
- package/testeranto/reports/core/src/lib/BaseSuite.test/node.test/node/stdout.log +1 -0
- package/testeranto/reports/core/src/lib/BaseSuite.test/node.test/node/tests.json +1 -1
- package/testeranto/reports/core/src/lib/BaseSuite.test/node.test/node/type_errors.txt +35 -38
- package/testeranto/reports/core/src/lib/BaseSuite.test/pure.test/pure/lint_errors.txt +0 -2
- package/testeranto/reports/core/src/lib/BaseSuite.test/pure.test/pure/prompt.txt +0 -10
- package/testeranto/reports/core/src/lib/BaseSuite.test/pure.test/pure/type_errors.txt +40 -38
- package/testeranto/reports/core/src/lib/BaseSuite.test/web.test/web/tests.json +1 -1
- package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/exit.log +1 -0
- package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/lint_errors.txt +0 -0
- package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/message.txt +17 -0
- package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/prompt.txt +17 -0
- package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/stderr.log +55 -0
- package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/stdout.log +191 -0
- package/testeranto/reports/core/src/lib/TipoSkripto.test/TipoSkripto/node/type_errors.txt +71 -0
- package/testeranto/reports/core/src/lib/pmProxy.test/index/node/exit.log +1 -0
- package/testeranto/reports/core/src/lib/pmProxy.test/index/node/lint_errors.txt +15 -0
- package/testeranto/reports/core/src/lib/pmProxy.test/index/node/message.txt +17 -0
- package/testeranto/reports/core/src/lib/pmProxy.test/index/node/prompt.txt +17 -0
- package/testeranto/reports/core/src/lib/pmProxy.test/index/node/stderr.log +20 -0
- package/testeranto/reports/core/src/lib/pmProxy.test/index/node/stdout.log +4 -0
- package/testeranto/reports/core/src/lib/pmProxy.test/index/node/type_errors.txt +49 -0
- package/testeranto/reports/core/summary.json +34 -6
- package/testeranto.config.ts +26 -20
- package/tsc.log +141 -91
- package/tsconfig.json +6 -2
- package/dist/types/design-editor/server.d.ts +0 -1
- package/testeranto/bundles/web/core/src/lib/BaseSuite.test/web.test.html +0 -15
- package/testeranto/reports/core/src/lib/BaseSuite.test/web.test/web/lint_errors.txt +0 -2
- package/testeranto/reports/core/src/lib/BaseSuite.test/web.test/web/prompt.txt +0 -25
- package/testeranto/reports/core/src/lib/BaseSuite.test/web.test/web/type_errors.txt +0 -56
- /package/testeranto/reports/core/src/{lib/BaseSuite.test/web.test/web → Pure.test/pure}/message.txt +0 -0
|
@@ -44,1772 +44,629 @@ exports.PM_Main = void 0;
|
|
|
44
44
|
const node_child_process_1 = require("node:child_process");
|
|
45
45
|
const ansi_colors_1 = __importDefault(require("ansi-colors"));
|
|
46
46
|
const net_1 = __importDefault(require("net"));
|
|
47
|
-
const fs_1 =
|
|
48
|
-
const path_1 = __importDefault(require("path"));
|
|
49
|
-
const puppeteer_core_1 = __importDefault(require("puppeteer-core"));
|
|
47
|
+
const fs_1 = __importDefault(require("fs"));
|
|
50
48
|
const ansi_colors_2 = __importDefault(require("ansi-colors"));
|
|
51
|
-
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
52
|
-
const ws_1 = require("ws");
|
|
53
|
-
const http_1 = __importDefault(require("http"));
|
|
54
|
-
const url_1 = __importDefault(require("url"));
|
|
55
|
-
const mime_types_1 = __importDefault(require("mime-types"));
|
|
56
49
|
const utils_1 = require("../utils");
|
|
57
50
|
const queue_js_1 = require("../utils/queue.js");
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
const fileHashes = {};
|
|
51
|
+
const utils_js_1 = require("./utils.js");
|
|
52
|
+
const PM_WithProcesses_js_1 = require("./PM_WithProcesses.js");
|
|
61
53
|
const files = {};
|
|
62
54
|
const screenshots = {};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (!fs_1.default.existsSync(safeDest)) {
|
|
67
|
-
fs_1.default.mkdirSync(safeDest, { recursive: true });
|
|
68
|
-
}
|
|
69
|
-
if (runtime === "node") {
|
|
70
|
-
return {
|
|
71
|
-
stdout: fs_1.default.createWriteStream(`${safeDest}/stdout.log`),
|
|
72
|
-
stderr: fs_1.default.createWriteStream(`${safeDest}/stderr.log`),
|
|
73
|
-
exit: fs_1.default.createWriteStream(`${safeDest}/exit.log`),
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
else if (runtime === "web") {
|
|
77
|
-
return {
|
|
78
|
-
info: fs_1.default.createWriteStream(`${safeDest}/info.log`),
|
|
79
|
-
warn: fs_1.default.createWriteStream(`${safeDest}/warn.log`),
|
|
80
|
-
error: fs_1.default.createWriteStream(`${safeDest}/error.log`),
|
|
81
|
-
debug: fs_1.default.createWriteStream(`${safeDest}/debug.log`),
|
|
82
|
-
exit: fs_1.default.createWriteStream(`${safeDest}/exit.log`),
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
else if (runtime === "pure") {
|
|
86
|
-
return {
|
|
87
|
-
exit: fs_1.default.createWriteStream(`${safeDest}/exit.log`),
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
else if (runtime === "pitono") {
|
|
91
|
-
return {
|
|
92
|
-
stdout: fs_1.default.createWriteStream(`${safeDest}/stdout.log`),
|
|
93
|
-
stderr: fs_1.default.createWriteStream(`${safeDest}/stderr.log`),
|
|
94
|
-
exit: fs_1.default.createWriteStream(`${safeDest}/exit.log`),
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
throw `unknown runtime: ${runtime}`;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
catch (e) {
|
|
102
|
-
console.error(`Failed to create log streams in ${safeDest}:`, e);
|
|
103
|
-
throw e;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
function createLogStreams(reportDest, runtime) {
|
|
107
|
-
// Create directory if it doesn't exist
|
|
108
|
-
if (!fs_1.default.existsSync(reportDest)) {
|
|
109
|
-
fs_1.default.mkdirSync(reportDest, { recursive: true });
|
|
110
|
-
}
|
|
111
|
-
const streams = runtimeLogs(runtime, reportDest);
|
|
112
|
-
// const streams = {
|
|
113
|
-
// exit: fs.createWriteStream(`${reportDest}/exit.log`),
|
|
114
|
-
const safeDest = reportDest || `testeranto/reports/default_${Date.now()}`;
|
|
115
|
-
try {
|
|
116
|
-
if (!fs_1.default.existsSync(safeDest)) {
|
|
117
|
-
fs_1.default.mkdirSync(safeDest, { recursive: true });
|
|
118
|
-
}
|
|
119
|
-
const streams = runtimeLogs(runtime, safeDest);
|
|
120
|
-
// const streams = {
|
|
121
|
-
// exit: fs.createWriteStream(`${safeDest}/exit.log`),
|
|
122
|
-
// ...(runtime === "node" || runtime === "pure"
|
|
123
|
-
// ? {
|
|
124
|
-
// stdout: fs.createWriteStream(`${safeDest}/stdout.log`),
|
|
125
|
-
// stderr: fs.createWriteStream(`${safeDest}/stderr.log`),
|
|
126
|
-
// }
|
|
127
|
-
// : {
|
|
128
|
-
// info: fs.createWriteStream(`${safeDest}/info.log`),
|
|
129
|
-
// warn: fs.createWriteStream(`${safeDest}/warn.log`),
|
|
130
|
-
// error: fs.createWriteStream(`${safeDest}/error.log`),
|
|
131
|
-
// debug: fs.createWriteStream(`${safeDest}/debug.log`),
|
|
132
|
-
// }),
|
|
133
|
-
// };
|
|
134
|
-
return Object.assign(Object.assign({}, streams), { closeAll: () => {
|
|
135
|
-
Object.values(streams).forEach((stream) => !stream.closed && stream.close());
|
|
136
|
-
}, writeExitCode: (code, error) => {
|
|
137
|
-
if (error) {
|
|
138
|
-
streams.exit.write(`Error: ${error.message}\n`);
|
|
139
|
-
if (error.stack) {
|
|
140
|
-
streams.exit.write(`Stack Trace:\n${error.stack}\n`);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
streams.exit.write(`${code}\n`);
|
|
144
|
-
}, exit: streams.exit });
|
|
145
|
-
}
|
|
146
|
-
catch (e) {
|
|
147
|
-
console.error(`Failed to create log streams in ${safeDest}:`, e);
|
|
148
|
-
throw e;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
async function fileHash(filePath, algorithm = "md5") {
|
|
152
|
-
return new Promise((resolve, reject) => {
|
|
153
|
-
const hash = node_crypto_1.default.createHash(algorithm);
|
|
154
|
-
const fileStream = fs_1.default.createReadStream(filePath);
|
|
155
|
-
fileStream.on("data", (data) => {
|
|
156
|
-
hash.update(data);
|
|
157
|
-
});
|
|
158
|
-
fileStream.on("end", () => {
|
|
159
|
-
const fileHash = hash.digest("hex");
|
|
160
|
-
resolve(fileHash);
|
|
161
|
-
});
|
|
162
|
-
fileStream.on("error", (error) => {
|
|
163
|
-
reject(`Error reading file: ${error.message}`);
|
|
164
|
-
});
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
const statusMessagePretty = (failures, test, runtime) => {
|
|
168
|
-
if (failures === 0) {
|
|
169
|
-
console.log(ansi_colors_2.default.green(ansi_colors_2.default.inverse(`${runtime} > ${test}`)));
|
|
170
|
-
}
|
|
171
|
-
else if (failures > 0) {
|
|
172
|
-
console.log(ansi_colors_2.default.red(ansi_colors_2.default.inverse(`${runtime} > ${test} failed ${failures} times (exit code: ${failures})`)));
|
|
173
|
-
}
|
|
174
|
-
else {
|
|
175
|
-
console.log(ansi_colors_2.default.red(ansi_colors_2.default.inverse(`${runtime} > ${test} crashed (exit code: -1)`)));
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
async function writeFileAndCreateDir(filePath, data) {
|
|
179
|
-
const dirPath = path_1.default.dirname(filePath);
|
|
180
|
-
try {
|
|
181
|
-
await fs_1.default.promises.mkdir(dirPath, { recursive: true });
|
|
182
|
-
await fs_1.default.writeFileSync(filePath, data);
|
|
183
|
-
}
|
|
184
|
-
catch (error) {
|
|
185
|
-
console.error(`Error writing file: ${error}`);
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
const filesHash = async (files, algorithm = "md5") => {
|
|
189
|
-
return new Promise((resolve, reject) => {
|
|
190
|
-
resolve(files.reduce(async (mm, f) => {
|
|
191
|
-
return (await mm) + (await fileHash(f));
|
|
192
|
-
}, Promise.resolve("")));
|
|
193
|
-
});
|
|
194
|
-
};
|
|
195
|
-
function isValidUrl(string) {
|
|
196
|
-
try {
|
|
197
|
-
new URL(string);
|
|
198
|
-
return true;
|
|
199
|
-
}
|
|
200
|
-
catch (err) {
|
|
201
|
-
return false;
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
// Wait for file to exist, checks every 2 seconds by default
|
|
205
|
-
async function pollForFile(path, timeout = 2000) {
|
|
206
|
-
const intervalObj = setInterval(function () {
|
|
207
|
-
const file = path;
|
|
208
|
-
const fileExists = fs_1.default.existsSync(file);
|
|
209
|
-
if (fileExists) {
|
|
210
|
-
clearInterval(intervalObj);
|
|
211
|
-
}
|
|
212
|
-
}, timeout);
|
|
213
|
-
}
|
|
214
|
-
class PM_Main extends PM_WithEslintAndTsc_js_1.PM_WithEslintAndTsc {
|
|
215
|
-
constructor(configs, name, mode) {
|
|
216
|
-
super(configs, name, mode);
|
|
217
|
-
this.logStreams = {};
|
|
218
|
-
this.sidecars = {};
|
|
219
|
-
this.clients = new Set();
|
|
220
|
-
this.runningProcesses = new Map();
|
|
221
|
-
this.allProcesses = new Map();
|
|
222
|
-
this.processLogs = new Map();
|
|
223
|
-
this.getRunnables = (tests, testName, payload = {
|
|
224
|
-
nodeEntryPoints: {},
|
|
225
|
-
nodeEntryPointSidecars: {},
|
|
226
|
-
webEntryPoints: {},
|
|
227
|
-
webEntryPointSidecars: {},
|
|
228
|
-
pureEntryPoints: {},
|
|
229
|
-
pureEntryPointSidecars: {},
|
|
230
|
-
}) => {
|
|
231
|
-
return (0, utils_1.getRunnables)(tests, testName, payload);
|
|
232
|
-
};
|
|
55
|
+
class PM_Main extends PM_WithProcesses_js_1.PM_WithProcesses {
|
|
56
|
+
constructor() {
|
|
57
|
+
super(...arguments);
|
|
233
58
|
this.launchPure = async (src, dest) => {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
.
|
|
239
|
-
.
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
process.exit(-1);
|
|
251
|
-
}
|
|
252
|
-
const testConfigResource = testConfig[2];
|
|
253
|
-
const portsToUse = [];
|
|
254
|
-
if (testConfigResource.ports === 0) {
|
|
255
|
-
argz = JSON.stringify({
|
|
256
|
-
scheduled: true,
|
|
257
|
-
name: src,
|
|
258
|
-
ports: portsToUse,
|
|
259
|
-
fs: reportDest,
|
|
260
|
-
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
59
|
+
const processId = `pure-${src}-${Date.now()}`;
|
|
60
|
+
const command = `pure test: ${src}`;
|
|
61
|
+
// Create the promise
|
|
62
|
+
const purePromise = (async () => {
|
|
63
|
+
this.bddTestIsRunning(src);
|
|
64
|
+
const reportDest = `testeranto/reports/${this.name}/${src
|
|
65
|
+
.split(".")
|
|
66
|
+
.slice(0, -1)
|
|
67
|
+
.join(".")}/pure`;
|
|
68
|
+
if (!fs_1.default.existsSync(reportDest)) {
|
|
69
|
+
fs_1.default.mkdirSync(reportDest, { recursive: true });
|
|
70
|
+
}
|
|
71
|
+
const destFolder = dest.replace(".mjs", "");
|
|
72
|
+
let argz = "";
|
|
73
|
+
const testConfig = this.configs.tests.find((t) => {
|
|
74
|
+
return t[0] === src;
|
|
261
75
|
});
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
76
|
+
if (!testConfig) {
|
|
77
|
+
console.log(ansi_colors_2.default.inverse("missing test config! Exiting ungracefully!"));
|
|
78
|
+
process.exit(-1);
|
|
79
|
+
}
|
|
80
|
+
const testConfigResource = testConfig[2];
|
|
81
|
+
const portsToUse = [];
|
|
82
|
+
if (testConfigResource.ports === 0) {
|
|
270
83
|
argz = JSON.stringify({
|
|
271
84
|
scheduled: true,
|
|
272
85
|
name: src,
|
|
273
86
|
ports: portsToUse,
|
|
274
|
-
fs:
|
|
87
|
+
fs: reportDest,
|
|
275
88
|
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
276
89
|
});
|
|
277
90
|
}
|
|
91
|
+
else if (testConfigResource.ports > 0) {
|
|
92
|
+
const openPorts = Object.entries(this.ports).filter(([portnumber, status]) => status === "");
|
|
93
|
+
if (openPorts.length >= testConfigResource.ports) {
|
|
94
|
+
for (let i = 0; i < testConfigResource.ports; i++) {
|
|
95
|
+
portsToUse.push(openPorts[i][0]);
|
|
96
|
+
this.ports[openPorts[i][0]] = src; // port is now claimed
|
|
97
|
+
}
|
|
98
|
+
argz = JSON.stringify({
|
|
99
|
+
scheduled: true,
|
|
100
|
+
name: src,
|
|
101
|
+
ports: portsToUse,
|
|
102
|
+
fs: destFolder,
|
|
103
|
+
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
this.queue.push(src);
|
|
108
|
+
return [Math.random(), argz];
|
|
109
|
+
}
|
|
110
|
+
}
|
|
278
111
|
else {
|
|
279
|
-
|
|
280
|
-
|
|
112
|
+
console.error("negative port makes no sense", src);
|
|
113
|
+
process.exit(-1);
|
|
281
114
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
// if (sidecar[1] === "web") {
|
|
296
|
-
// const s = await this.launchWebSideCar(
|
|
297
|
-
// sidecar[0],
|
|
298
|
-
// destinationOfRuntime(sidecar[0], "web", this.configs),
|
|
299
|
-
// sidecar
|
|
300
|
-
// );
|
|
301
|
-
// webSideCares.push(s);
|
|
302
|
-
// return s;
|
|
303
|
-
// }
|
|
304
|
-
// if (sidecar[1] === "node") {
|
|
305
|
-
// return this.launchNodeSideCar(
|
|
306
|
-
// sidecar[0],
|
|
307
|
-
// destinationOfRuntime(sidecar[0], "node", this.configs),
|
|
308
|
-
// sidecar
|
|
309
|
-
// );
|
|
310
|
-
// }
|
|
311
|
-
// })
|
|
312
|
-
// );
|
|
313
|
-
const logs = createLogStreams(reportDest, "pure");
|
|
314
|
-
try {
|
|
315
|
-
await Promise.resolve(`${`${builtfile}?cacheBust=${Date.now()}`}`).then(s => __importStar(require(s))).then((module) => {
|
|
316
|
-
// Override console methods to redirect logs
|
|
317
|
-
// Only override stdout/stderr methods for pure runtime
|
|
318
|
-
const originalConsole = Object.assign({}, console);
|
|
319
|
-
// console.log = (...args) => {
|
|
320
|
-
// logs.stdout.write(args.join(" ") + "\n");
|
|
321
|
-
// originalConsole.log(...args);
|
|
322
|
-
// };
|
|
323
|
-
// console.error = (...args) => {
|
|
324
|
-
// logs.stderr.write(args.join(" ") + "\n");
|
|
325
|
-
// originalConsole.error(...args);
|
|
326
|
-
// };
|
|
327
|
-
return module.default
|
|
328
|
-
.then((defaultModule) => {
|
|
329
|
-
defaultModule
|
|
330
|
-
.receiveTestResourceConfig(argz)
|
|
331
|
-
.then(async (results) => {
|
|
332
|
-
// this.receiveFeatures(results.features, destFolder, src, "pure");
|
|
333
|
-
// this.receiveFeaturesV2(reportDest, src, "pure");
|
|
334
|
-
statusMessagePretty(results.fails, src, "pure");
|
|
335
|
-
this.bddTestIsNowDone(src, results.fails);
|
|
115
|
+
const builtfile = dest;
|
|
116
|
+
const logs = (0, utils_js_1.createLogStreams)(reportDest, "pure");
|
|
117
|
+
try {
|
|
118
|
+
await Promise.resolve(`${`${builtfile}?cacheBust=${Date.now()}`}`).then(s => __importStar(require(s))).then((module) => {
|
|
119
|
+
return module.default
|
|
120
|
+
.then((defaultModule) => {
|
|
121
|
+
return defaultModule
|
|
122
|
+
.receiveTestResourceConfig(argz)
|
|
123
|
+
.then(async (results) => {
|
|
124
|
+
(0, utils_js_1.statusMessagePretty)(results.fails, src, "pure");
|
|
125
|
+
this.bddTestIsNowDone(src, results.fails);
|
|
126
|
+
return results.fails;
|
|
127
|
+
});
|
|
336
128
|
})
|
|
337
|
-
.catch((
|
|
338
|
-
console.log(
|
|
129
|
+
.catch((e2) => {
|
|
130
|
+
console.log(ansi_colors_1.default.red(`pure ! ${src} failed to execute. No "tests.json" file was generated. Check the logs for more info`));
|
|
131
|
+
logs.exit.write(e2.stack);
|
|
132
|
+
logs.exit.write(-1);
|
|
339
133
|
this.bddTestIsNowDone(src, -1);
|
|
340
|
-
statusMessagePretty(-1, src, "pure");
|
|
134
|
+
(0, utils_js_1.statusMessagePretty)(-1, src, "pure");
|
|
135
|
+
throw e2;
|
|
341
136
|
});
|
|
342
|
-
// .finally(() => {
|
|
343
|
-
// // webSideCares.forEach((webSideCar) => webSideCar.close());
|
|
344
|
-
// });
|
|
345
|
-
})
|
|
346
|
-
.catch((e2) => {
|
|
347
|
-
console.log(ansi_colors_1.default.red(`pure ! ${src} failed to execute. No "tests.json" file was generated. Check the logs for more info`));
|
|
348
|
-
logs.exit.write(e2.stack);
|
|
349
|
-
logs.exit.write(-1);
|
|
350
|
-
this.bddTestIsNowDone(src, -1);
|
|
351
|
-
statusMessagePretty(-1, src, "pure");
|
|
352
|
-
// console.error(e);
|
|
353
|
-
})
|
|
354
|
-
.finally((x) => {
|
|
355
|
-
// const fileSet = files[src] || new Set();
|
|
356
|
-
// fs.writeFileSync(
|
|
357
|
-
// reportDest + "/manifest.json",
|
|
358
|
-
// JSON.stringify(Array.from(fileSet))
|
|
359
|
-
// );
|
|
360
137
|
});
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
catch (e3) {
|
|
364
|
-
logs.writeExitCode(-1, e3);
|
|
365
|
-
console.log(ansi_colors_2.default.red(ansi_colors_2.default.inverse(`${src} 1 errored with: ${e3}. Check logs for more info`)));
|
|
366
|
-
logs.exit.write(e3.stack);
|
|
367
|
-
logs.exit.write("-1");
|
|
368
|
-
this.bddTestIsNowDone(src, -1);
|
|
369
|
-
statusMessagePretty(-1, src, "pure");
|
|
370
|
-
}
|
|
371
|
-
for (let i = 0; i <= portsToUse.length; i++) {
|
|
372
|
-
if (portsToUse[i]) {
|
|
373
|
-
this.ports[portsToUse[i]] = ""; //port is open again
|
|
374
138
|
}
|
|
375
|
-
|
|
139
|
+
catch (e3) {
|
|
140
|
+
logs.writeExitCode(-1, e3);
|
|
141
|
+
console.log(ansi_colors_2.default.red(ansi_colors_2.default.inverse(`${src} 1 errored with: ${e3}. Check logs for more info`)));
|
|
142
|
+
logs.exit.write(e3.stack);
|
|
143
|
+
logs.exit.write("-1");
|
|
144
|
+
this.bddTestIsNowDone(src, -1);
|
|
145
|
+
(0, utils_js_1.statusMessagePretty)(-1, src, "pure");
|
|
146
|
+
throw e3;
|
|
147
|
+
}
|
|
148
|
+
finally {
|
|
149
|
+
for (let i = 0; i <= portsToUse.length; i++) {
|
|
150
|
+
if (portsToUse[i]) {
|
|
151
|
+
this.ports[portsToUse[i]] = ""; // port is open again
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
})();
|
|
156
|
+
// Add to process manager
|
|
157
|
+
this.addPromiseProcess(processId, purePromise, command, "bdd-test", src, "pure");
|
|
376
158
|
};
|
|
377
159
|
this.launchNode = async (src, dest) => {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
.
|
|
383
|
-
.
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
const
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
ports: [],
|
|
403
|
-
fs: reportDest,
|
|
404
|
-
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
405
|
-
};
|
|
406
|
-
testResources = JSON.stringify(t);
|
|
407
|
-
}
|
|
408
|
-
else if (testConfigResource.ports > 0) {
|
|
409
|
-
const openPorts = Object.entries(this.ports).filter(([portnumber, portopen]) => portopen === "");
|
|
410
|
-
if (openPorts.length >= testConfigResource.ports) {
|
|
411
|
-
for (let i = 0; i < testConfigResource.ports; i++) {
|
|
412
|
-
portsToUse.push(openPorts[i][0]); // Convert string port to number
|
|
413
|
-
this.ports[openPorts[i][0]] = src; // port is now claimed
|
|
414
|
-
}
|
|
415
|
-
testResources = JSON.stringify({
|
|
416
|
-
scheduled: true,
|
|
160
|
+
const processId = `node-${src}-${Date.now()}`;
|
|
161
|
+
const command = `node test: ${src}`;
|
|
162
|
+
// Create the promise
|
|
163
|
+
const nodePromise = (async () => {
|
|
164
|
+
this.bddTestIsRunning(src);
|
|
165
|
+
const reportDest = `testeranto/reports/${this.name}/${src
|
|
166
|
+
.split(".")
|
|
167
|
+
.slice(0, -1)
|
|
168
|
+
.join(".")}/node`;
|
|
169
|
+
if (!fs_1.default.existsSync(reportDest)) {
|
|
170
|
+
fs_1.default.mkdirSync(reportDest, { recursive: true });
|
|
171
|
+
}
|
|
172
|
+
let testResources = "";
|
|
173
|
+
const testConfig = this.configs.tests.find((t) => {
|
|
174
|
+
return t[0] === src;
|
|
175
|
+
});
|
|
176
|
+
if (!testConfig) {
|
|
177
|
+
console.log(ansi_colors_2.default.inverse(`missing test config! Exiting ungracefully for '${src}'`));
|
|
178
|
+
process.exit(-1);
|
|
179
|
+
}
|
|
180
|
+
const testConfigResource = testConfig[2];
|
|
181
|
+
const portsToUse = [];
|
|
182
|
+
if (testConfigResource.ports === 0) {
|
|
183
|
+
const t = {
|
|
417
184
|
name: src,
|
|
418
|
-
ports:
|
|
185
|
+
ports: [],
|
|
419
186
|
fs: reportDest,
|
|
420
187
|
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
else {
|
|
424
|
-
console.log(ansi_colors_2.default.red(`node: cannot run ${src} because there are no open ports ATM. This job will be enqueued and run again run a port is available`));
|
|
425
|
-
this.queue.push(src);
|
|
426
|
-
return [Math.random(), argz]; // Add this return
|
|
188
|
+
};
|
|
189
|
+
testResources = JSON.stringify(t);
|
|
427
190
|
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
let haltReturns = false;
|
|
435
|
-
const ipcfile = "/tmp/tpipe_" + Math.random();
|
|
436
|
-
const child = (0, node_child_process_1.spawn)("node",
|
|
437
|
-
// "node",
|
|
438
|
-
[
|
|
439
|
-
// "--inspect-brk",
|
|
440
|
-
builtfile,
|
|
441
|
-
testResources,
|
|
442
|
-
ipcfile,
|
|
443
|
-
], {
|
|
444
|
-
stdio: ["pipe", "pipe", "pipe", "ipc"],
|
|
445
|
-
});
|
|
446
|
-
let buffer = new Buffer("");
|
|
447
|
-
const server = net_1.default.createServer((socket) => {
|
|
448
|
-
const queue = new queue_js_1.Queue();
|
|
449
|
-
socket.on("data", (data) => {
|
|
450
|
-
buffer = Buffer.concat([buffer, data]);
|
|
451
|
-
for (let b = 0; b < buffer.length + 1; b++) {
|
|
452
|
-
const c = buffer.slice(0, b);
|
|
453
|
-
let d;
|
|
454
|
-
try {
|
|
455
|
-
d = JSON.parse(c.toString());
|
|
456
|
-
queue.enqueue(d);
|
|
457
|
-
buffer = buffer.slice(b, buffer.length + 1);
|
|
458
|
-
b = 0;
|
|
191
|
+
else if (testConfigResource.ports > 0) {
|
|
192
|
+
const openPorts = Object.entries(this.ports).filter(([portnumber, portopen]) => portopen === "");
|
|
193
|
+
if (openPorts.length >= testConfigResource.ports) {
|
|
194
|
+
for (let i = 0; i < testConfigResource.ports; i++) {
|
|
195
|
+
portsToUse.push(openPorts[i][0]);
|
|
196
|
+
this.ports[openPorts[i][0]] = src; // port is now claimed
|
|
459
197
|
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
// set up the "node" listeners
|
|
468
|
-
this.mapping().forEach(async ([command, func]) => {
|
|
469
|
-
if (message[0] === command) {
|
|
470
|
-
const x = message.slice(1, -1);
|
|
471
|
-
const r = await this[command](...x);
|
|
472
|
-
if (!haltReturns) {
|
|
473
|
-
child.send(JSON.stringify({
|
|
474
|
-
payload: r,
|
|
475
|
-
key: message[message.length - 1],
|
|
476
|
-
}));
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
});
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
});
|
|
483
|
-
});
|
|
484
|
-
const logs = createLogStreams(reportDest, "node");
|
|
485
|
-
server.listen(ipcfile, () => {
|
|
486
|
-
var _a, _b;
|
|
487
|
-
// Only handle stdout/stderr for node runtime
|
|
488
|
-
(_a = child.stdout) === null || _a === void 0 ? void 0 : _a.on("data", (data) => {
|
|
489
|
-
var _a;
|
|
490
|
-
(_a = logs.stdout) === null || _a === void 0 ? void 0 : _a.write(data); // Add null check
|
|
491
|
-
});
|
|
492
|
-
(_b = child.stderr) === null || _b === void 0 ? void 0 : _b.on("data", (data) => {
|
|
493
|
-
var _a;
|
|
494
|
-
(_a = logs.stderr) === null || _a === void 0 ? void 0 : _a.write(data); // Add null check
|
|
495
|
-
});
|
|
496
|
-
child.on("error", (err) => { });
|
|
497
|
-
child.on("close", (code) => {
|
|
498
|
-
const exitCode = code === null ? -1 : code;
|
|
499
|
-
if (exitCode < 0) {
|
|
500
|
-
logs.writeExitCode(exitCode, new Error("Process crashed or was terminated"));
|
|
501
|
-
}
|
|
502
|
-
else {
|
|
503
|
-
logs.writeExitCode(exitCode);
|
|
504
|
-
}
|
|
505
|
-
logs.closeAll();
|
|
506
|
-
server.close();
|
|
507
|
-
if (!files[src]) {
|
|
508
|
-
files[src] = new Set();
|
|
509
|
-
}
|
|
510
|
-
if (exitCode === 255) {
|
|
511
|
-
console.log(ansi_colors_1.default.red(`node ! ${src} failed to execute. No "tests.json" file was generated. Check ${reportDest}/stderr.log for more info`));
|
|
512
|
-
this.bddTestIsNowDone(src, -1);
|
|
513
|
-
statusMessagePretty(-1, src, "node");
|
|
514
|
-
return;
|
|
515
|
-
}
|
|
516
|
-
else if (exitCode === 0) {
|
|
517
|
-
this.bddTestIsNowDone(src, 0);
|
|
518
|
-
statusMessagePretty(0, src, "node");
|
|
198
|
+
testResources = JSON.stringify({
|
|
199
|
+
scheduled: true,
|
|
200
|
+
name: src,
|
|
201
|
+
ports: portsToUse,
|
|
202
|
+
fs: reportDest,
|
|
203
|
+
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
204
|
+
});
|
|
519
205
|
}
|
|
520
206
|
else {
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
haltReturns = true;
|
|
525
|
-
});
|
|
526
|
-
child.on("exit", (code) => {
|
|
527
|
-
haltReturns = true;
|
|
528
|
-
for (let i = 0; i <= portsToUse.length; i++) {
|
|
529
|
-
if (portsToUse[i]) {
|
|
530
|
-
this.ports[portsToUse[i]] = ""; //port is open again
|
|
531
|
-
}
|
|
207
|
+
console.log(ansi_colors_2.default.red(`node: cannot run ${src} because there are no open ports ATM. This job will be enqueued and run again run a port is available`));
|
|
208
|
+
this.queue.push(src);
|
|
209
|
+
return [Math.random(), testResources];
|
|
532
210
|
}
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
console.error("negative port makes no sense", src);
|
|
214
|
+
process.exit(-1);
|
|
215
|
+
}
|
|
216
|
+
const builtfile = dest;
|
|
217
|
+
let haltReturns = false;
|
|
218
|
+
const ipcfile = "/tmp/tpipe_" + Math.random();
|
|
219
|
+
const child = (0, node_child_process_1.spawn)("node", [builtfile, testResources, ipcfile], {
|
|
220
|
+
stdio: ["pipe", "pipe", "pipe", "ipc"],
|
|
533
221
|
});
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
const destFolder = dest.replace(".mjs", "");
|
|
548
|
-
console.log(ansi_colors_2.default.green(ansi_colors_2.default.inverse(`launchWebSideCar ${src}`)));
|
|
549
|
-
// const fileStreams2: fs.WriteStream[] = [];
|
|
550
|
-
// const doneFileStream2: Promise<any>[] = [];
|
|
551
|
-
const logs = createLogStreams(dest, "web");
|
|
552
|
-
return new Promise((res, rej) => {
|
|
553
|
-
this.browser
|
|
554
|
-
.newPage()
|
|
555
|
-
.then(async (page) => {
|
|
556
|
-
this.mapping().forEach(async ([command, func]) => {
|
|
557
|
-
page.exposeFunction(command, func);
|
|
558
|
-
});
|
|
559
|
-
const close = () => {
|
|
560
|
-
if (!files[src]) {
|
|
561
|
-
files[src] = new Set();
|
|
562
|
-
}
|
|
563
|
-
// files[src].add(filepath);
|
|
564
|
-
// fs.writeFileSync(
|
|
565
|
-
// destFolder + "/manifest.json",
|
|
566
|
-
// JSON.stringify(Array.from(files[src]))
|
|
567
|
-
// );
|
|
568
|
-
delete files[src];
|
|
569
|
-
Promise.all(screenshots[src] || []).then(() => {
|
|
570
|
-
delete screenshots[src];
|
|
571
|
-
page.close();
|
|
572
|
-
});
|
|
573
|
-
};
|
|
574
|
-
page.on("pageerror", (err) => {
|
|
575
|
-
console.debug(`Error from ${src}: [${err.name}] `);
|
|
576
|
-
console.debug(`Error from ${src}: [${err.name}] `);
|
|
577
|
-
if (err.cause) {
|
|
578
|
-
console.debug(`Error from ${src} cause: [${err.cause}] `);
|
|
579
|
-
}
|
|
580
|
-
if (err.stack) {
|
|
581
|
-
console.debug(`Error from stack ${src}: [${err.stack}] `);
|
|
582
|
-
}
|
|
583
|
-
console.debug(`Error from message ${src}: [${err.message}] `);
|
|
584
|
-
this.bddTestIsNowDone(src, -1);
|
|
585
|
-
close();
|
|
586
|
-
});
|
|
587
|
-
page.on("console", (log) => {
|
|
588
|
-
var _a, _b, _c, _d;
|
|
589
|
-
const msg = `${log.text()}\n${JSON.stringify(log.location())}\n${JSON.stringify(log.stackTrace())}\n`;
|
|
590
|
-
switch (log.type()) {
|
|
591
|
-
case "info":
|
|
592
|
-
(_a = logs.info) === null || _a === void 0 ? void 0 : _a.write(msg);
|
|
593
|
-
break;
|
|
594
|
-
case "warn":
|
|
595
|
-
(_b = logs.warn) === null || _b === void 0 ? void 0 : _b.write(msg);
|
|
596
|
-
break;
|
|
597
|
-
case "error":
|
|
598
|
-
(_c = logs.error) === null || _c === void 0 ? void 0 : _c.write(msg);
|
|
599
|
-
break;
|
|
600
|
-
case "debug":
|
|
601
|
-
(_d = logs.debug) === null || _d === void 0 ? void 0 : _d.write(msg);
|
|
602
|
-
break;
|
|
603
|
-
default:
|
|
604
|
-
break;
|
|
605
|
-
}
|
|
606
|
-
});
|
|
607
|
-
await page.goto(`file://${`${destFolder}.html`}`, {});
|
|
608
|
-
const webArgz = JSON.stringify({
|
|
609
|
-
name: dest,
|
|
610
|
-
ports: [].toString(),
|
|
611
|
-
fs: dest,
|
|
612
|
-
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
613
|
-
});
|
|
614
|
-
const d = `${dest}?cacheBust=${Date.now()}`;
|
|
615
|
-
const evaluation = `
|
|
616
|
-
import('${d}').then(async (x) => {
|
|
617
|
-
|
|
618
|
-
try {
|
|
619
|
-
return await (await x.default).receiveTestResourceConfig(${webArgz})
|
|
620
|
-
} catch (e) {
|
|
621
|
-
console.log("fail", e.toString())
|
|
622
|
-
}
|
|
623
|
-
})`;
|
|
624
|
-
await page
|
|
625
|
-
.evaluate(evaluation)
|
|
626
|
-
.then(async ({ fails, failed, features }) => {
|
|
627
|
-
// this.receiveFeatures(features, destFolder, src, "web");
|
|
628
|
-
// this.receiveFeaturesV2(reportDest, src, "web");
|
|
629
|
-
statusMessagePretty(fails, src, "web");
|
|
630
|
-
this.bddTestIsNowDone(src, fails);
|
|
631
|
-
})
|
|
632
|
-
.catch((e) => {
|
|
633
|
-
console.log(ansi_colors_2.default.red(ansi_colors_2.default.inverse(`launchWebSidecar - ${src} errored with: ${e}`)));
|
|
634
|
-
})
|
|
635
|
-
.finally(() => {
|
|
636
|
-
this.bddTestIsNowDone(src, -1);
|
|
637
|
-
close();
|
|
638
|
-
});
|
|
639
|
-
return page;
|
|
640
|
-
// return page;
|
|
641
|
-
})
|
|
642
|
-
.then(async (page) => {
|
|
643
|
-
await page.goto(`file://${`${dest}.html`}`, {});
|
|
644
|
-
res([Math.random(), page]);
|
|
645
|
-
});
|
|
646
|
-
});
|
|
647
|
-
};
|
|
648
|
-
this.launchNodeSideCar = async (sidecar) => {
|
|
649
|
-
const src = sidecar[0];
|
|
650
|
-
const dest = process.cwd() + `/testeranto/bundles/node/${this.name}/${sidecar[0]}`;
|
|
651
|
-
const d = dest + ".mjs";
|
|
652
|
-
console.log(ansi_colors_2.default.green(ansi_colors_2.default.inverse(`launchNodeSideCar ${sidecar[0]}`)));
|
|
653
|
-
const destFolder = dest.replace(".ts", "");
|
|
654
|
-
const reportDest = `testeranto/reports/${this.name}/${src
|
|
655
|
-
.split(".")
|
|
656
|
-
.slice(0, -1)
|
|
657
|
-
.join(".")}/node`;
|
|
658
|
-
const argz = {
|
|
659
|
-
name: sidecar[0],
|
|
660
|
-
ports: [],
|
|
661
|
-
fs: destFolder,
|
|
662
|
-
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
663
|
-
};
|
|
664
|
-
const testReq = sidecar[2];
|
|
665
|
-
const logs = createLogStreams(dest, "node");
|
|
666
|
-
const portsToUse = [];
|
|
667
|
-
if (testReq.ports === 0) {
|
|
668
|
-
// argz = {
|
|
669
|
-
// name: sidecar[0],
|
|
670
|
-
// ports: portsToUse,
|
|
671
|
-
// fs: destFolder,
|
|
672
|
-
// browserWSEndpoint: this.browser.wsEndpoint(),
|
|
673
|
-
// };
|
|
674
|
-
}
|
|
675
|
-
else if (testReq.ports > 0) {
|
|
676
|
-
const openPorts = Object.entries(this.ports).filter(([portnumber, portopen]) => portopen === "");
|
|
677
|
-
if (openPorts.length >= testReq.ports) {
|
|
678
|
-
for (let i = 0; i < testReq.ports; i++) {
|
|
679
|
-
portsToUse.push(Number(openPorts[i][0])); // Convert string port to number
|
|
680
|
-
this.ports[openPorts[i][0]] = src; // port is now closed
|
|
681
|
-
}
|
|
682
|
-
argz.ports = portsToUse;
|
|
683
|
-
const builtfile = destFolder + ".mjs";
|
|
684
|
-
let haltReturns = false;
|
|
685
|
-
let buffer = new Buffer("");
|
|
686
|
-
const server = net_1.default.createServer((socket) => {
|
|
687
|
-
socket.on("data", (data) => {
|
|
688
|
-
buffer = Buffer.concat([buffer, data]);
|
|
689
|
-
const messages = [];
|
|
690
|
-
for (let b = 0; b < buffer.length + 1; b++) {
|
|
691
|
-
const c = buffer.slice(0, b);
|
|
692
|
-
let d;
|
|
693
|
-
try {
|
|
694
|
-
d = JSON.parse(c.toString());
|
|
695
|
-
messages.push(d);
|
|
696
|
-
buffer = buffer.slice(b, buffer.length + 1);
|
|
697
|
-
b = 0;
|
|
698
|
-
}
|
|
699
|
-
catch (e) {
|
|
700
|
-
// b++;
|
|
701
|
-
}
|
|
222
|
+
let buffer = new Buffer("");
|
|
223
|
+
const server = net_1.default.createServer((socket) => {
|
|
224
|
+
const queue = new queue_js_1.Queue();
|
|
225
|
+
socket.on("data", (data) => {
|
|
226
|
+
buffer = Buffer.concat([buffer, data]);
|
|
227
|
+
for (let b = 0; b < buffer.length + 1; b++) {
|
|
228
|
+
const c = buffer.slice(0, b);
|
|
229
|
+
let d;
|
|
230
|
+
try {
|
|
231
|
+
d = JSON.parse(c.toString());
|
|
232
|
+
queue.enqueue(d);
|
|
233
|
+
buffer = buffer.slice(b, buffer.length + 1);
|
|
234
|
+
b = 0;
|
|
702
235
|
}
|
|
703
|
-
|
|
236
|
+
catch (e) {
|
|
237
|
+
// b++;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
while (queue.size() > 0) {
|
|
241
|
+
const message = queue.dequeue();
|
|
242
|
+
if (message) {
|
|
243
|
+
// set up the "node" listeners
|
|
704
244
|
this.mapping().forEach(async ([command, func]) => {
|
|
705
|
-
if (
|
|
706
|
-
const x =
|
|
245
|
+
if (message[0] === command) {
|
|
246
|
+
const x = message.slice(1, -1);
|
|
707
247
|
const r = await this[command](...x);
|
|
708
248
|
if (!haltReturns) {
|
|
709
249
|
child.send(JSON.stringify({
|
|
710
250
|
payload: r,
|
|
711
|
-
key:
|
|
251
|
+
key: message[message.length - 1],
|
|
712
252
|
}));
|
|
713
253
|
}
|
|
714
254
|
}
|
|
715
255
|
});
|
|
716
|
-
}
|
|
717
|
-
}
|
|
718
|
-
});
|
|
719
|
-
const child = (0, node_child_process_1.spawn)("node", [builtfile, JSON.stringify(argz)], {
|
|
720
|
-
stdio: ["pipe", "pipe", "pipe", "ipc"],
|
|
721
|
-
// silent: true
|
|
256
|
+
}
|
|
257
|
+
}
|
|
722
258
|
});
|
|
723
|
-
|
|
724
|
-
|
|
259
|
+
});
|
|
260
|
+
const logs = (0, utils_js_1.createLogStreams)(reportDest, "node");
|
|
261
|
+
return new Promise((resolve, reject) => {
|
|
262
|
+
server.listen(ipcfile, () => {
|
|
263
|
+
var _a, _b;
|
|
264
|
+
(_a = child.stdout) === null || _a === void 0 ? void 0 : _a.on("data", (data) => {
|
|
265
|
+
var _a;
|
|
266
|
+
(_a = logs.stdout) === null || _a === void 0 ? void 0 : _a.write(data);
|
|
267
|
+
});
|
|
268
|
+
(_b = child.stderr) === null || _b === void 0 ? void 0 : _b.on("data", (data) => {
|
|
269
|
+
var _a;
|
|
270
|
+
(_a = logs.stderr) === null || _a === void 0 ? void 0 : _a.write(data);
|
|
271
|
+
});
|
|
725
272
|
child.on("close", (code) => {
|
|
273
|
+
const exitCode = code === null ? -1 : code;
|
|
274
|
+
if (exitCode < 0) {
|
|
275
|
+
logs.writeExitCode(exitCode, new Error("Process crashed or was terminated"));
|
|
276
|
+
}
|
|
277
|
+
else {
|
|
278
|
+
logs.writeExitCode(exitCode);
|
|
279
|
+
}
|
|
280
|
+
logs.closeAll();
|
|
726
281
|
server.close();
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
282
|
+
if (exitCode === 255) {
|
|
283
|
+
console.log(ansi_colors_1.default.red(`node ! ${src} failed to execute. No "tests.json" file was generated. Check ${reportDest}/stderr.log for more info`));
|
|
284
|
+
this.bddTestIsNowDone(src, -1);
|
|
285
|
+
(0, utils_js_1.statusMessagePretty)(-1, src, "node");
|
|
286
|
+
reject(new Error(`Process exited with code ${exitCode}`));
|
|
287
|
+
}
|
|
288
|
+
else if (exitCode === 0) {
|
|
289
|
+
this.bddTestIsNowDone(src, 0);
|
|
290
|
+
(0, utils_js_1.statusMessagePretty)(0, src, "node");
|
|
291
|
+
resolve();
|
|
735
292
|
}
|
|
293
|
+
else {
|
|
294
|
+
this.bddTestIsNowDone(src, exitCode);
|
|
295
|
+
(0, utils_js_1.statusMessagePretty)(exitCode, src, "node");
|
|
296
|
+
reject(new Error(`Process exited with code ${exitCode}`));
|
|
297
|
+
}
|
|
298
|
+
haltReturns = true;
|
|
736
299
|
});
|
|
737
300
|
child.on("error", (e) => {
|
|
738
|
-
|
|
739
|
-
if (fs_1.default.existsSync(p)) {
|
|
740
|
-
fs_1.default.rmSync(p);
|
|
741
|
-
}
|
|
301
|
+
console.log("error");
|
|
742
302
|
haltReturns = true;
|
|
743
|
-
console.log(ansi_colors_2.default.red(ansi_colors_2.default.inverse(
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
303
|
+
console.log(ansi_colors_2.default.red(ansi_colors_2.default.inverse(`${src} errored with: ${e.name}. Check error logs for more info`)));
|
|
304
|
+
this.bddTestIsNowDone(src, -1);
|
|
305
|
+
(0, utils_js_1.statusMessagePretty)(-1, src, "node");
|
|
306
|
+
reject(e);
|
|
747
307
|
});
|
|
748
308
|
});
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
else {
|
|
755
|
-
console.log(ansi_colors_2.default.red(`cannot ${src} because there are no open ports. the job will be unqueued`));
|
|
756
|
-
this.queue.push(sidecar[0]);
|
|
757
|
-
return [Math.random(), argz];
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
else {
|
|
761
|
-
console.error("negative port makes no sense", sidecar[0]);
|
|
762
|
-
process.exit(-1);
|
|
763
|
-
}
|
|
764
|
-
};
|
|
765
|
-
this.stopPureSideCar = async (uid) => {
|
|
766
|
-
console.log(ansi_colors_2.default.green(ansi_colors_2.default.inverse(`stopPureSideCar ${uid}`)));
|
|
767
|
-
await this.sidecars[uid].shutdown();
|
|
768
|
-
return;
|
|
769
|
-
};
|
|
770
|
-
this.launchPureSideCar = async (sidecar) => {
|
|
771
|
-
console.log(ansi_colors_2.default.green(ansi_colors_2.default.inverse(`launchPureSideCar ${sidecar[0]}`)));
|
|
772
|
-
const r = Math.random();
|
|
773
|
-
const dest = process.cwd() + `/testeranto/bundles/pure/${this.name}/${sidecar[0]}`;
|
|
774
|
-
const builtfile = dest.split(".").slice(0, -1).concat("mjs").join(".");
|
|
775
|
-
const destFolder = dest.replace(".mjs", "");
|
|
776
|
-
let argz;
|
|
777
|
-
const z = sidecar[2];
|
|
778
|
-
const testConfigResource = sidecar[2];
|
|
779
|
-
const src = sidecar[0];
|
|
780
|
-
const portsToUse = [];
|
|
781
|
-
if (testConfigResource.ports === 0) {
|
|
782
|
-
argz = {
|
|
783
|
-
// scheduled: true,
|
|
784
|
-
name: src,
|
|
785
|
-
ports: portsToUse,
|
|
786
|
-
fs: destFolder,
|
|
787
|
-
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
788
|
-
};
|
|
789
|
-
}
|
|
790
|
-
else if (testConfigResource.ports > 0) {
|
|
791
|
-
const openPorts = Object.entries(this.ports).filter(([portnumber, portopen]) => portopen === "");
|
|
792
|
-
if (openPorts.length >= testConfigResource.ports) {
|
|
793
|
-
for (let i = 0; i < testConfigResource.ports; i++) {
|
|
794
|
-
portsToUse.push(Number(openPorts[i][0]));
|
|
795
|
-
this.ports[openPorts[i][0]] = src; // port is now claimed
|
|
309
|
+
}).finally(() => {
|
|
310
|
+
for (let i = 0; i <= portsToUse.length; i++) {
|
|
311
|
+
if (portsToUse[i]) {
|
|
312
|
+
this.ports[portsToUse[i]] = ""; //port is open again
|
|
313
|
+
}
|
|
796
314
|
}
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
ports: portsToUse,
|
|
802
|
-
fs: ".",
|
|
803
|
-
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
804
|
-
};
|
|
805
|
-
}
|
|
806
|
-
else {
|
|
807
|
-
this.queue.push(src);
|
|
808
|
-
// return;
|
|
809
|
-
}
|
|
810
|
-
}
|
|
811
|
-
else {
|
|
812
|
-
console.error("negative port makes no sense", src);
|
|
813
|
-
process.exit(-1);
|
|
814
|
-
}
|
|
815
|
-
// const builtfile = dest + ".mjs";
|
|
816
|
-
await Promise.resolve(`${`${builtfile}?cacheBust=${Date.now()}`}`).then(s => __importStar(require(s))).then((module) => {
|
|
817
|
-
if (!this.pureSidecars)
|
|
818
|
-
this.pureSidecars = {};
|
|
819
|
-
this.pureSidecars[r] = module.default;
|
|
820
|
-
this.pureSidecars[r].start(argz);
|
|
821
|
-
});
|
|
822
|
-
return [r, argz];
|
|
823
|
-
// for (let i = 0; i <= portsToUse.length; i++) {
|
|
824
|
-
// if (portsToUse[i]) {
|
|
825
|
-
// this.ports[portsToUse[i]] = "true"; //port is open again
|
|
826
|
-
// }
|
|
827
|
-
// }
|
|
828
|
-
};
|
|
829
|
-
this.launchPitono = async (src, dest) => {
|
|
830
|
-
console.log(ansi_colors_2.default.green(ansi_colors_2.default.inverse(`pitono < ${src}`)));
|
|
831
|
-
this.bddTestIsRunning(src);
|
|
832
|
-
const reportDest = `testeranto/reports/${this.name}/${src
|
|
833
|
-
.split(".")
|
|
834
|
-
.slice(0, -1)
|
|
835
|
-
.join(".")}/pitono`;
|
|
836
|
-
if (!fs_1.default.existsSync(reportDest)) {
|
|
837
|
-
fs_1.default.mkdirSync(reportDest, { recursive: true });
|
|
838
|
-
}
|
|
839
|
-
const logs = createLogStreams(reportDest, "node"); // Use node-style logs for pitono
|
|
840
|
-
try {
|
|
841
|
-
// Execute the Python test using the pitono runner
|
|
842
|
-
const { PitonoRunner } = await Promise.resolve().then(() => __importStar(require('./pitonoRunner')));
|
|
843
|
-
const runner = new PitonoRunner(this.configs, this.name);
|
|
844
|
-
await runner.run();
|
|
845
|
-
this.bddTestIsNowDone(src, 0);
|
|
846
|
-
statusMessagePretty(0, src, "pitono");
|
|
847
|
-
}
|
|
848
|
-
catch (error) {
|
|
849
|
-
logs.writeExitCode(-1, error);
|
|
850
|
-
console.log(ansi_colors_2.default.red(ansi_colors_2.default.inverse(`${src} errored with: ${error}. Check logs for more info`)));
|
|
851
|
-
this.bddTestIsNowDone(src, -1);
|
|
852
|
-
statusMessagePretty(-1, src, "pitono");
|
|
853
|
-
}
|
|
315
|
+
});
|
|
316
|
+
})();
|
|
317
|
+
// Add to process manager
|
|
318
|
+
this.addPromiseProcess(processId, nodePromise, command, "bdd-test", src, "node");
|
|
854
319
|
};
|
|
855
320
|
this.launchWeb = async (src, dest) => {
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
.
|
|
861
|
-
.
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
this.browser
|
|
875
|
-
.newPage()
|
|
876
|
-
.then((page) => {
|
|
877
|
-
page.on("console", (log) => {
|
|
878
|
-
var _a, _b, _c, _d;
|
|
879
|
-
const msg = `${log.text()}\n`;
|
|
880
|
-
switch (log.type()) {
|
|
881
|
-
case "info":
|
|
882
|
-
(_a = logs.info) === null || _a === void 0 ? void 0 : _a.write(msg);
|
|
883
|
-
break;
|
|
884
|
-
case "warn":
|
|
885
|
-
(_b = logs.warn) === null || _b === void 0 ? void 0 : _b.write(msg);
|
|
886
|
-
break;
|
|
887
|
-
case "error":
|
|
888
|
-
(_c = logs.error) === null || _c === void 0 ? void 0 : _c.write(msg);
|
|
889
|
-
break;
|
|
890
|
-
case "debug":
|
|
891
|
-
(_d = logs.debug) === null || _d === void 0 ? void 0 : _d.write(msg);
|
|
892
|
-
break;
|
|
893
|
-
default:
|
|
894
|
-
break;
|
|
895
|
-
}
|
|
896
|
-
});
|
|
897
|
-
page.on("close", () => {
|
|
898
|
-
logs.writeExitCode(0); // Web tests exit with 0 unless there's an error
|
|
899
|
-
logs.closeAll();
|
|
900
|
-
logs.closeAll();
|
|
321
|
+
const processId = `web-${src}-${Date.now()}`;
|
|
322
|
+
const command = `web test: ${src}`;
|
|
323
|
+
// Create the promise
|
|
324
|
+
const webPromise = (async () => {
|
|
325
|
+
this.bddTestIsRunning(src);
|
|
326
|
+
const reportDest = `testeranto/reports/${this.name}/${src
|
|
327
|
+
.split(".")
|
|
328
|
+
.slice(0, -1)
|
|
329
|
+
.join(".")}/web`;
|
|
330
|
+
if (!fs_1.default.existsSync(reportDest)) {
|
|
331
|
+
fs_1.default.mkdirSync(reportDest, { recursive: true });
|
|
332
|
+
}
|
|
333
|
+
const destFolder = dest.replace(".mjs", "");
|
|
334
|
+
const webArgz = JSON.stringify({
|
|
335
|
+
name: src,
|
|
336
|
+
ports: [].toString(),
|
|
337
|
+
fs: reportDest,
|
|
338
|
+
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
901
339
|
});
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
340
|
+
const d = `${dest}?cacheBust=${Date.now()}`;
|
|
341
|
+
const logs = (0, utils_js_1.createLogStreams)(reportDest, "web");
|
|
342
|
+
return new Promise((resolve, reject) => {
|
|
343
|
+
this.browser
|
|
344
|
+
.newPage()
|
|
345
|
+
.then((page) => {
|
|
346
|
+
page.on("console", (log) => {
|
|
347
|
+
var _a, _b, _c, _d;
|
|
348
|
+
const msg = `${log.text()}\n`;
|
|
349
|
+
switch (log.type()) {
|
|
350
|
+
case "info":
|
|
351
|
+
(_a = logs.info) === null || _a === void 0 ? void 0 : _a.write(msg);
|
|
352
|
+
break;
|
|
353
|
+
case "warn":
|
|
354
|
+
(_b = logs.warn) === null || _b === void 0 ? void 0 : _b.write(msg);
|
|
355
|
+
break;
|
|
356
|
+
case "error":
|
|
357
|
+
(_c = logs.error) === null || _c === void 0 ? void 0 : _c.write(msg);
|
|
358
|
+
break;
|
|
359
|
+
case "debug":
|
|
360
|
+
(_d = logs.debug) === null || _d === void 0 ? void 0 : _d.write(msg);
|
|
361
|
+
break;
|
|
362
|
+
default:
|
|
363
|
+
break;
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
page.on("close", () => {
|
|
367
|
+
logs.writeExitCode(0);
|
|
368
|
+
logs.closeAll();
|
|
369
|
+
});
|
|
370
|
+
this.mapping().forEach(async ([command, func]) => {
|
|
371
|
+
if (command === "page") {
|
|
372
|
+
page.exposeFunction(command, (x) => {
|
|
373
|
+
if (x) {
|
|
374
|
+
return func(x);
|
|
375
|
+
}
|
|
376
|
+
else {
|
|
377
|
+
return func(page.mainFrame()._id);
|
|
378
|
+
}
|
|
379
|
+
});
|
|
907
380
|
}
|
|
908
381
|
else {
|
|
909
|
-
return
|
|
382
|
+
return page.exposeFunction(command, func);
|
|
910
383
|
}
|
|
911
384
|
});
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
page.
|
|
385
|
+
return page;
|
|
386
|
+
})
|
|
387
|
+
.then(async (page) => {
|
|
388
|
+
const close = () => {
|
|
389
|
+
if (!files[src]) {
|
|
390
|
+
files[src] = new Set();
|
|
391
|
+
}
|
|
392
|
+
delete files[src];
|
|
393
|
+
Promise.all(screenshots[src] || []).then(() => {
|
|
394
|
+
delete screenshots[src];
|
|
395
|
+
page.close();
|
|
396
|
+
});
|
|
397
|
+
};
|
|
398
|
+
page.on("pageerror", (err) => {
|
|
399
|
+
logs.writeExitCode(-1, err);
|
|
400
|
+
console.log(ansi_colors_1.default.red(`web ! ${src} failed to execute No "tests.json" file was generated. Check ${reportDest}/error.log for more info`));
|
|
401
|
+
this.bddTestIsNowDone(src, -1);
|
|
402
|
+
close();
|
|
403
|
+
reject(err);
|
|
404
|
+
});
|
|
405
|
+
await page.goto(`file://${`${destFolder}.html`}`, {});
|
|
406
|
+
await page
|
|
407
|
+
.evaluate((0, utils_1.webEvaluator)(d, webArgz))
|
|
408
|
+
.then(async ({ fails, failed, features }) => {
|
|
409
|
+
(0, utils_js_1.statusMessagePretty)(fails, src, "web");
|
|
410
|
+
this.bddTestIsNowDone(src, fails);
|
|
411
|
+
resolve();
|
|
412
|
+
})
|
|
413
|
+
.catch((e) => {
|
|
414
|
+
console.log(ansi_colors_2.default.red(ansi_colors_2.default.inverse(e.stack)));
|
|
415
|
+
console.log(ansi_colors_2.default.red(ansi_colors_2.default.inverse(`web ! ${src} failed to execute. No "tests.json" file was generated. Check logs for more info`)));
|
|
416
|
+
this.bddTestIsNowDone(src, -1);
|
|
417
|
+
reject(e);
|
|
418
|
+
})
|
|
419
|
+
.finally(() => {
|
|
420
|
+
close();
|
|
421
|
+
});
|
|
422
|
+
})
|
|
423
|
+
.catch((error) => {
|
|
424
|
+
reject(error);
|
|
933
425
|
});
|
|
934
|
-
return;
|
|
935
|
-
};
|
|
936
|
-
page.on("pageerror", (err) => {
|
|
937
|
-
logs.writeExitCode(-1, err);
|
|
938
|
-
console.log(ansi_colors_1.default.red(`web ! ${src} failed to execute No "tests.json" file was generated. Check ${reportDest}/error.log for more info`));
|
|
939
|
-
this.bddTestIsNowDone(src, -1);
|
|
940
|
-
close();
|
|
941
426
|
});
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
.evaluate(`
|
|
946
|
-
import('${d}').then(async (x) => {
|
|
947
|
-
try {
|
|
948
|
-
return await (await x.default).receiveTestResourceConfig(${webArgz})
|
|
949
|
-
} catch (e) {
|
|
950
|
-
console.log("web run failure", e.toString())
|
|
951
|
-
}
|
|
952
|
-
})
|
|
953
|
-
`)
|
|
954
|
-
.then(async ({ fails, failed, features }) => {
|
|
955
|
-
statusMessagePretty(fails, src, "web");
|
|
956
|
-
this.bddTestIsNowDone(src, fails);
|
|
957
|
-
// close();
|
|
958
|
-
})
|
|
959
|
-
.catch((e) => {
|
|
960
|
-
console.log(ansi_colors_2.default.red(ansi_colors_2.default.inverse(e.stack)));
|
|
961
|
-
console.log(ansi_colors_2.default.red(ansi_colors_2.default.inverse(`web ! ${src} failed to execute. No "tests.json" file was generated. Check logs for more info`)));
|
|
962
|
-
this.bddTestIsNowDone(src, -1);
|
|
963
|
-
})
|
|
964
|
-
.finally(() => {
|
|
965
|
-
// process.exit(-1);
|
|
966
|
-
close();
|
|
967
|
-
});
|
|
968
|
-
return page;
|
|
969
|
-
});
|
|
427
|
+
})();
|
|
428
|
+
// Add to process manager
|
|
429
|
+
this.addPromiseProcess(processId, webPromise, command, "bdd-test", src, "web");
|
|
970
430
|
};
|
|
971
|
-
this.
|
|
972
|
-
const
|
|
973
|
-
|
|
974
|
-
const
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
return;
|
|
978
|
-
}
|
|
979
|
-
const testReport = JSON.parse(fs_1.default.readFileSync(testReportPath, "utf8"));
|
|
980
|
-
// Add full path information to each test
|
|
981
|
-
if (testReport.tests) {
|
|
982
|
-
testReport.tests.forEach((test) => {
|
|
983
|
-
// Add the full path to each test
|
|
984
|
-
test.fullPath = path_1.default.resolve(process.cwd(), srcTest);
|
|
985
|
-
});
|
|
986
|
-
}
|
|
987
|
-
// Add full path to the report itself
|
|
988
|
-
testReport.fullPath = path_1.default.resolve(process.cwd(), srcTest);
|
|
989
|
-
// Write the modified report back
|
|
990
|
-
fs_1.default.writeFileSync(testReportPath, JSON.stringify(testReport, null, 2));
|
|
991
|
-
testReport.features
|
|
992
|
-
.reduce(async (mm, featureStringKey) => {
|
|
993
|
-
const accum = await mm;
|
|
994
|
-
const isUrl = isValidUrl(featureStringKey);
|
|
995
|
-
if (isUrl) {
|
|
996
|
-
const u = new URL(featureStringKey);
|
|
997
|
-
if (u.protocol === "file:") {
|
|
998
|
-
const newPath = `${process.cwd()}/testeranto/features/internal/${path_1.default.relative(process.cwd(), u.pathname)}`;
|
|
999
|
-
// await fs.promises.mkdir(path.dirname(newPath), { recursive: true });
|
|
1000
|
-
// try {
|
|
1001
|
-
// await fs.unlinkSync(newPath);
|
|
1002
|
-
// // console.log(`Removed existing link at ${newPath}`);
|
|
1003
|
-
// } catch (error) {
|
|
1004
|
-
// if (error.code !== "ENOENT") {
|
|
1005
|
-
// // throw error;
|
|
1006
|
-
// }
|
|
1007
|
-
// }
|
|
1008
|
-
// fs.symlink(u.pathname, newPath, (err) => {
|
|
1009
|
-
// if (err) {
|
|
1010
|
-
// // console.error("Error creating symlink:", err);
|
|
1011
|
-
// } else {
|
|
1012
|
-
// // console.log("Symlink created successfully");
|
|
1013
|
-
// }
|
|
1014
|
-
// });
|
|
1015
|
-
accum.files.push(u.pathname);
|
|
1016
|
-
}
|
|
1017
|
-
else if (u.protocol === "http:" || u.protocol === "https:") {
|
|
1018
|
-
const newPath = `${process.cwd()}/testeranto/features/external/${u.hostname}${u.pathname}`;
|
|
1019
|
-
const body = await this.configs.featureIngestor(featureStringKey);
|
|
1020
|
-
writeFileAndCreateDir(newPath, body);
|
|
1021
|
-
accum.files.push(newPath);
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1024
|
-
else {
|
|
1025
|
-
await fs_1.default.promises.mkdir(path_1.default.dirname(featureDestination), {
|
|
1026
|
-
recursive: true,
|
|
1027
|
-
});
|
|
1028
|
-
accum.strings.push(featureStringKey);
|
|
1029
|
-
}
|
|
1030
|
-
return accum;
|
|
1031
|
-
}, Promise.resolve({ files: [], strings: [] }))
|
|
1032
|
-
.then(({ files, strings }) => {
|
|
1033
|
-
// Markdown files must be referenced in the prompt but string style features are already present in the tests.json file
|
|
1034
|
-
fs_1.default.writeFileSync(`testeranto/reports/${this.name}/${srcTest
|
|
431
|
+
this.launchPython = async (src, dest) => {
|
|
432
|
+
const processId = `python-${src}-${Date.now()}`;
|
|
433
|
+
const command = `python test: ${src}`;
|
|
434
|
+
const pythonPromise = (async () => {
|
|
435
|
+
this.bddTestIsRunning(src);
|
|
436
|
+
const reportDest = `testeranto/reports/${this.name}/${src
|
|
1035
437
|
.split(".")
|
|
1036
438
|
.slice(0, -1)
|
|
1037
|
-
.join(".")}
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
})
|
|
1041
|
-
.join("\n"));
|
|
1042
|
-
});
|
|
1043
|
-
// const f: Record<string, string> = {};
|
|
1044
|
-
testReport.givens.forEach((g) => {
|
|
1045
|
-
if (g.failed === true) {
|
|
1046
|
-
this.summary[srcTest].failingFeatures[g.key] = g.features;
|
|
1047
|
-
}
|
|
1048
|
-
});
|
|
1049
|
-
// this.summary[srcTest].failingFeatures = f;
|
|
1050
|
-
this.writeBigBoard();
|
|
1051
|
-
};
|
|
1052
|
-
this.checkForShutdown = () => {
|
|
1053
|
-
// console.log(ansiC.inverse(JSON.stringify(this.summary, null, 2)));
|
|
1054
|
-
this.checkQueue();
|
|
1055
|
-
console.log(ansi_colors_2.default.inverse(`The following jobs are awaiting resources: ${JSON.stringify(this.queue)}`));
|
|
1056
|
-
console.log(ansi_colors_2.default.inverse(`The status of ports: ${JSON.stringify(this.ports)}`));
|
|
1057
|
-
this.writeBigBoard();
|
|
1058
|
-
if (this.mode === "dev")
|
|
1059
|
-
return;
|
|
1060
|
-
let inflight = false;
|
|
1061
|
-
Object.keys(this.summary).forEach((k) => {
|
|
1062
|
-
if (this.summary[k].prompt === "?") {
|
|
1063
|
-
console.log(ansi_colors_2.default.blue(ansi_colors_2.default.inverse(`🕕 prompt ${k}`)));
|
|
1064
|
-
inflight = true;
|
|
1065
|
-
}
|
|
1066
|
-
});
|
|
1067
|
-
Object.keys(this.summary).forEach((k) => {
|
|
1068
|
-
if (this.summary[k].runTimeErrors === "?") {
|
|
1069
|
-
console.log(ansi_colors_2.default.blue(ansi_colors_2.default.inverse(`🕕 runTimeError ${k}`)));
|
|
1070
|
-
inflight = true;
|
|
1071
|
-
}
|
|
1072
|
-
});
|
|
1073
|
-
Object.keys(this.summary).forEach((k) => {
|
|
1074
|
-
if (this.summary[k].staticErrors === "?") {
|
|
1075
|
-
console.log(ansi_colors_2.default.blue(ansi_colors_2.default.inverse(`🕕 staticErrors ${k}`)));
|
|
1076
|
-
inflight = true;
|
|
439
|
+
.join(".")}/python`;
|
|
440
|
+
if (!fs_1.default.existsSync(reportDest)) {
|
|
441
|
+
fs_1.default.mkdirSync(reportDest, { recursive: true });
|
|
1077
442
|
}
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
if (
|
|
1081
|
-
console.log(
|
|
1082
|
-
|
|
443
|
+
let testResources = "";
|
|
444
|
+
const testConfig = this.configs.tests.find((t) => t[0] === src);
|
|
445
|
+
if (!testConfig) {
|
|
446
|
+
console.log(ansi_colors_1.default.inverse(`missing test config! Exiting ungracefully for '${src}'`));
|
|
447
|
+
process.exit(-1);
|
|
1083
448
|
}
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
}
|
|
449
|
+
const testConfigResource = testConfig[2];
|
|
450
|
+
const portsToUse = [];
|
|
451
|
+
if (testConfigResource.ports === 0) {
|
|
452
|
+
testResources = JSON.stringify({
|
|
453
|
+
scheduled: true,
|
|
454
|
+
name: src,
|
|
455
|
+
ports: portsToUse,
|
|
456
|
+
fs: reportDest,
|
|
457
|
+
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
458
|
+
});
|
|
1094
459
|
}
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
this.webSidecars = {};
|
|
1102
|
-
this.pureSidecars = {};
|
|
1103
|
-
this.configs.ports.forEach((element) => {
|
|
1104
|
-
this.ports[element] = ""; // set ports as open
|
|
1105
|
-
});
|
|
1106
|
-
// Create HTTP server
|
|
1107
|
-
this.httpServer = http_1.default.createServer(this.requestHandler.bind(this));
|
|
1108
|
-
// Start WebSocket server attached to the HTTP server
|
|
1109
|
-
this.wss = new ws_1.WebSocketServer({ server: this.httpServer });
|
|
1110
|
-
this.wss.on("connection", (ws) => {
|
|
1111
|
-
this.clients.add(ws);
|
|
1112
|
-
console.log("Client connected");
|
|
1113
|
-
ws.on("message", (data) => {
|
|
1114
|
-
var _a, _b;
|
|
1115
|
-
try {
|
|
1116
|
-
const message = JSON.parse(data.toString());
|
|
1117
|
-
if (message.type === "executeCommand") {
|
|
1118
|
-
// Validate the command starts with 'aider'
|
|
1119
|
-
if (message.command && message.command.trim().startsWith("aider")) {
|
|
1120
|
-
console.log(`Executing command: ${message.command}`);
|
|
1121
|
-
// Execute the command
|
|
1122
|
-
const processId = Date.now().toString();
|
|
1123
|
-
const child = (0, node_child_process_1.spawn)(message.command, {
|
|
1124
|
-
shell: true,
|
|
1125
|
-
cwd: process.cwd(),
|
|
1126
|
-
});
|
|
1127
|
-
// Track the process in both maps
|
|
1128
|
-
this.runningProcesses.set(processId, child);
|
|
1129
|
-
this.allProcesses.set(processId, {
|
|
1130
|
-
child,
|
|
1131
|
-
status: "running",
|
|
1132
|
-
command: message.command,
|
|
1133
|
-
pid: child.pid,
|
|
1134
|
-
timestamp: new Date().toISOString(),
|
|
1135
|
-
});
|
|
1136
|
-
// Initialize logs for this process
|
|
1137
|
-
this.processLogs.set(processId, []);
|
|
1138
|
-
// Broadcast process started
|
|
1139
|
-
this.broadcast({
|
|
1140
|
-
type: "processStarted",
|
|
1141
|
-
processId,
|
|
1142
|
-
command: message.command,
|
|
1143
|
-
timestamp: new Date().toISOString(),
|
|
1144
|
-
logs: [],
|
|
1145
|
-
});
|
|
1146
|
-
// Capture stdout and stderr
|
|
1147
|
-
(_a = child.stdout) === null || _a === void 0 ? void 0 : _a.on("data", (data) => {
|
|
1148
|
-
const logData = data.toString();
|
|
1149
|
-
// Add to stored logs
|
|
1150
|
-
const logs = this.processLogs.get(processId) || [];
|
|
1151
|
-
logs.push(logData);
|
|
1152
|
-
this.processLogs.set(processId, logs);
|
|
1153
|
-
this.broadcast({
|
|
1154
|
-
type: "processStdout",
|
|
1155
|
-
processId,
|
|
1156
|
-
data: logData,
|
|
1157
|
-
timestamp: new Date().toISOString(),
|
|
1158
|
-
});
|
|
1159
|
-
});
|
|
1160
|
-
(_b = child.stderr) === null || _b === void 0 ? void 0 : _b.on("data", (data) => {
|
|
1161
|
-
const logData = data.toString();
|
|
1162
|
-
// Add to stored logs
|
|
1163
|
-
const logs = this.processLogs.get(processId) || [];
|
|
1164
|
-
logs.push(logData);
|
|
1165
|
-
this.processLogs.set(processId, logs);
|
|
1166
|
-
this.broadcast({
|
|
1167
|
-
type: "processStderr",
|
|
1168
|
-
processId,
|
|
1169
|
-
data: logData,
|
|
1170
|
-
timestamp: new Date().toISOString(),
|
|
1171
|
-
});
|
|
1172
|
-
});
|
|
1173
|
-
child.on("error", (error) => {
|
|
1174
|
-
console.error(`Failed to execute command: ${error}`);
|
|
1175
|
-
this.runningProcesses.delete(processId);
|
|
1176
|
-
// Update the process status to error
|
|
1177
|
-
const processInfo = this.allProcesses.get(processId);
|
|
1178
|
-
if (processInfo) {
|
|
1179
|
-
this.allProcesses.set(processId, Object.assign(Object.assign({}, processInfo), { status: "error", error: error.message }));
|
|
1180
|
-
}
|
|
1181
|
-
this.broadcast({
|
|
1182
|
-
type: "processError",
|
|
1183
|
-
processId,
|
|
1184
|
-
error: error.message,
|
|
1185
|
-
timestamp: new Date().toISOString(),
|
|
1186
|
-
});
|
|
1187
|
-
});
|
|
1188
|
-
child.on("exit", (code) => {
|
|
1189
|
-
console.log(`Command exited with code ${code}`);
|
|
1190
|
-
// Remove from running processes but keep in allProcesses
|
|
1191
|
-
this.runningProcesses.delete(processId);
|
|
1192
|
-
// Update the process status to exited
|
|
1193
|
-
const processInfo = this.allProcesses.get(processId);
|
|
1194
|
-
if (processInfo) {
|
|
1195
|
-
this.allProcesses.set(processId, Object.assign(Object.assign({}, processInfo), { status: "exited", exitCode: code }));
|
|
1196
|
-
}
|
|
1197
|
-
this.broadcast({
|
|
1198
|
-
type: "processExited",
|
|
1199
|
-
processId,
|
|
1200
|
-
exitCode: code,
|
|
1201
|
-
timestamp: new Date().toISOString(),
|
|
1202
|
-
});
|
|
1203
|
-
});
|
|
460
|
+
else if (testConfigResource.ports > 0) {
|
|
461
|
+
const openPorts = Object.entries(this.ports).filter(([, status]) => status === "");
|
|
462
|
+
if (openPorts.length >= testConfigResource.ports) {
|
|
463
|
+
for (let i = 0; i < testConfigResource.ports; i++) {
|
|
464
|
+
portsToUse.push(openPorts[i][0]);
|
|
465
|
+
this.ports[openPorts[i][0]] = src;
|
|
1204
466
|
}
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
processId: id,
|
|
1213
|
-
command: procInfo.command,
|
|
1214
|
-
pid: procInfo.pid,
|
|
1215
|
-
status: procInfo.status,
|
|
1216
|
-
exitCode: procInfo.exitCode,
|
|
1217
|
-
error: procInfo.error,
|
|
1218
|
-
timestamp: procInfo.timestamp,
|
|
1219
|
-
logs: this.processLogs.get(id) || [],
|
|
1220
|
-
}));
|
|
1221
|
-
ws.send(JSON.stringify({
|
|
1222
|
-
type: "runningProcesses",
|
|
1223
|
-
processes,
|
|
1224
|
-
}));
|
|
467
|
+
testResources = JSON.stringify({
|
|
468
|
+
scheduled: true,
|
|
469
|
+
name: src,
|
|
470
|
+
ports: portsToUse,
|
|
471
|
+
fs: reportDest,
|
|
472
|
+
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
473
|
+
});
|
|
1225
474
|
}
|
|
1226
|
-
else
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
if (procInfo) {
|
|
1231
|
-
ws.send(JSON.stringify({
|
|
1232
|
-
type: "processData",
|
|
1233
|
-
processId,
|
|
1234
|
-
command: procInfo.command,
|
|
1235
|
-
pid: procInfo.pid,
|
|
1236
|
-
status: procInfo.status,
|
|
1237
|
-
exitCode: procInfo.exitCode,
|
|
1238
|
-
error: procInfo.error,
|
|
1239
|
-
timestamp: procInfo.timestamp,
|
|
1240
|
-
logs: this.processLogs.get(processId) || [],
|
|
1241
|
-
}));
|
|
1242
|
-
}
|
|
475
|
+
else {
|
|
476
|
+
console.log(ansi_colors_1.default.red(`python: cannot run ${src} because there are no open ports ATM. This job will be enqueued and run again when a port is available`));
|
|
477
|
+
this.queue.push(src);
|
|
478
|
+
return;
|
|
1243
479
|
}
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
480
|
+
}
|
|
481
|
+
else {
|
|
482
|
+
console.error("negative port makes no sense", src);
|
|
483
|
+
process.exit(-1);
|
|
484
|
+
}
|
|
485
|
+
const logs = (0, utils_js_1.createLogStreams)(reportDest, "python");
|
|
486
|
+
// For Python, we'll just run the script directly and pass test resources as an argument
|
|
487
|
+
// Python tests need to handle their own IPC if needed
|
|
488
|
+
const child = (0, node_child_process_1.spawn)("python3", [src, testResources], {
|
|
489
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
490
|
+
});
|
|
491
|
+
return new Promise((resolve, reject) => {
|
|
492
|
+
var _a, _b;
|
|
493
|
+
(_a = child.stdout) === null || _a === void 0 ? void 0 : _a.on("data", (data) => {
|
|
494
|
+
var _a;
|
|
495
|
+
(_a = logs.stdout) === null || _a === void 0 ? void 0 : _a.write(data);
|
|
496
|
+
});
|
|
497
|
+
(_b = child.stderr) === null || _b === void 0 ? void 0 : _b.on("data", (data) => {
|
|
498
|
+
var _a;
|
|
499
|
+
(_a = logs.stderr) === null || _a === void 0 ? void 0 : _a.write(data);
|
|
500
|
+
});
|
|
501
|
+
child.on("close", (code) => {
|
|
502
|
+
const exitCode = code === null ? -1 : code;
|
|
503
|
+
if (exitCode < 0) {
|
|
504
|
+
logs.writeExitCode(exitCode, new Error("Process crashed or was terminated"));
|
|
1253
505
|
}
|
|
1254
506
|
else {
|
|
1255
|
-
|
|
1256
|
-
processExists: !!childProcess,
|
|
1257
|
-
stdinExists: (childProcess === null || childProcess === void 0 ? void 0 : childProcess.stdin) ? true : false,
|
|
1258
|
-
});
|
|
507
|
+
logs.writeExitCode(exitCode);
|
|
1259
508
|
}
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
const childProcess = this.runningProcesses.get(processId);
|
|
1266
|
-
if (childProcess) {
|
|
1267
|
-
console.log("Killing process");
|
|
1268
|
-
childProcess.kill("SIGTERM");
|
|
1269
|
-
// The process exit handler will update the status and broadcast the change
|
|
509
|
+
logs.closeAll();
|
|
510
|
+
if (exitCode === 0) {
|
|
511
|
+
this.bddTestIsNowDone(src, 0);
|
|
512
|
+
(0, utils_js_1.statusMessagePretty)(0, src, "python");
|
|
513
|
+
resolve();
|
|
1270
514
|
}
|
|
1271
515
|
else {
|
|
1272
|
-
console.log(
|
|
1273
|
-
|
|
1274
|
-
|
|
516
|
+
console.log(ansi_colors_1.default.red(`python ! ${src} failed to execute. Check ${reportDest}/stderr.log for more info`));
|
|
517
|
+
this.bddTestIsNowDone(src, exitCode);
|
|
518
|
+
(0, utils_js_1.statusMessagePretty)(exitCode, src, "python");
|
|
519
|
+
reject(new Error(`Process exited with code ${exitCode}`));
|
|
1275
520
|
}
|
|
1276
|
-
}
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
console.error("WebSocket error:", error);
|
|
1288
|
-
this.clients.delete(ws);
|
|
1289
|
-
});
|
|
1290
|
-
});
|
|
1291
|
-
// Start HTTP server
|
|
1292
|
-
const httpPort = Number(process.env.HTTP_PORT) || 3000;
|
|
1293
|
-
this.httpServer.listen(httpPort, () => {
|
|
1294
|
-
console.log(`HTTP server running on http://localhost:${httpPort}`);
|
|
1295
|
-
});
|
|
1296
|
-
}
|
|
1297
|
-
async stopSideCar(uid) {
|
|
1298
|
-
console.log(ansi_colors_2.default.green(ansi_colors_2.default.inverse(`stopSideCar ${uid}`)));
|
|
1299
|
-
Object.entries(this.pureSidecars).forEach(async ([k, v]) => {
|
|
1300
|
-
if (Number(k) === uid) {
|
|
1301
|
-
await this.pureSidecars[Number(k)].stop();
|
|
1302
|
-
delete this.pureSidecars[Number(k)];
|
|
1303
|
-
}
|
|
1304
|
-
});
|
|
1305
|
-
Object.entries(this.nodeSidecars).forEach(async ([k, v]) => {
|
|
1306
|
-
if (Number(k) === uid) {
|
|
1307
|
-
await this.nodeSidecars[Number(k)].send("stop");
|
|
1308
|
-
delete this.nodeSidecars[Number(k)];
|
|
1309
|
-
}
|
|
1310
|
-
});
|
|
1311
|
-
Object.entries(this.webSidecars).forEach(async ([k, v]) => {
|
|
1312
|
-
if (Number(k) === uid) {
|
|
1313
|
-
(await this.browser.pages()).forEach(async (p) => {
|
|
1314
|
-
if (p.mainFrame()._id === k) {
|
|
1315
|
-
await this.webSidecars[Number(k)].close();
|
|
1316
|
-
delete this.webSidecars[Number(k)];
|
|
1317
|
-
}
|
|
521
|
+
});
|
|
522
|
+
child.on("error", (e) => {
|
|
523
|
+
console.log(ansi_colors_1.default.red(ansi_colors_1.default.inverse(`python: ${src} errored with: ${e.name}. Check error logs for more info`)));
|
|
524
|
+
this.bddTestIsNowDone(src, -1);
|
|
525
|
+
(0, utils_js_1.statusMessagePretty)(-1, src, "python");
|
|
526
|
+
reject(e);
|
|
527
|
+
});
|
|
528
|
+
}).finally(() => {
|
|
529
|
+
portsToUse.forEach(port => {
|
|
530
|
+
this.ports[port] = "";
|
|
531
|
+
});
|
|
1318
532
|
});
|
|
1319
|
-
}
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
return this.launchWebSideCar(s);
|
|
1334
|
-
}
|
|
1335
|
-
else if (r === "pure") {
|
|
1336
|
-
return this.launchPureSideCar(s);
|
|
1337
|
-
}
|
|
1338
|
-
else {
|
|
1339
|
-
throw `unknown runtime ${r}`;
|
|
1340
|
-
}
|
|
1341
|
-
}
|
|
1342
|
-
mapping() {
|
|
1343
|
-
return [
|
|
1344
|
-
["$", this.$],
|
|
1345
|
-
["click", this.click],
|
|
1346
|
-
["closePage", this.closePage],
|
|
1347
|
-
["createWriteStream", this.createWriteStream],
|
|
1348
|
-
["customclose", this.customclose],
|
|
1349
|
-
["customScreenShot", this.customScreenShot.bind(this)],
|
|
1350
|
-
["end", this.end],
|
|
1351
|
-
["existsSync", this.existsSync],
|
|
1352
|
-
["focusOn", this.focusOn],
|
|
1353
|
-
["getAttribute", this.getAttribute],
|
|
1354
|
-
["getInnerHtml", this.getInnerHtml],
|
|
1355
|
-
// ["setValue", this.setValue],
|
|
1356
|
-
["goto", this.goto.bind(this)],
|
|
1357
|
-
["isDisabled", this.isDisabled],
|
|
1358
|
-
["launchSideCar", this.launchSideCar.bind(this)],
|
|
1359
|
-
["mkdirSync", this.mkdirSync],
|
|
1360
|
-
["newPage", this.newPage],
|
|
1361
|
-
["page", this.page],
|
|
1362
|
-
["pages", this.pages],
|
|
1363
|
-
["screencast", this.screencast],
|
|
1364
|
-
["screencastStop", this.screencastStop],
|
|
1365
|
-
["stopSideCar", this.stopSideCar.bind(this)],
|
|
1366
|
-
["typeInto", this.typeInto],
|
|
1367
|
-
["waitForSelector", this.waitForSelector],
|
|
1368
|
-
["write", this.write],
|
|
1369
|
-
["writeFileSync", this.writeFileSync],
|
|
1370
|
-
];
|
|
1371
|
-
}
|
|
1372
|
-
async start() {
|
|
1373
|
-
// set up the "pure" listeners
|
|
1374
|
-
this.mapping().forEach(async ([command, func]) => {
|
|
1375
|
-
globalThis[command] = func;
|
|
1376
|
-
});
|
|
1377
|
-
if (!fs_1.default.existsSync(`testeranto/reports/${this.name}`)) {
|
|
1378
|
-
fs_1.default.mkdirSync(`testeranto/reports/${this.name}`);
|
|
1379
|
-
}
|
|
1380
|
-
const executablePath = "/opt/homebrew/bin/chromium";
|
|
1381
|
-
try {
|
|
1382
|
-
this.browser = await puppeteer_core_1.default.launch({
|
|
1383
|
-
slowMo: 1,
|
|
1384
|
-
waitForInitialPage: false,
|
|
1385
|
-
executablePath,
|
|
1386
|
-
headless: true,
|
|
1387
|
-
defaultViewport: null, // Disable default 800x600 viewport
|
|
1388
|
-
dumpio: false,
|
|
1389
|
-
devtools: false,
|
|
1390
|
-
args: [
|
|
1391
|
-
"--allow-file-access-from-files",
|
|
1392
|
-
"--allow-insecure-localhost",
|
|
1393
|
-
"--allow-running-insecure-content",
|
|
1394
|
-
"--auto-open-devtools-for-tabs",
|
|
1395
|
-
"--disable-dev-shm-usage",
|
|
1396
|
-
"--disable-extensions",
|
|
1397
|
-
"--disable-features=site-per-process",
|
|
1398
|
-
"--disable-gpu",
|
|
1399
|
-
"--disable-setuid-sandbox",
|
|
1400
|
-
"--disable-site-isolation-trials",
|
|
1401
|
-
"--disable-web-security",
|
|
1402
|
-
"--no-first-run",
|
|
1403
|
-
"--no-sandbox",
|
|
1404
|
-
"--no-startup-window",
|
|
1405
|
-
"--reduce-security-for-testing",
|
|
1406
|
-
"--remote-allow-origins=*",
|
|
1407
|
-
"--start-maximized",
|
|
1408
|
-
"--unsafely-treat-insecure-origin-as-secure=*",
|
|
1409
|
-
`--remote-debugging-port=3234`,
|
|
1410
|
-
// "--disable-features=IsolateOrigins,site-per-process",
|
|
1411
|
-
// "--disable-features=IsolateOrigins",
|
|
1412
|
-
// "--disk-cache-dir=/dev/null",
|
|
1413
|
-
// "--disk-cache-size=1",
|
|
1414
|
-
// "--no-zygote",
|
|
1415
|
-
// "--remote-allow-origins=ws://localhost:3234",
|
|
1416
|
-
// "--single-process",
|
|
1417
|
-
// "--start-maximized",
|
|
1418
|
-
// "--unsafely-treat-insecure-origin-as-secure",
|
|
1419
|
-
// "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
|
|
1420
|
-
],
|
|
1421
|
-
});
|
|
1422
|
-
}
|
|
1423
|
-
catch (e) {
|
|
1424
|
-
console.error(e);
|
|
1425
|
-
console.error("could not start chrome via puppeter. Check this path: ", executablePath);
|
|
1426
|
-
}
|
|
1427
|
-
const { nodeEntryPoints, webEntryPoints, pureEntryPoints, pitonoEntryPoints } = this.getRunnables(this.configs.tests, this.name);
|
|
1428
|
-
[
|
|
1429
|
-
[
|
|
1430
|
-
nodeEntryPoints,
|
|
1431
|
-
this.launchNode,
|
|
1432
|
-
"node",
|
|
1433
|
-
(w) => {
|
|
1434
|
-
this.nodeMetafileWatcher = w;
|
|
1435
|
-
},
|
|
1436
|
-
],
|
|
1437
|
-
[
|
|
1438
|
-
webEntryPoints,
|
|
1439
|
-
this.launchWeb,
|
|
1440
|
-
"web",
|
|
1441
|
-
(w) => {
|
|
1442
|
-
this.webMetafileWatcher = w;
|
|
1443
|
-
},
|
|
1444
|
-
],
|
|
1445
|
-
[
|
|
1446
|
-
pureEntryPoints,
|
|
1447
|
-
this.launchPure,
|
|
1448
|
-
"pure",
|
|
1449
|
-
(w) => {
|
|
1450
|
-
this.importMetafileWatcher = w;
|
|
1451
|
-
},
|
|
1452
|
-
],
|
|
1453
|
-
[
|
|
1454
|
-
pitonoEntryPoints,
|
|
1455
|
-
this.launchPitono,
|
|
1456
|
-
"pitono",
|
|
1457
|
-
(w) => {
|
|
1458
|
-
this.pitonoMetafileWatcher = w;
|
|
1459
|
-
},
|
|
1460
|
-
],
|
|
1461
|
-
].forEach(async ([eps, launcher, runtime, watcher]) => {
|
|
1462
|
-
let metafile;
|
|
1463
|
-
if (runtime === "pitono") {
|
|
1464
|
-
metafile = `./testeranto/metafiles/python/core.json`;
|
|
1465
|
-
// Ensure the directory exists before trying to watch
|
|
1466
|
-
const metafileDir = path_1.default.dirname(metafile);
|
|
1467
|
-
if (!fs_1.default.existsSync(metafileDir)) {
|
|
1468
|
-
fs_1.default.mkdirSync(metafileDir, { recursive: true });
|
|
533
|
+
})();
|
|
534
|
+
this.addPromiseProcess(processId, pythonPromise, command, "bdd-test", src, "python");
|
|
535
|
+
};
|
|
536
|
+
this.launchGolang = async (src, dest) => {
|
|
537
|
+
const processId = `golang-${src}-${Date.now()}`;
|
|
538
|
+
const command = `golang test: ${src}`;
|
|
539
|
+
const golangPromise = (async () => {
|
|
540
|
+
this.bddTestIsRunning(src);
|
|
541
|
+
const reportDest = `testeranto/reports/${this.name}/${src
|
|
542
|
+
.split(".")
|
|
543
|
+
.slice(0, -1)
|
|
544
|
+
.join(".")}/golang`;
|
|
545
|
+
if (!fs_1.default.existsSync(reportDest)) {
|
|
546
|
+
fs_1.default.mkdirSync(reportDest, { recursive: true });
|
|
1469
547
|
}
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
if (runtime !== "pitono") {
|
|
1476
|
-
await pollForFile(metafile);
|
|
1477
|
-
}
|
|
1478
|
-
Object.entries(eps).forEach(async ([inputFile, outputFile]) => {
|
|
1479
|
-
// await pollForFile(outputFile);\
|
|
1480
|
-
this.launchers[inputFile] = () => launcher(inputFile, outputFile);
|
|
1481
|
-
this.launchers[inputFile]();
|
|
1482
|
-
try {
|
|
1483
|
-
(0, fs_1.watch)(outputFile, async (e, filename) => {
|
|
1484
|
-
const hash = await fileHash(outputFile);
|
|
1485
|
-
if (fileHashes[inputFile] !== hash) {
|
|
1486
|
-
fileHashes[inputFile] = hash;
|
|
1487
|
-
console.log(ansi_colors_2.default.yellow(ansi_colors_2.default.inverse(`< ${e} ${filename}`)));
|
|
1488
|
-
// launcher(inputFile, outputFile);
|
|
1489
|
-
this.launchers[inputFile]();
|
|
1490
|
-
}
|
|
1491
|
-
});
|
|
548
|
+
let testResources = "";
|
|
549
|
+
const testConfig = this.configs.tests.find((t) => t[0] === src);
|
|
550
|
+
if (!testConfig) {
|
|
551
|
+
console.log(ansi_colors_1.default.inverse(`golang: missing test config! Exiting ungracefully for '${src}'`));
|
|
552
|
+
process.exit(-1);
|
|
1492
553
|
}
|
|
1493
|
-
|
|
1494
|
-
|
|
554
|
+
const testConfigResource = testConfig[2];
|
|
555
|
+
const portsToUse = [];
|
|
556
|
+
if (testConfigResource.ports === 0) {
|
|
557
|
+
testResources = JSON.stringify({
|
|
558
|
+
scheduled: true,
|
|
559
|
+
name: src,
|
|
560
|
+
ports: portsToUse,
|
|
561
|
+
fs: reportDest,
|
|
562
|
+
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
563
|
+
});
|
|
1495
564
|
}
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
this.metafileOutputs(runtime);
|
|
565
|
+
else if (testConfigResource.ports > 0) {
|
|
566
|
+
const openPorts = Object.entries(this.ports).filter(([, status]) => status === "");
|
|
567
|
+
if (openPorts.length >= testConfigResource.ports) {
|
|
568
|
+
for (let i = 0; i < testConfigResource.ports; i++) {
|
|
569
|
+
portsToUse.push(openPorts[i][0]);
|
|
570
|
+
this.ports[openPorts[i][0]] = src;
|
|
571
|
+
}
|
|
572
|
+
testResources = JSON.stringify({
|
|
573
|
+
scheduled: true,
|
|
574
|
+
name: src,
|
|
575
|
+
ports: portsToUse,
|
|
576
|
+
fs: reportDest,
|
|
577
|
+
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
578
|
+
});
|
|
1511
579
|
}
|
|
1512
580
|
else {
|
|
1513
|
-
|
|
1514
|
-
|
|
581
|
+
console.log(ansi_colors_1.default.red(`golang: cannot run ${src} because there are no open ports ATM. This job will be enqueued and run again when a port is available`));
|
|
582
|
+
this.queue.push(src);
|
|
583
|
+
return;
|
|
1515
584
|
}
|
|
1516
|
-
};
|
|
1517
|
-
// Start checking for the file
|
|
1518
|
-
checkFileExists();
|
|
1519
|
-
}
|
|
1520
|
-
else {
|
|
1521
|
-
// For other runtimes, only set up watcher if the file exists
|
|
1522
|
-
if (fs_1.default.existsSync(metafile)) {
|
|
1523
|
-
watcher((0, fs_1.watch)(metafile, async (e, filename) => {
|
|
1524
|
-
console.log(ansi_colors_2.default.yellow(ansi_colors_2.default.inverse(`< ${e} ${filename} (${runtime})`)));
|
|
1525
|
-
this.metafileOutputs(runtime);
|
|
1526
|
-
}));
|
|
1527
|
-
}
|
|
1528
|
-
}
|
|
1529
|
-
});
|
|
1530
|
-
// Object.keys(this.configs.externalTests).forEach((et) => {
|
|
1531
|
-
// this.launchExternalTest(et, this.configs.externalTests[et]);
|
|
1532
|
-
// });
|
|
1533
|
-
}
|
|
1534
|
-
// async launchExternalTest(
|
|
1535
|
-
// externalTestName: string,
|
|
1536
|
-
// externalTest: {
|
|
1537
|
-
// watch: string[];
|
|
1538
|
-
// exec: string;
|
|
1539
|
-
// }
|
|
1540
|
-
// ) {
|
|
1541
|
-
// // fs.mkdirSync(`testeranto/externalTests/${externalTestName}`);
|
|
1542
|
-
// // exec(externalTest.exec, (error, stdout, stderr) => {
|
|
1543
|
-
// // if (error) {
|
|
1544
|
-
// // fs.writeFileSync(
|
|
1545
|
-
// // `testeranto/externalTests/${externalTestName}/exitcode.txt`,
|
|
1546
|
-
// // `${error.name}\n${error.message}\n${error.code}\n`
|
|
1547
|
-
// // );
|
|
1548
|
-
// // } else {
|
|
1549
|
-
// // fs.writeFileSync(
|
|
1550
|
-
// // `testeranto/externalTests/${externalTestName}/exitcode.txt`,
|
|
1551
|
-
// // `0`
|
|
1552
|
-
// // );
|
|
1553
|
-
// // }
|
|
1554
|
-
// // fs.writeFileSync(
|
|
1555
|
-
// // `testeranto/externalTests/${externalTestName}/stdout.txt`,
|
|
1556
|
-
// // stdout
|
|
1557
|
-
// // );
|
|
1558
|
-
// // fs.writeFileSync(
|
|
1559
|
-
// // `testeranto/externalTests/${externalTestName}/stderr.txt`,
|
|
1560
|
-
// // stderr
|
|
1561
|
-
// // );
|
|
1562
|
-
// // });
|
|
1563
|
-
// }
|
|
1564
|
-
async stop() {
|
|
1565
|
-
console.log(ansi_colors_2.default.inverse("Testeranto-Run is shutting down gracefully..."));
|
|
1566
|
-
this.mode = "once";
|
|
1567
|
-
this.nodeMetafileWatcher.close();
|
|
1568
|
-
this.webMetafileWatcher.close();
|
|
1569
|
-
this.importMetafileWatcher.close();
|
|
1570
|
-
if (this.pitonoMetafileWatcher) {
|
|
1571
|
-
this.pitonoMetafileWatcher.close();
|
|
1572
|
-
}
|
|
1573
|
-
// Close any remaining log streams
|
|
1574
|
-
Object.values(this.logStreams || {}).forEach((logs) => logs.closeAll());
|
|
1575
|
-
// Close WebSocket server
|
|
1576
|
-
this.wss.close(() => {
|
|
1577
|
-
console.log("WebSocket server closed");
|
|
1578
|
-
});
|
|
1579
|
-
// Close all client connections
|
|
1580
|
-
this.clients.forEach((client) => {
|
|
1581
|
-
client.terminate();
|
|
1582
|
-
});
|
|
1583
|
-
this.clients.clear();
|
|
1584
|
-
// Close HTTP server
|
|
1585
|
-
this.httpServer.close(() => {
|
|
1586
|
-
console.log("HTTP server closed");
|
|
1587
|
-
});
|
|
1588
|
-
this.checkForShutdown();
|
|
1589
|
-
}
|
|
1590
|
-
async metafileOutputs(platform) {
|
|
1591
|
-
let metafilePath;
|
|
1592
|
-
if (platform === "pitono") {
|
|
1593
|
-
metafilePath = `./testeranto/metafiles/python/core.json`;
|
|
1594
|
-
}
|
|
1595
|
-
else {
|
|
1596
|
-
metafilePath = `./testeranto/metafiles/${platform}/${this.name}.json`;
|
|
1597
|
-
}
|
|
1598
|
-
// Check if the file exists
|
|
1599
|
-
if (!fs_1.default.existsSync(metafilePath)) {
|
|
1600
|
-
if (platform === "pitono") {
|
|
1601
|
-
console.log(ansi_colors_2.default.yellow(ansi_colors_2.default.inverse(`Pitono metafile not found yet: ${metafilePath}`)));
|
|
1602
|
-
}
|
|
1603
|
-
return;
|
|
1604
|
-
}
|
|
1605
|
-
let metafile;
|
|
1606
|
-
try {
|
|
1607
|
-
const fileContent = fs_1.default.readFileSync(metafilePath).toString();
|
|
1608
|
-
const parsedData = JSON.parse(fileContent);
|
|
1609
|
-
// Handle different metafile structures
|
|
1610
|
-
if (platform === "pitono") {
|
|
1611
|
-
// Pitono metafile might be the entire content or have a different structure
|
|
1612
|
-
metafile = parsedData.metafile || parsedData;
|
|
1613
|
-
}
|
|
1614
|
-
else {
|
|
1615
|
-
metafile = parsedData.metafile;
|
|
1616
|
-
}
|
|
1617
|
-
if (!metafile) {
|
|
1618
|
-
console.log(ansi_colors_2.default.yellow(ansi_colors_2.default.inverse(`No metafile found in ${metafilePath}`)));
|
|
1619
|
-
return;
|
|
1620
|
-
}
|
|
1621
|
-
}
|
|
1622
|
-
catch (error) {
|
|
1623
|
-
console.error(`Error reading metafile at ${metafilePath}:`, error);
|
|
1624
|
-
return;
|
|
1625
|
-
}
|
|
1626
|
-
const outputs = metafile.outputs;
|
|
1627
|
-
Object.keys(outputs).forEach(async (k) => {
|
|
1628
|
-
const pattern = `testeranto/bundles/${platform}/${this.name}/${this.configs.src}`;
|
|
1629
|
-
if (!k.startsWith(pattern)) {
|
|
1630
|
-
return false;
|
|
1631
|
-
}
|
|
1632
|
-
const addableFiles = Object.keys(outputs[k].inputs).filter((i) => {
|
|
1633
|
-
if (!fs_1.default.existsSync(i))
|
|
1634
|
-
return false;
|
|
1635
|
-
if (i.startsWith("node_modules"))
|
|
1636
|
-
return false;
|
|
1637
|
-
if (i.startsWith("./node_modules"))
|
|
1638
|
-
return false;
|
|
1639
|
-
return true;
|
|
1640
|
-
});
|
|
1641
|
-
const f = `${k.split(".").slice(0, -1).join(".")}/`;
|
|
1642
|
-
if (!fs_1.default.existsSync(f)) {
|
|
1643
|
-
fs_1.default.mkdirSync(f);
|
|
1644
|
-
}
|
|
1645
|
-
const entrypoint = outputs[k].entryPoint;
|
|
1646
|
-
if (entrypoint) {
|
|
1647
|
-
const changeDigest = await filesHash(addableFiles);
|
|
1648
|
-
if (changeDigest === changes[entrypoint]) {
|
|
1649
|
-
// skip
|
|
1650
585
|
}
|
|
1651
586
|
else {
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
platform,
|
|
1655
|
-
addableFiles,
|
|
1656
|
-
entrypoint: entrypoint,
|
|
1657
|
-
});
|
|
1658
|
-
this.eslintCheck(entrypoint, platform, addableFiles);
|
|
1659
|
-
this.makePrompt(entrypoint, addableFiles, platform);
|
|
587
|
+
console.error("negative port makes no sense", src);
|
|
588
|
+
process.exit(-1);
|
|
1660
589
|
}
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
filePath = `testeranto/${filePath}`;
|
|
1686
|
-
}
|
|
1687
|
-
else {
|
|
1688
|
-
// For frontend assets, try multiple possible locations
|
|
1689
|
-
// First, try the dist directory
|
|
1690
|
-
const possiblePaths = [
|
|
1691
|
-
`dist/${filePath}`,
|
|
1692
|
-
`testeranto/dist/${filePath}`,
|
|
1693
|
-
`../dist/${filePath}`,
|
|
1694
|
-
`./${filePath}`,
|
|
1695
|
-
];
|
|
1696
|
-
// Find the first existing file
|
|
1697
|
-
let foundPath = null;
|
|
1698
|
-
for (const possiblePath of possiblePaths) {
|
|
1699
|
-
if (fs_1.default.existsSync(possiblePath)) {
|
|
1700
|
-
foundPath = possiblePath;
|
|
1701
|
-
break;
|
|
1702
|
-
}
|
|
1703
|
-
}
|
|
1704
|
-
if (foundPath) {
|
|
1705
|
-
filePath = foundPath;
|
|
1706
|
-
}
|
|
1707
|
-
else {
|
|
1708
|
-
// If no file found, serve index.html for SPA routing
|
|
1709
|
-
const indexPath = this.findIndexHtml();
|
|
1710
|
-
if (indexPath) {
|
|
1711
|
-
fs_1.default.readFile(indexPath, (err, data) => {
|
|
1712
|
-
if (err) {
|
|
1713
|
-
res.writeHead(404, { "Content-Type": "text/plain" });
|
|
1714
|
-
res.end("404 Not Found");
|
|
590
|
+
// Compile the Go test first
|
|
591
|
+
const buildDir = path.dirname(dest);
|
|
592
|
+
const binaryName = path.basename(dest, '.go');
|
|
593
|
+
const binaryPath = path.join(buildDir, binaryName);
|
|
594
|
+
const logs = (0, utils_js_1.createLogStreams)(reportDest, "golang");
|
|
595
|
+
// First, compile the Go program
|
|
596
|
+
const compileProcess = (0, node_child_process_1.spawn)("go", ["build", "-o", binaryPath, dest]);
|
|
597
|
+
return new Promise((resolve, reject) => {
|
|
598
|
+
var _a, _b;
|
|
599
|
+
(_a = compileProcess.stdout) === null || _a === void 0 ? void 0 : _a.on("data", (data) => {
|
|
600
|
+
var _a;
|
|
601
|
+
(_a = logs.stdout) === null || _a === void 0 ? void 0 : _a.write(data);
|
|
602
|
+
});
|
|
603
|
+
(_b = compileProcess.stderr) === null || _b === void 0 ? void 0 : _b.on("data", (data) => {
|
|
604
|
+
var _a;
|
|
605
|
+
(_a = logs.stderr) === null || _a === void 0 ? void 0 : _a.write(data);
|
|
606
|
+
});
|
|
607
|
+
compileProcess.on("close", (compileCode) => {
|
|
608
|
+
var _a, _b;
|
|
609
|
+
if (compileCode !== 0) {
|
|
610
|
+
console.log(ansi_colors_1.default.red(`golang ! ${src} failed to compile. Check ${reportDest}/stderr.log for more info`));
|
|
611
|
+
this.bddTestIsNowDone(src, compileCode || -1);
|
|
612
|
+
(0, utils_js_1.statusMessagePretty)(compileCode || -1, src, "golang");
|
|
613
|
+
reject(new Error(`Compilation failed with code ${compileCode}`));
|
|
1715
614
|
return;
|
|
1716
615
|
}
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
616
|
+
// Now run the compiled binary
|
|
617
|
+
const child = (0, node_child_process_1.spawn)(binaryPath, [testResources], {
|
|
618
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
619
|
+
});
|
|
620
|
+
(_a = child.stdout) === null || _a === void 0 ? void 0 : _a.on("data", (data) => {
|
|
621
|
+
var _a;
|
|
622
|
+
(_a = logs.stdout) === null || _a === void 0 ? void 0 : _a.write(data);
|
|
623
|
+
});
|
|
624
|
+
(_b = child.stderr) === null || _b === void 0 ? void 0 : _b.on("data", (data) => {
|
|
625
|
+
var _a;
|
|
626
|
+
(_a = logs.stderr) === null || _a === void 0 ? void 0 : _a.write(data);
|
|
627
|
+
});
|
|
628
|
+
child.on("close", (code) => {
|
|
629
|
+
const exitCode = code === null ? -1 : code;
|
|
630
|
+
if (exitCode < 0) {
|
|
631
|
+
logs.writeExitCode(exitCode, new Error("Process crashed or was terminated"));
|
|
632
|
+
}
|
|
633
|
+
else {
|
|
634
|
+
logs.writeExitCode(exitCode);
|
|
635
|
+
}
|
|
636
|
+
logs.closeAll();
|
|
637
|
+
if (exitCode === 0) {
|
|
638
|
+
this.bddTestIsNowDone(src, 0);
|
|
639
|
+
(0, utils_js_1.statusMessagePretty)(0, src, "golang");
|
|
640
|
+
resolve();
|
|
641
|
+
}
|
|
642
|
+
else {
|
|
643
|
+
console.log(ansi_colors_1.default.red(`golang ! ${src} failed to execute. Check ${reportDest}/stderr.log for more info`));
|
|
644
|
+
this.bddTestIsNowDone(src, exitCode);
|
|
645
|
+
(0, utils_js_1.statusMessagePretty)(exitCode, src, "golang");
|
|
646
|
+
reject(new Error(`Process exited with code ${exitCode}`));
|
|
1741
647
|
}
|
|
1742
|
-
res.writeHead(200, { "Content-Type": "text/html" });
|
|
1743
|
-
res.end(data);
|
|
1744
648
|
});
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
fs_1.default.readFile(filePath, (err, data) => {
|
|
1767
|
-
if (err) {
|
|
1768
|
-
res.writeHead(500, { "Content-Type": "text/plain" });
|
|
1769
|
-
res.end("500 Internal Server Error");
|
|
1770
|
-
return;
|
|
1771
|
-
}
|
|
1772
|
-
// Get MIME type
|
|
1773
|
-
const mimeType = mime_types_1.default.lookup(filePath) || "application/octet-stream";
|
|
1774
|
-
res.writeHead(200, { "Content-Type": mimeType });
|
|
1775
|
-
res.end(data);
|
|
1776
|
-
});
|
|
1777
|
-
});
|
|
1778
|
-
}
|
|
1779
|
-
findIndexHtml() {
|
|
1780
|
-
const possiblePaths = [
|
|
1781
|
-
"dist/index.html",
|
|
1782
|
-
"testeranto/dist/index.html",
|
|
1783
|
-
"../dist/index.html",
|
|
1784
|
-
"./index.html",
|
|
1785
|
-
];
|
|
1786
|
-
for (const path of possiblePaths) {
|
|
1787
|
-
if (fs_1.default.existsSync(path)) {
|
|
1788
|
-
return path;
|
|
1789
|
-
}
|
|
1790
|
-
}
|
|
1791
|
-
return null;
|
|
1792
|
-
}
|
|
1793
|
-
broadcast(message) {
|
|
1794
|
-
const data = typeof message === "string" ? message : JSON.stringify(message);
|
|
1795
|
-
this.clients.forEach((client) => {
|
|
1796
|
-
if (client.readyState === 1) {
|
|
1797
|
-
// WebSocket.OPEN
|
|
1798
|
-
client.send(data);
|
|
1799
|
-
}
|
|
1800
|
-
});
|
|
1801
|
-
}
|
|
1802
|
-
checkQueue() {
|
|
1803
|
-
const x = this.queue.pop();
|
|
1804
|
-
if (!x) {
|
|
1805
|
-
ansi_colors_2.default.inverse(`The following queue is empty`);
|
|
1806
|
-
return;
|
|
1807
|
-
}
|
|
1808
|
-
const test = this.configs.tests.find((t) => t[0] === x);
|
|
1809
|
-
if (!test)
|
|
1810
|
-
throw `test is undefined ${x}`;
|
|
1811
|
-
// const [src, runtime, ...xx]: [string, IRunTime, ...any] = test;
|
|
1812
|
-
this.launchers[test[0]]();
|
|
649
|
+
child.on("error", (e) => {
|
|
650
|
+
console.log(ansi_colors_1.default.red(ansi_colors_1.default.inverse(`golang: ${src} errored with: ${e.name}. Check error logs for more info`)));
|
|
651
|
+
this.bddTestIsNowDone(src, -1);
|
|
652
|
+
(0, utils_js_1.statusMessagePretty)(-1, src, "golang");
|
|
653
|
+
reject(e);
|
|
654
|
+
});
|
|
655
|
+
});
|
|
656
|
+
compileProcess.on("error", (e) => {
|
|
657
|
+
console.log(ansi_colors_1.default.red(ansi_colors_1.default.inverse(`golang: ${src} compilation errored with: ${e.name}. Check error logs for more info`)));
|
|
658
|
+
this.bddTestIsNowDone(src, -1);
|
|
659
|
+
(0, utils_js_1.statusMessagePretty)(-1, src, "golang");
|
|
660
|
+
reject(e);
|
|
661
|
+
});
|
|
662
|
+
}).finally(() => {
|
|
663
|
+
portsToUse.forEach(port => {
|
|
664
|
+
this.ports[port] = "";
|
|
665
|
+
});
|
|
666
|
+
});
|
|
667
|
+
})();
|
|
668
|
+
this.addPromiseProcess(processId, golangPromise, command, "bdd-test", src, "golang");
|
|
669
|
+
};
|
|
1813
670
|
}
|
|
1814
671
|
}
|
|
1815
672
|
exports.PM_Main = PM_Main;
|