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