testeranto 0.200.0 → 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/bundle.js +3 -2
- 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 +4106 -0
- 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/prebuild/ReportServer.mjs +0 -227
- package/dist/prebuild/mothership/index.mjs +0 -22
- 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
|
@@ -0,0 +1,1170 @@
|
|
|
1
|
+
import { createRequire } from 'module';const require = createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/lib/pmProxy.ts
|
|
4
|
+
var baseProxy = function(pm, mappings) {
|
|
5
|
+
return new Proxy(pm, {
|
|
6
|
+
get: (target, prop, receiver) => {
|
|
7
|
+
for (const mapping of mappings) {
|
|
8
|
+
const method = mapping[0];
|
|
9
|
+
const arger = mapping[1];
|
|
10
|
+
if (prop === method) {
|
|
11
|
+
return (...x) => {
|
|
12
|
+
const modifiedArgs = arger(...x);
|
|
13
|
+
return target[prop](...modifiedArgs);
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return (...x) => {
|
|
18
|
+
return target[prop](...x);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var butThenProxy = (pm, filepath, addArtifact) => {
|
|
24
|
+
return baseProxy(pm, [
|
|
25
|
+
[
|
|
26
|
+
"screencast",
|
|
27
|
+
(opts, p) => {
|
|
28
|
+
const path2 = `${filepath}/butThen/${opts.path}`;
|
|
29
|
+
addArtifact(path2);
|
|
30
|
+
return [
|
|
31
|
+
{
|
|
32
|
+
...opts,
|
|
33
|
+
path: path2
|
|
34
|
+
},
|
|
35
|
+
p
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
[
|
|
40
|
+
"createWriteStream",
|
|
41
|
+
(fp) => {
|
|
42
|
+
const path2 = `${filepath}/butThen/${fp}`;
|
|
43
|
+
addArtifact(path2);
|
|
44
|
+
return [path2];
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
[
|
|
48
|
+
"writeFileSync",
|
|
49
|
+
(fp, contents, testName) => {
|
|
50
|
+
const path2 = `${filepath}/butThen/${fp}`;
|
|
51
|
+
addArtifact(path2);
|
|
52
|
+
return [path2, contents, testName];
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
[
|
|
56
|
+
"customScreenShot",
|
|
57
|
+
(opts, p) => {
|
|
58
|
+
const path2 = `${filepath}/butThen/${opts.path}`;
|
|
59
|
+
addArtifact(path2);
|
|
60
|
+
return [
|
|
61
|
+
{
|
|
62
|
+
...opts,
|
|
63
|
+
path: path2
|
|
64
|
+
},
|
|
65
|
+
p
|
|
66
|
+
];
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
]);
|
|
70
|
+
};
|
|
71
|
+
var andWhenProxy = (pm, filepath, addArtifact) => {
|
|
72
|
+
return baseProxy(pm, [
|
|
73
|
+
[
|
|
74
|
+
"screencast",
|
|
75
|
+
(opts, p) => {
|
|
76
|
+
const path2 = `${filepath}/andWhen/${opts.path}`;
|
|
77
|
+
addArtifact(path2);
|
|
78
|
+
return [
|
|
79
|
+
{
|
|
80
|
+
...opts,
|
|
81
|
+
path: path2
|
|
82
|
+
},
|
|
83
|
+
p
|
|
84
|
+
];
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
[
|
|
88
|
+
"createWriteStream",
|
|
89
|
+
(fp) => {
|
|
90
|
+
const path2 = `${filepath}/andWhen/${fp}`;
|
|
91
|
+
addArtifact(path2);
|
|
92
|
+
return [path2];
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
[
|
|
96
|
+
"writeFileSync",
|
|
97
|
+
(fp, contents, testName) => {
|
|
98
|
+
const path2 = `${filepath}/andWhen/${fp}`;
|
|
99
|
+
addArtifact(path2);
|
|
100
|
+
return [path2, contents, testName];
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
[
|
|
104
|
+
"customScreenShot",
|
|
105
|
+
(opts, p) => {
|
|
106
|
+
const path2 = `${filepath}/andWhen/${opts.path}`;
|
|
107
|
+
addArtifact(path2);
|
|
108
|
+
return [
|
|
109
|
+
{
|
|
110
|
+
...opts,
|
|
111
|
+
path: path2
|
|
112
|
+
},
|
|
113
|
+
p
|
|
114
|
+
];
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
]);
|
|
118
|
+
};
|
|
119
|
+
var afterEachProxy = (pm, suite, given, addArtifact) => {
|
|
120
|
+
return baseProxy(pm, [
|
|
121
|
+
[
|
|
122
|
+
"screencast",
|
|
123
|
+
(opts, p) => {
|
|
124
|
+
const path2 = `suite-${suite}/given-${given}/afterEach/${opts.path}`;
|
|
125
|
+
addArtifact(path2);
|
|
126
|
+
return [
|
|
127
|
+
{
|
|
128
|
+
...opts,
|
|
129
|
+
path: path2
|
|
130
|
+
},
|
|
131
|
+
p
|
|
132
|
+
];
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
[
|
|
136
|
+
"createWriteStream",
|
|
137
|
+
(fp) => {
|
|
138
|
+
const path2 = `suite-${suite}/afterEach/${fp}`;
|
|
139
|
+
addArtifact(path2);
|
|
140
|
+
return [path2];
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
[
|
|
144
|
+
"writeFileSync",
|
|
145
|
+
(fp, contents, testName) => {
|
|
146
|
+
const path2 = `suite-${suite}/given-${given}/afterEach/${fp}`;
|
|
147
|
+
addArtifact(path2);
|
|
148
|
+
return [path2, contents, testName];
|
|
149
|
+
}
|
|
150
|
+
],
|
|
151
|
+
[
|
|
152
|
+
"customScreenShot",
|
|
153
|
+
(opts, p) => {
|
|
154
|
+
const path2 = `suite-${suite}/given-${given}/afterEach/${opts.path}`;
|
|
155
|
+
addArtifact(path2);
|
|
156
|
+
return [
|
|
157
|
+
{
|
|
158
|
+
...opts,
|
|
159
|
+
path: path2
|
|
160
|
+
},
|
|
161
|
+
p
|
|
162
|
+
];
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
]);
|
|
166
|
+
};
|
|
167
|
+
var beforeEachProxy = (pm, suite, addArtifact) => {
|
|
168
|
+
return baseProxy(pm, [
|
|
169
|
+
[
|
|
170
|
+
"screencast",
|
|
171
|
+
(opts, p) => {
|
|
172
|
+
const path2 = `suite-${suite}/beforeEach/${opts.path}`;
|
|
173
|
+
addArtifact(path2);
|
|
174
|
+
return [
|
|
175
|
+
{
|
|
176
|
+
...opts,
|
|
177
|
+
path: path2
|
|
178
|
+
},
|
|
179
|
+
p
|
|
180
|
+
];
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
[
|
|
184
|
+
"writeFileSync",
|
|
185
|
+
(fp, contents, testName) => {
|
|
186
|
+
const path2 = `suite-${suite}/beforeEach/${fp}`;
|
|
187
|
+
addArtifact(path2);
|
|
188
|
+
return [path2, contents, testName];
|
|
189
|
+
}
|
|
190
|
+
],
|
|
191
|
+
[
|
|
192
|
+
"customScreenShot",
|
|
193
|
+
(opts, p) => {
|
|
194
|
+
const path2 = `suite-${suite}/beforeEach/${opts.path}`;
|
|
195
|
+
addArtifact(path2);
|
|
196
|
+
return [
|
|
197
|
+
{
|
|
198
|
+
...opts,
|
|
199
|
+
path: path2
|
|
200
|
+
},
|
|
201
|
+
p
|
|
202
|
+
];
|
|
203
|
+
}
|
|
204
|
+
],
|
|
205
|
+
[
|
|
206
|
+
"createWriteStream",
|
|
207
|
+
(fp) => {
|
|
208
|
+
const path2 = `suite-${suite}/beforeEach/${fp}`;
|
|
209
|
+
addArtifact(path2);
|
|
210
|
+
return [path2];
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
]);
|
|
214
|
+
};
|
|
215
|
+
var beforeAllProxy = (pm, suite, addArtifact) => {
|
|
216
|
+
return baseProxy(pm, [
|
|
217
|
+
[
|
|
218
|
+
"writeFileSync",
|
|
219
|
+
(fp, contents, testName) => {
|
|
220
|
+
const path2 = `suite-${suite}/beforeAll/${fp}`;
|
|
221
|
+
addArtifact(path2);
|
|
222
|
+
return [path2, contents, testName];
|
|
223
|
+
}
|
|
224
|
+
],
|
|
225
|
+
[
|
|
226
|
+
"customScreenShot",
|
|
227
|
+
(opts, p) => {
|
|
228
|
+
const path2 = `suite-${suite}/beforeAll/${opts.path}`;
|
|
229
|
+
addArtifact(path2);
|
|
230
|
+
return [
|
|
231
|
+
{
|
|
232
|
+
...opts,
|
|
233
|
+
path: path2
|
|
234
|
+
},
|
|
235
|
+
p
|
|
236
|
+
];
|
|
237
|
+
}
|
|
238
|
+
],
|
|
239
|
+
[
|
|
240
|
+
"createWriteStream",
|
|
241
|
+
(fp) => {
|
|
242
|
+
const path2 = `suite-${suite}/beforeAll/${fp}`;
|
|
243
|
+
addArtifact(path2);
|
|
244
|
+
return [path2];
|
|
245
|
+
}
|
|
246
|
+
]
|
|
247
|
+
]);
|
|
248
|
+
};
|
|
249
|
+
var afterAllProxy = (pm, suite, addArtifact) => {
|
|
250
|
+
return baseProxy(pm, [
|
|
251
|
+
[
|
|
252
|
+
"createWriteStream",
|
|
253
|
+
(fp) => {
|
|
254
|
+
const path2 = `suite-${suite}/afterAll/${fp}`;
|
|
255
|
+
addArtifact(path2);
|
|
256
|
+
return [path2];
|
|
257
|
+
}
|
|
258
|
+
],
|
|
259
|
+
[
|
|
260
|
+
"writeFileSync",
|
|
261
|
+
(fp, contents, testName) => {
|
|
262
|
+
const path2 = `suite-${suite}/afterAll/${fp}`;
|
|
263
|
+
addArtifact(path2);
|
|
264
|
+
return [path2, contents, testName];
|
|
265
|
+
}
|
|
266
|
+
],
|
|
267
|
+
[
|
|
268
|
+
"customScreenShot",
|
|
269
|
+
(opts, p) => {
|
|
270
|
+
const path2 = `suite-${suite}/afterAll/${opts.path}`;
|
|
271
|
+
addArtifact(path2);
|
|
272
|
+
return [
|
|
273
|
+
{
|
|
274
|
+
...opts,
|
|
275
|
+
path: path2
|
|
276
|
+
},
|
|
277
|
+
p
|
|
278
|
+
];
|
|
279
|
+
}
|
|
280
|
+
]
|
|
281
|
+
]);
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
// src/lib/BaseSuite.ts
|
|
285
|
+
var BaseSuite = class {
|
|
286
|
+
constructor(name, index, givens = {}) {
|
|
287
|
+
this.artifacts = [];
|
|
288
|
+
const suiteName = name || "testSuite";
|
|
289
|
+
if (!suiteName) {
|
|
290
|
+
throw new Error("BaseSuite requires a non-empty name");
|
|
291
|
+
}
|
|
292
|
+
this.name = suiteName;
|
|
293
|
+
this.index = index;
|
|
294
|
+
this.givens = givens;
|
|
295
|
+
this.fails = 0;
|
|
296
|
+
}
|
|
297
|
+
addArtifact(path2) {
|
|
298
|
+
if (typeof path2 !== "string") {
|
|
299
|
+
throw new Error(`[ARTIFACT ERROR] Expected string, got ${typeof path2}: ${JSON.stringify(path2)}`);
|
|
300
|
+
}
|
|
301
|
+
const normalizedPath = path2.replace(/\\/g, "/");
|
|
302
|
+
this.artifacts.push(normalizedPath);
|
|
303
|
+
}
|
|
304
|
+
features() {
|
|
305
|
+
try {
|
|
306
|
+
const features = Object.keys(this.givens).map((k) => this.givens[k].features).flat().filter((value, index, array) => {
|
|
307
|
+
return array.indexOf(value) === index;
|
|
308
|
+
});
|
|
309
|
+
const stringFeatures = features.map((feature) => {
|
|
310
|
+
if (typeof feature === "string") {
|
|
311
|
+
return feature;
|
|
312
|
+
} else if (feature && typeof feature === "object") {
|
|
313
|
+
return feature.name || JSON.stringify(feature);
|
|
314
|
+
} else {
|
|
315
|
+
return String(feature);
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
return stringFeatures || [];
|
|
319
|
+
} catch (e) {
|
|
320
|
+
console.error("[ERROR] Failed to extract features:", JSON.stringify(e));
|
|
321
|
+
return [];
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
toObj() {
|
|
325
|
+
const givens = Object.keys(this.givens).map((k) => {
|
|
326
|
+
const givenObj = this.givens[k].toObj();
|
|
327
|
+
if (givenObj.features) {
|
|
328
|
+
givenObj.features = givenObj.features.map((feature) => {
|
|
329
|
+
if (typeof feature === "string") {
|
|
330
|
+
return feature;
|
|
331
|
+
} else if (feature && typeof feature === "object") {
|
|
332
|
+
return feature.name || JSON.stringify(feature);
|
|
333
|
+
} else {
|
|
334
|
+
return String(feature);
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
return givenObj;
|
|
339
|
+
});
|
|
340
|
+
return {
|
|
341
|
+
name: this.name,
|
|
342
|
+
givens,
|
|
343
|
+
fails: this.fails,
|
|
344
|
+
failed: this.failed,
|
|
345
|
+
features: this.features(),
|
|
346
|
+
artifacts: this.artifacts ? this.artifacts.filter((art) => typeof art === "string") : []
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
setup(s, artifactory, tr, pm) {
|
|
350
|
+
return new Promise((res) => res(s));
|
|
351
|
+
}
|
|
352
|
+
assertThat(t) {
|
|
353
|
+
return !!t;
|
|
354
|
+
}
|
|
355
|
+
afterAll(store, artifactory, pm) {
|
|
356
|
+
return store;
|
|
357
|
+
}
|
|
358
|
+
async run(input, testResourceConfiguration, artifactory, tLog, pm) {
|
|
359
|
+
this.testResourceConfiguration = testResourceConfiguration;
|
|
360
|
+
const suiteArtifactory = (fPath, value) => artifactory(`suite-${this.index}-${this.name}/${fPath}`, value);
|
|
361
|
+
const sNdx = this.index;
|
|
362
|
+
const addArtifact = this.addArtifact.bind(this);
|
|
363
|
+
const proxiedPm = beforeAllProxy(pm, sNdx.toString(), addArtifact);
|
|
364
|
+
const subject = await this.setup(
|
|
365
|
+
input,
|
|
366
|
+
suiteArtifactory,
|
|
367
|
+
testResourceConfiguration,
|
|
368
|
+
proxiedPm
|
|
369
|
+
);
|
|
370
|
+
for (const [gKey, g] of Object.entries(this.givens)) {
|
|
371
|
+
const giver = this.givens[gKey];
|
|
372
|
+
try {
|
|
373
|
+
this.store = await giver.give(
|
|
374
|
+
subject,
|
|
375
|
+
gKey,
|
|
376
|
+
testResourceConfiguration,
|
|
377
|
+
this.assertThat,
|
|
378
|
+
suiteArtifactory,
|
|
379
|
+
tLog,
|
|
380
|
+
pm,
|
|
381
|
+
sNdx
|
|
382
|
+
);
|
|
383
|
+
this.fails += giver.fails || 0;
|
|
384
|
+
} catch (e) {
|
|
385
|
+
this.failed = true;
|
|
386
|
+
this.fails += 1;
|
|
387
|
+
if (giver.fails) {
|
|
388
|
+
this.fails += giver.fails;
|
|
389
|
+
}
|
|
390
|
+
console.error(`Error in given ${gKey}:`, e);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
if (this.fails > 0) {
|
|
394
|
+
this.failed = true;
|
|
395
|
+
}
|
|
396
|
+
try {
|
|
397
|
+
const addArtifact2 = this.addArtifact.bind(this);
|
|
398
|
+
const afterAllPm = afterAllProxy(pm, sNdx.toString(), addArtifact2);
|
|
399
|
+
this.afterAll(this.store, artifactory, afterAllPm);
|
|
400
|
+
} catch (e) {
|
|
401
|
+
console.error(JSON.stringify(e));
|
|
402
|
+
}
|
|
403
|
+
return this;
|
|
404
|
+
}
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
// src/lib/index.ts
|
|
408
|
+
var BaseAdapter = () => ({
|
|
409
|
+
beforeAll: async (input, testResource, pm) => {
|
|
410
|
+
return input;
|
|
411
|
+
},
|
|
412
|
+
beforeEach: async function(subject, initializer, testResource, initialValues, pm) {
|
|
413
|
+
return subject;
|
|
414
|
+
},
|
|
415
|
+
afterEach: async (store, key, pm) => Promise.resolve(store),
|
|
416
|
+
afterAll: (store, pm) => void 0,
|
|
417
|
+
butThen: async (store, thenCb, testResource, pm) => {
|
|
418
|
+
return thenCb(store, pm);
|
|
419
|
+
},
|
|
420
|
+
andWhen: async (store, whenCB, testResource, pm) => {
|
|
421
|
+
return whenCB(store, pm);
|
|
422
|
+
},
|
|
423
|
+
assertThis: (x) => x
|
|
424
|
+
});
|
|
425
|
+
var DefaultAdapter = (p) => {
|
|
426
|
+
const base = BaseAdapter();
|
|
427
|
+
return {
|
|
428
|
+
...base,
|
|
429
|
+
...p
|
|
430
|
+
};
|
|
431
|
+
};
|
|
432
|
+
var defaultTestResourceRequirement = {
|
|
433
|
+
ports: 0
|
|
434
|
+
};
|
|
435
|
+
|
|
436
|
+
// src/PM/node.ts
|
|
437
|
+
import net from "net";
|
|
438
|
+
import fs from "fs";
|
|
439
|
+
import path from "path";
|
|
440
|
+
|
|
441
|
+
// src/PM/index.ts
|
|
442
|
+
var PM = class {
|
|
443
|
+
// abstract launchSideCar(
|
|
444
|
+
// n: number
|
|
445
|
+
// ): Promise<[number, ITTestResourceConfiguration]>;
|
|
446
|
+
// abstract stopSideCar(n: number): Promise<any>;
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
// src/PM/node.ts
|
|
450
|
+
var fPaths = [];
|
|
451
|
+
var PM_Node = class extends PM {
|
|
452
|
+
constructor(t, ipcFile) {
|
|
453
|
+
super();
|
|
454
|
+
this.testResourceConfiguration = t;
|
|
455
|
+
this.client = net.createConnection(ipcFile, () => {
|
|
456
|
+
return;
|
|
457
|
+
});
|
|
458
|
+
}
|
|
459
|
+
start() {
|
|
460
|
+
throw new Error("DEPRECATED");
|
|
461
|
+
}
|
|
462
|
+
stop() {
|
|
463
|
+
throw new Error("stop not implemented.");
|
|
464
|
+
}
|
|
465
|
+
send(command, ...argz) {
|
|
466
|
+
const key = Math.random().toString();
|
|
467
|
+
if (!this.client) {
|
|
468
|
+
console.error(
|
|
469
|
+
`Tried to send "${command} (${argz})" but the test has not been started and the IPC client is not established. Exiting as failure!`
|
|
470
|
+
);
|
|
471
|
+
process.exit(-1);
|
|
472
|
+
}
|
|
473
|
+
return new Promise((res) => {
|
|
474
|
+
const myListener = (event) => {
|
|
475
|
+
const x = JSON.parse(event);
|
|
476
|
+
if (x.key === key) {
|
|
477
|
+
process.removeListener("message", myListener);
|
|
478
|
+
res(x.payload);
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
process.addListener("message", myListener);
|
|
482
|
+
this.client.write(JSON.stringify([command, ...argz, key]));
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
async pages() {
|
|
486
|
+
return this.send("pages", ...arguments);
|
|
487
|
+
}
|
|
488
|
+
waitForSelector(p, s) {
|
|
489
|
+
return this.send("waitForSelector", ...arguments);
|
|
490
|
+
}
|
|
491
|
+
closePage(p) {
|
|
492
|
+
return this.send("closePage", ...arguments);
|
|
493
|
+
}
|
|
494
|
+
goto(page, url) {
|
|
495
|
+
return this.send("goto", ...arguments);
|
|
496
|
+
}
|
|
497
|
+
async newPage() {
|
|
498
|
+
return this.send("newPage");
|
|
499
|
+
}
|
|
500
|
+
$(selector, page) {
|
|
501
|
+
return this.send("$", ...arguments);
|
|
502
|
+
}
|
|
503
|
+
isDisabled(selector) {
|
|
504
|
+
return this.send("isDisabled", ...arguments);
|
|
505
|
+
}
|
|
506
|
+
getAttribute(selector, attribute, p) {
|
|
507
|
+
return this.send("getAttribute", ...arguments);
|
|
508
|
+
}
|
|
509
|
+
getInnerHtml(selector, p) {
|
|
510
|
+
return this.send("getInnerHtml", ...arguments);
|
|
511
|
+
}
|
|
512
|
+
// setValue(selector: string) {
|
|
513
|
+
// return this.send("getValue", ...arguments);
|
|
514
|
+
// }
|
|
515
|
+
focusOn(selector) {
|
|
516
|
+
return this.send("focusOn", ...arguments);
|
|
517
|
+
}
|
|
518
|
+
typeInto(selector) {
|
|
519
|
+
return this.send("typeInto", ...arguments);
|
|
520
|
+
}
|
|
521
|
+
page() {
|
|
522
|
+
return this.send("page");
|
|
523
|
+
}
|
|
524
|
+
click(selector) {
|
|
525
|
+
return this.send("click", ...arguments);
|
|
526
|
+
}
|
|
527
|
+
screencast(opts, page) {
|
|
528
|
+
return this.send(
|
|
529
|
+
"screencast",
|
|
530
|
+
{
|
|
531
|
+
...opts,
|
|
532
|
+
path: this.testResourceConfiguration.fs + "/" + opts.path
|
|
533
|
+
},
|
|
534
|
+
page,
|
|
535
|
+
this.testResourceConfiguration.name
|
|
536
|
+
);
|
|
537
|
+
}
|
|
538
|
+
screencastStop(p) {
|
|
539
|
+
return this.send("screencastStop", ...arguments);
|
|
540
|
+
}
|
|
541
|
+
customScreenShot(x, y) {
|
|
542
|
+
const opts = x[0];
|
|
543
|
+
const page = x[1];
|
|
544
|
+
return this.send(
|
|
545
|
+
"customScreenShot",
|
|
546
|
+
{
|
|
547
|
+
...opts,
|
|
548
|
+
path: this.testResourceConfiguration.fs + "/" + opts.path
|
|
549
|
+
},
|
|
550
|
+
this.testResourceConfiguration.name,
|
|
551
|
+
page
|
|
552
|
+
);
|
|
553
|
+
}
|
|
554
|
+
async existsSync(destFolder) {
|
|
555
|
+
return await this.send(
|
|
556
|
+
"existsSync",
|
|
557
|
+
this.testResourceConfiguration.fs + "/" + destFolder
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
mkdirSync() {
|
|
561
|
+
return this.send("mkdirSync", this.testResourceConfiguration.fs + "/");
|
|
562
|
+
}
|
|
563
|
+
async write(uid, contents) {
|
|
564
|
+
return await this.send("write", ...arguments);
|
|
565
|
+
}
|
|
566
|
+
async writeFileSync(x) {
|
|
567
|
+
const z = arguments["0"];
|
|
568
|
+
const filepath = arguments[0];
|
|
569
|
+
const contents = arguments[1];
|
|
570
|
+
return await this.send(
|
|
571
|
+
"writeFileSync",
|
|
572
|
+
this.testResourceConfiguration.fs + "/" + filepath,
|
|
573
|
+
contents,
|
|
574
|
+
this.testResourceConfiguration.name
|
|
575
|
+
);
|
|
576
|
+
}
|
|
577
|
+
async createWriteStream(filepath) {
|
|
578
|
+
return await this.send(
|
|
579
|
+
"createWriteStream",
|
|
580
|
+
this.testResourceConfiguration.fs + "/" + filepath,
|
|
581
|
+
this.testResourceConfiguration.name
|
|
582
|
+
);
|
|
583
|
+
}
|
|
584
|
+
async end(uid) {
|
|
585
|
+
return await this.send("end", ...arguments);
|
|
586
|
+
}
|
|
587
|
+
async customclose() {
|
|
588
|
+
return await this.send(
|
|
589
|
+
"customclose",
|
|
590
|
+
this.testResourceConfiguration.fs,
|
|
591
|
+
this.testResourceConfiguration.name
|
|
592
|
+
);
|
|
593
|
+
}
|
|
594
|
+
testArtiFactoryfileWriter(tLog, callback) {
|
|
595
|
+
return (fPath, value) => {
|
|
596
|
+
callback(
|
|
597
|
+
new Promise((res, rej) => {
|
|
598
|
+
tLog("testArtiFactory =>", fPath);
|
|
599
|
+
const cleanPath = path.resolve(fPath);
|
|
600
|
+
fPaths.push(cleanPath.replace(process.cwd(), ``));
|
|
601
|
+
const targetDir = cleanPath.split("/").slice(0, -1).join("/");
|
|
602
|
+
fs.mkdir(targetDir, { recursive: true }, async (error) => {
|
|
603
|
+
if (error) {
|
|
604
|
+
console.error(`\u2757\uFE0FtestArtiFactory failed`, targetDir, error);
|
|
605
|
+
}
|
|
606
|
+
if (Buffer.isBuffer(value)) {
|
|
607
|
+
fs.writeFileSync(fPath, value, "binary");
|
|
608
|
+
res();
|
|
609
|
+
} else if (`string` === typeof value) {
|
|
610
|
+
fs.writeFileSync(fPath, value.toString(), {
|
|
611
|
+
encoding: "utf-8"
|
|
612
|
+
});
|
|
613
|
+
res();
|
|
614
|
+
} else {
|
|
615
|
+
const pipeStream = value;
|
|
616
|
+
const myFile = fs.createWriteStream(fPath);
|
|
617
|
+
pipeStream.pipe(myFile);
|
|
618
|
+
pipeStream.on("close", () => {
|
|
619
|
+
myFile.close();
|
|
620
|
+
res();
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
});
|
|
624
|
+
})
|
|
625
|
+
);
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
// launch(options?: PuppeteerLaunchOptions): Promise<Browser>;
|
|
629
|
+
startPuppeteer(options) {
|
|
630
|
+
}
|
|
631
|
+
// async launchSideCar(
|
|
632
|
+
// n: number
|
|
633
|
+
// ): Promise<[number, ITTestResourceConfiguration]> {
|
|
634
|
+
// return this.send<[number, ITTestResourceConfiguration]>(
|
|
635
|
+
// "launchSideCar",
|
|
636
|
+
// n,
|
|
637
|
+
// this.testResourceConfiguration.name
|
|
638
|
+
// );
|
|
639
|
+
// }
|
|
640
|
+
// stopSideCar(n: number): Promise<any> {
|
|
641
|
+
// return this.send<ITTestResourceConfiguration>(
|
|
642
|
+
// "stopSideCar",
|
|
643
|
+
// n,
|
|
644
|
+
// this.testResourceConfiguration.name
|
|
645
|
+
// );
|
|
646
|
+
// }
|
|
647
|
+
};
|
|
648
|
+
|
|
649
|
+
// src/lib/BaseGiven.ts
|
|
650
|
+
var BaseGiven = class {
|
|
651
|
+
constructor(features, whens, thens, givenCB, initialValues) {
|
|
652
|
+
this.artifacts = [];
|
|
653
|
+
this.features = (Array.isArray(features) ? features : []).map((feature) => {
|
|
654
|
+
if (typeof feature === "string")
|
|
655
|
+
return feature;
|
|
656
|
+
if (feature && typeof feature === "object") {
|
|
657
|
+
console.error(
|
|
658
|
+
`[ERROR] Found object in features array: ${feature.name || JSON.stringify(feature)}`
|
|
659
|
+
);
|
|
660
|
+
return "";
|
|
661
|
+
}
|
|
662
|
+
return String(feature);
|
|
663
|
+
}).filter((f) => f !== null && f !== void 0 && f !== "");
|
|
664
|
+
this.whens = Array.isArray(whens) ? whens : [];
|
|
665
|
+
this.thens = Array.isArray(thens) ? thens : [];
|
|
666
|
+
this.givenCB = givenCB;
|
|
667
|
+
this.initialValues = initialValues;
|
|
668
|
+
this.fails = 0;
|
|
669
|
+
}
|
|
670
|
+
addArtifact(path2) {
|
|
671
|
+
if (typeof path2 !== "string") {
|
|
672
|
+
throw new Error(
|
|
673
|
+
`[ARTIFACT ERROR] Expected string, got ${typeof path2}: ${JSON.stringify(
|
|
674
|
+
path2
|
|
675
|
+
)}`
|
|
676
|
+
);
|
|
677
|
+
}
|
|
678
|
+
const normalizedPath = path2.replace(/\\/g, "/");
|
|
679
|
+
this.artifacts.push(normalizedPath);
|
|
680
|
+
}
|
|
681
|
+
beforeAll(store) {
|
|
682
|
+
return store;
|
|
683
|
+
}
|
|
684
|
+
toObj() {
|
|
685
|
+
return {
|
|
686
|
+
key: this.key,
|
|
687
|
+
// name: this.name,
|
|
688
|
+
whens: (this.whens || []).map((w) => {
|
|
689
|
+
if (w && w.toObj)
|
|
690
|
+
return w.toObj();
|
|
691
|
+
console.error("When step is not as expected!", JSON.stringify(w));
|
|
692
|
+
return {};
|
|
693
|
+
}),
|
|
694
|
+
thens: (this.thens || []).map((t) => t && t.toObj ? t.toObj() : {}),
|
|
695
|
+
error: this.error ? [this.error, this.error.stack] : null,
|
|
696
|
+
failed: this.failed,
|
|
697
|
+
features: this.features || [],
|
|
698
|
+
artifacts: this.artifacts
|
|
699
|
+
};
|
|
700
|
+
}
|
|
701
|
+
async afterEach(store, key, artifactory, pm) {
|
|
702
|
+
return store;
|
|
703
|
+
}
|
|
704
|
+
async give(subject, key, testResourceConfiguration, tester, artifactory, tLog, pm, suiteNdx) {
|
|
705
|
+
this.key = key;
|
|
706
|
+
this.fails = 0;
|
|
707
|
+
tLog(`
|
|
708
|
+
${this.key}`);
|
|
709
|
+
tLog(`
|
|
710
|
+
Given: ${this.name}`);
|
|
711
|
+
const givenArtifactory = (fPath, value) => artifactory(`given-${key}/${fPath}`, value);
|
|
712
|
+
this.uberCatcher((e) => {
|
|
713
|
+
console.error(e.toString());
|
|
714
|
+
this.error = e.error;
|
|
715
|
+
tLog(e.stack);
|
|
716
|
+
});
|
|
717
|
+
try {
|
|
718
|
+
const addArtifact = this.addArtifact.bind(this);
|
|
719
|
+
const proxiedPm = beforeEachProxy(pm, suiteNdx.toString(), addArtifact);
|
|
720
|
+
this.store = await this.givenThat(
|
|
721
|
+
subject,
|
|
722
|
+
testResourceConfiguration,
|
|
723
|
+
givenArtifactory,
|
|
724
|
+
this.givenCB,
|
|
725
|
+
this.initialValues,
|
|
726
|
+
proxiedPm
|
|
727
|
+
);
|
|
728
|
+
} catch (e) {
|
|
729
|
+
this.failed = true;
|
|
730
|
+
this.fails++;
|
|
731
|
+
this.error = e.stack;
|
|
732
|
+
}
|
|
733
|
+
try {
|
|
734
|
+
const whens = this.whens || [];
|
|
735
|
+
if (whens.length > 0) {
|
|
736
|
+
for (const [whenNdx, whenStep] of whens.entries()) {
|
|
737
|
+
if (whenStep && whenStep.name && whenStep.name.startsWith("result:")) {
|
|
738
|
+
this.thens.push(whenStep);
|
|
739
|
+
continue;
|
|
740
|
+
}
|
|
741
|
+
if (whenStep && typeof whenStep.test === "function") {
|
|
742
|
+
try {
|
|
743
|
+
this.store = await whenStep.test(
|
|
744
|
+
this.store,
|
|
745
|
+
testResourceConfiguration,
|
|
746
|
+
tLog,
|
|
747
|
+
pm,
|
|
748
|
+
`suite-${suiteNdx}/given-${key}/when/${whenNdx}`
|
|
749
|
+
);
|
|
750
|
+
} catch (e) {
|
|
751
|
+
this.failed = true;
|
|
752
|
+
this.fails++;
|
|
753
|
+
throw e;
|
|
754
|
+
}
|
|
755
|
+
} else {
|
|
756
|
+
this.failed = true;
|
|
757
|
+
this.fails++;
|
|
758
|
+
throw new Error(`When step ${whenNdx} does not have a test method`);
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
} else {
|
|
762
|
+
console.log(`[BaseGiven.give] No when steps to process`);
|
|
763
|
+
}
|
|
764
|
+
for (const [thenNdx, thenStep] of this.thens.entries()) {
|
|
765
|
+
try {
|
|
766
|
+
const t = await thenStep.test(
|
|
767
|
+
this.store,
|
|
768
|
+
testResourceConfiguration,
|
|
769
|
+
tLog,
|
|
770
|
+
pm,
|
|
771
|
+
`suite-${suiteNdx}/given-${key}/then-${thenNdx}`
|
|
772
|
+
);
|
|
773
|
+
tester(t);
|
|
774
|
+
} catch (e) {
|
|
775
|
+
this.failed = true;
|
|
776
|
+
this.fails++;
|
|
777
|
+
throw e;
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
} catch (e) {
|
|
781
|
+
this.error = e.stack;
|
|
782
|
+
this.failed = true;
|
|
783
|
+
} finally {
|
|
784
|
+
try {
|
|
785
|
+
const addArtifact = this.addArtifact.bind(this);
|
|
786
|
+
const proxiedPm = afterEachProxy(
|
|
787
|
+
pm,
|
|
788
|
+
suiteNdx.toString(),
|
|
789
|
+
key,
|
|
790
|
+
addArtifact
|
|
791
|
+
);
|
|
792
|
+
await this.afterEach(this.store, this.key, givenArtifactory, proxiedPm);
|
|
793
|
+
} catch (e) {
|
|
794
|
+
this.failed = true;
|
|
795
|
+
this.fails++;
|
|
796
|
+
throw e;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
return this.store;
|
|
800
|
+
}
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
// src/lib/BaseWhen.ts
|
|
804
|
+
var BaseWhen = class {
|
|
805
|
+
constructor(name, whenCB) {
|
|
806
|
+
this.artifacts = [];
|
|
807
|
+
this.name = name;
|
|
808
|
+
this.whenCB = whenCB;
|
|
809
|
+
}
|
|
810
|
+
addArtifact(path2) {
|
|
811
|
+
if (typeof path2 !== "string") {
|
|
812
|
+
throw new Error(
|
|
813
|
+
`[ARTIFACT ERROR] Expected string, got ${typeof path2}: ${JSON.stringify(
|
|
814
|
+
path2
|
|
815
|
+
)}`
|
|
816
|
+
);
|
|
817
|
+
}
|
|
818
|
+
const normalizedPath = path2.replace(/\\/g, "/");
|
|
819
|
+
this.artifacts.push(normalizedPath);
|
|
820
|
+
}
|
|
821
|
+
toObj() {
|
|
822
|
+
const obj = {
|
|
823
|
+
name: this.name,
|
|
824
|
+
error: this.error ? `${this.error.name}: ${this.error.message}
|
|
825
|
+
${this.error.stack}` : null,
|
|
826
|
+
artifacts: this.artifacts
|
|
827
|
+
};
|
|
828
|
+
console.log(
|
|
829
|
+
`[TOOBJ] Serializing ${this.constructor.name} with artifacts:`,
|
|
830
|
+
obj.artifacts
|
|
831
|
+
);
|
|
832
|
+
return obj;
|
|
833
|
+
}
|
|
834
|
+
async test(store, testResourceConfiguration, tLog, pm, filepath) {
|
|
835
|
+
try {
|
|
836
|
+
const addArtifact = this.addArtifact.bind(this);
|
|
837
|
+
const proxiedPm = andWhenProxy(pm, filepath, addArtifact);
|
|
838
|
+
const result = await this.andWhen(
|
|
839
|
+
store,
|
|
840
|
+
this.whenCB,
|
|
841
|
+
testResourceConfiguration,
|
|
842
|
+
proxiedPm
|
|
843
|
+
);
|
|
844
|
+
return result;
|
|
845
|
+
} catch (e) {
|
|
846
|
+
console.error(
|
|
847
|
+
"[ERROR] When step failed:",
|
|
848
|
+
this.name.toString(),
|
|
849
|
+
e.toString()
|
|
850
|
+
);
|
|
851
|
+
this.error = e;
|
|
852
|
+
throw e;
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
};
|
|
856
|
+
|
|
857
|
+
// src/lib/BaseThen.ts
|
|
858
|
+
var BaseThen = class {
|
|
859
|
+
constructor(name, thenCB) {
|
|
860
|
+
this.artifacts = [];
|
|
861
|
+
this.name = name;
|
|
862
|
+
this.thenCB = thenCB;
|
|
863
|
+
this.error = false;
|
|
864
|
+
this.artifacts = [];
|
|
865
|
+
}
|
|
866
|
+
addArtifact(path2) {
|
|
867
|
+
if (typeof path2 !== "string") {
|
|
868
|
+
throw new Error(
|
|
869
|
+
`[ARTIFACT ERROR] Expected string, got ${typeof path2}: ${JSON.stringify(
|
|
870
|
+
path2
|
|
871
|
+
)}`
|
|
872
|
+
);
|
|
873
|
+
}
|
|
874
|
+
const normalizedPath = path2.replace(/\\/g, "/");
|
|
875
|
+
this.artifacts.push(normalizedPath);
|
|
876
|
+
}
|
|
877
|
+
toObj() {
|
|
878
|
+
const obj = {
|
|
879
|
+
name: this.name,
|
|
880
|
+
error: this.error,
|
|
881
|
+
artifacts: this.artifacts
|
|
882
|
+
};
|
|
883
|
+
return obj;
|
|
884
|
+
}
|
|
885
|
+
async test(store, testResourceConfiguration, tLog, pm, filepath) {
|
|
886
|
+
const addArtifact = this.addArtifact.bind(this);
|
|
887
|
+
const proxiedPm = butThenProxy(pm, filepath, addArtifact);
|
|
888
|
+
try {
|
|
889
|
+
return await this.butThen(
|
|
890
|
+
store,
|
|
891
|
+
async (s) => {
|
|
892
|
+
try {
|
|
893
|
+
if (typeof this.thenCB === "function") {
|
|
894
|
+
const result = await this.thenCB(s, proxiedPm);
|
|
895
|
+
return result;
|
|
896
|
+
} else {
|
|
897
|
+
return this.thenCB;
|
|
898
|
+
}
|
|
899
|
+
} catch (e) {
|
|
900
|
+
this.error = true;
|
|
901
|
+
throw e;
|
|
902
|
+
}
|
|
903
|
+
},
|
|
904
|
+
testResourceConfiguration,
|
|
905
|
+
proxiedPm
|
|
906
|
+
);
|
|
907
|
+
} catch (e) {
|
|
908
|
+
this.error = true;
|
|
909
|
+
throw e;
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
};
|
|
913
|
+
|
|
914
|
+
// src/lib/Tiposkripto.ts
|
|
915
|
+
var Tiposkripto = class {
|
|
916
|
+
constructor(input, testSpecification, testImplementation, testResourceRequirement = defaultTestResourceRequirement, testAdapter = {}, uberCatcher = (cb) => cb()) {
|
|
917
|
+
this.artifacts = [];
|
|
918
|
+
const fullAdapter = DefaultAdapter(testAdapter);
|
|
919
|
+
const classySuites = Object.entries(testImplementation.suites).reduce(
|
|
920
|
+
(a, [key], index) => {
|
|
921
|
+
a[key] = (somestring, givens) => {
|
|
922
|
+
return new class extends BaseSuite {
|
|
923
|
+
afterAll(store, artifactory, pm) {
|
|
924
|
+
return fullAdapter.afterAll(store, pm);
|
|
925
|
+
}
|
|
926
|
+
assertThat(t) {
|
|
927
|
+
return fullAdapter.assertThis(t);
|
|
928
|
+
}
|
|
929
|
+
async setup(s, artifactory, tr, pm) {
|
|
930
|
+
return fullAdapter.beforeAll?.(s, tr, pm) ?? s;
|
|
931
|
+
}
|
|
932
|
+
}(somestring, index, givens);
|
|
933
|
+
};
|
|
934
|
+
return a;
|
|
935
|
+
},
|
|
936
|
+
{}
|
|
937
|
+
);
|
|
938
|
+
const classyGivens = Object.entries(testImplementation.givens).reduce(
|
|
939
|
+
(a, [key, g]) => {
|
|
940
|
+
a[key] = (features, whens, thens, gcb, initialValues) => {
|
|
941
|
+
const safeFeatures = Array.isArray(features) ? [...features] : [];
|
|
942
|
+
const safeWhens = Array.isArray(whens) ? [...whens] : [];
|
|
943
|
+
const safeThens = Array.isArray(thens) ? [...thens] : [];
|
|
944
|
+
return new class extends BaseGiven {
|
|
945
|
+
constructor() {
|
|
946
|
+
super(...arguments);
|
|
947
|
+
this.uberCatcher = uberCatcher;
|
|
948
|
+
}
|
|
949
|
+
async givenThat(subject, testResource, artifactory, initializer, initialValues2, pm) {
|
|
950
|
+
return fullAdapter.beforeEach(
|
|
951
|
+
subject,
|
|
952
|
+
initializer,
|
|
953
|
+
testResource,
|
|
954
|
+
initialValues2,
|
|
955
|
+
pm
|
|
956
|
+
);
|
|
957
|
+
}
|
|
958
|
+
afterEach(store, key2, artifactory, pm) {
|
|
959
|
+
return Promise.resolve(fullAdapter.afterEach(store, key2, pm));
|
|
960
|
+
}
|
|
961
|
+
}(
|
|
962
|
+
// name,
|
|
963
|
+
safeFeatures,
|
|
964
|
+
safeWhens,
|
|
965
|
+
safeThens,
|
|
966
|
+
testImplementation.givens[key],
|
|
967
|
+
initialValues
|
|
968
|
+
);
|
|
969
|
+
};
|
|
970
|
+
return a;
|
|
971
|
+
},
|
|
972
|
+
{}
|
|
973
|
+
);
|
|
974
|
+
const classyWhens = Object.entries(testImplementation.whens).reduce(
|
|
975
|
+
(a, [key, whEn]) => {
|
|
976
|
+
a[key] = (...payload) => {
|
|
977
|
+
const whenInstance = new class extends BaseWhen {
|
|
978
|
+
async andWhen(store, whenCB, testResource, pm) {
|
|
979
|
+
return await fullAdapter.andWhen(store, whenCB, testResource, pm);
|
|
980
|
+
}
|
|
981
|
+
}(`${key}: ${payload && payload.toString()}`, whEn(...payload));
|
|
982
|
+
return whenInstance;
|
|
983
|
+
};
|
|
984
|
+
return a;
|
|
985
|
+
},
|
|
986
|
+
{}
|
|
987
|
+
);
|
|
988
|
+
const classyThens = Object.entries(testImplementation.thens).reduce(
|
|
989
|
+
(a, [key, thEn]) => {
|
|
990
|
+
a[key] = (...args) => {
|
|
991
|
+
const thenInstance = new class extends BaseThen {
|
|
992
|
+
async butThen(store, thenCB, testResource, pm) {
|
|
993
|
+
return await fullAdapter.butThen(store, thenCB, testResource, pm);
|
|
994
|
+
}
|
|
995
|
+
}(`${key}: ${args && args.toString()}`, thEn(...args));
|
|
996
|
+
return thenInstance;
|
|
997
|
+
};
|
|
998
|
+
return a;
|
|
999
|
+
},
|
|
1000
|
+
{}
|
|
1001
|
+
);
|
|
1002
|
+
this.suitesOverrides = classySuites;
|
|
1003
|
+
this.givenOverides = classyGivens;
|
|
1004
|
+
this.whenOverides = classyWhens;
|
|
1005
|
+
this.thenOverides = classyThens;
|
|
1006
|
+
this.testResourceRequirement = testResourceRequirement;
|
|
1007
|
+
this.testSpecification = testSpecification;
|
|
1008
|
+
this.specs = testSpecification(
|
|
1009
|
+
this.Suites(),
|
|
1010
|
+
this.Given(),
|
|
1011
|
+
this.When(),
|
|
1012
|
+
this.Then()
|
|
1013
|
+
);
|
|
1014
|
+
this.totalTests = this.calculateTotalTests();
|
|
1015
|
+
this.testJobs = this.specs.map((suite) => {
|
|
1016
|
+
const suiteRunner = (suite2) => async (puppetMaster, tLog) => {
|
|
1017
|
+
try {
|
|
1018
|
+
const x = await suite2.run(
|
|
1019
|
+
input,
|
|
1020
|
+
puppetMaster.testResourceConfiguration,
|
|
1021
|
+
(fPath, value) => puppetMaster.testArtiFactoryfileWriter(
|
|
1022
|
+
tLog,
|
|
1023
|
+
(p) => {
|
|
1024
|
+
this.artifacts.push(p);
|
|
1025
|
+
}
|
|
1026
|
+
)(
|
|
1027
|
+
puppetMaster.testResourceConfiguration.fs + "/" + fPath,
|
|
1028
|
+
value
|
|
1029
|
+
),
|
|
1030
|
+
tLog,
|
|
1031
|
+
puppetMaster
|
|
1032
|
+
);
|
|
1033
|
+
return x;
|
|
1034
|
+
} catch (e) {
|
|
1035
|
+
console.error(e.stack);
|
|
1036
|
+
throw e;
|
|
1037
|
+
}
|
|
1038
|
+
};
|
|
1039
|
+
const runner = suiteRunner(suite);
|
|
1040
|
+
return {
|
|
1041
|
+
test: suite,
|
|
1042
|
+
toObj: () => {
|
|
1043
|
+
return suite.toObj();
|
|
1044
|
+
},
|
|
1045
|
+
runner,
|
|
1046
|
+
receiveTestResourceConfig: async function(puppetMaster) {
|
|
1047
|
+
const tLog = async (...l) => {
|
|
1048
|
+
};
|
|
1049
|
+
try {
|
|
1050
|
+
const suiteDone = await runner(puppetMaster, tLog);
|
|
1051
|
+
const fails = suiteDone.fails;
|
|
1052
|
+
await puppetMaster.writeFileSync(
|
|
1053
|
+
`tests.json`,
|
|
1054
|
+
JSON.stringify(this.toObj(), null, 2),
|
|
1055
|
+
"test"
|
|
1056
|
+
);
|
|
1057
|
+
return {
|
|
1058
|
+
failed: fails > 0,
|
|
1059
|
+
fails,
|
|
1060
|
+
artifacts: this.artifacts || [],
|
|
1061
|
+
features: suiteDone.features(),
|
|
1062
|
+
tests: 0,
|
|
1063
|
+
// Keep existing field
|
|
1064
|
+
runTimeTests: this.totalTests
|
|
1065
|
+
// Add the total number of tests
|
|
1066
|
+
};
|
|
1067
|
+
} catch (e) {
|
|
1068
|
+
console.error(e.stack);
|
|
1069
|
+
return {
|
|
1070
|
+
failed: true,
|
|
1071
|
+
fails: -1,
|
|
1072
|
+
artifacts: this.artifacts || [],
|
|
1073
|
+
features: [],
|
|
1074
|
+
tests: 0,
|
|
1075
|
+
// Keep existing field
|
|
1076
|
+
runTimeTests: -1
|
|
1077
|
+
// Set to -1 on hard error
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
};
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
Specs() {
|
|
1085
|
+
return this.specs;
|
|
1086
|
+
}
|
|
1087
|
+
Suites() {
|
|
1088
|
+
return this.suitesOverrides;
|
|
1089
|
+
}
|
|
1090
|
+
Given() {
|
|
1091
|
+
return this.givenOverides;
|
|
1092
|
+
}
|
|
1093
|
+
When() {
|
|
1094
|
+
return this.whenOverides;
|
|
1095
|
+
}
|
|
1096
|
+
Then() {
|
|
1097
|
+
return this.thenOverides;
|
|
1098
|
+
}
|
|
1099
|
+
// Add a method to access test jobs which can be used by receiveTestResourceConfig
|
|
1100
|
+
getTestJobs() {
|
|
1101
|
+
return this.testJobs;
|
|
1102
|
+
}
|
|
1103
|
+
calculateTotalTests() {
|
|
1104
|
+
let total = 0;
|
|
1105
|
+
for (const suite of this.specs) {
|
|
1106
|
+
if (suite && typeof suite === "object") {
|
|
1107
|
+
if ("givens" in suite) {
|
|
1108
|
+
const givens = suite.givens;
|
|
1109
|
+
if (givens && typeof givens === "object") {
|
|
1110
|
+
total += Object.keys(givens).length;
|
|
1111
|
+
}
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
return total;
|
|
1116
|
+
}
|
|
1117
|
+
};
|
|
1118
|
+
|
|
1119
|
+
// src/Node.ts
|
|
1120
|
+
var ipcfile;
|
|
1121
|
+
var NodeTesteranto = class extends Tiposkripto {
|
|
1122
|
+
constructor(input, testSpecification, testImplementation, testResourceRequirement, testAdapter) {
|
|
1123
|
+
super(
|
|
1124
|
+
input,
|
|
1125
|
+
testSpecification,
|
|
1126
|
+
testImplementation,
|
|
1127
|
+
testResourceRequirement,
|
|
1128
|
+
testAdapter,
|
|
1129
|
+
() => {
|
|
1130
|
+
}
|
|
1131
|
+
);
|
|
1132
|
+
}
|
|
1133
|
+
async receiveTestResourceConfig(partialTestResource) {
|
|
1134
|
+
return await this.testJobs[0].receiveTestResourceConfig(
|
|
1135
|
+
new PM_Node(JSON.parse(partialTestResource), ipcfile)
|
|
1136
|
+
);
|
|
1137
|
+
}
|
|
1138
|
+
};
|
|
1139
|
+
var testeranto = async (input, testSpecification, testImplementation, testAdapter, testResourceRequirement = defaultTestResourceRequirement) => {
|
|
1140
|
+
try {
|
|
1141
|
+
const t = new NodeTesteranto(
|
|
1142
|
+
input,
|
|
1143
|
+
testSpecification,
|
|
1144
|
+
testImplementation,
|
|
1145
|
+
testResourceRequirement,
|
|
1146
|
+
testAdapter
|
|
1147
|
+
);
|
|
1148
|
+
process.on("unhandledRejection", (reason, promise) => {
|
|
1149
|
+
console.error("Unhandled Rejection at:", promise, "reason:", reason);
|
|
1150
|
+
});
|
|
1151
|
+
ipcfile = process.argv[3];
|
|
1152
|
+
process.exit((await t.receiveTestResourceConfig(process.argv[2])).fails);
|
|
1153
|
+
} catch (e) {
|
|
1154
|
+
console.error(e);
|
|
1155
|
+
console.error(e.stack);
|
|
1156
|
+
process.exit(-1);
|
|
1157
|
+
}
|
|
1158
|
+
};
|
|
1159
|
+
var Node_default = testeranto;
|
|
1160
|
+
|
|
1161
|
+
export {
|
|
1162
|
+
butThenProxy,
|
|
1163
|
+
andWhenProxy,
|
|
1164
|
+
BaseGiven,
|
|
1165
|
+
BaseWhen,
|
|
1166
|
+
BaseThen,
|
|
1167
|
+
BaseSuite,
|
|
1168
|
+
Tiposkripto,
|
|
1169
|
+
Node_default
|
|
1170
|
+
};
|