testeranto 0.114.1 → 0.125.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 +97001 -0
- package/.aider.conf.yml +5 -0
- package/.aider.input.history +9 -0
- package/.aider.tags.cache.v3/b7/e6/5be87b62aeaf2bc244ff41c1b61a.val +0 -0
- package/.aider.tags.cache.v3/cache.db +0 -0
- package/.aider.tags.cache.v3/e3/e6/3501625caf5d5eb171f0d248462e.val +0 -0
- package/.aider.tags.cache.v3/ec/c0/161c249c35be853cc40cf11f9267.val +0 -0
- package/README.md +15 -1
- package/bundle.js +1 -1
- package/dist/common/src/Init.js +31 -0
- package/dist/common/src/Node.js +49 -0
- package/dist/common/src/PM/base.js +230 -0
- package/dist/common/src/PM/main.js +1026 -0
- package/dist/common/src/PM/node.js +161 -0
- package/dist/common/{PM/node.js → src/PM/pure.js} +27 -18
- package/dist/common/{PM → src/PM}/web.js +14 -47
- package/dist/common/{Node.js → src/Pure.js} +11 -9
- package/dist/common/{SubPackages/react/component/web.js → src/SubPackages/react/component/index.js} +5 -4
- package/dist/common/src/SubPackages/react/component/node.js +10 -0
- package/dist/common/src/SubPackages/react/component/pure.js +10 -0
- package/dist/common/{SubPackages/react/jsx → src/SubPackages/react/component}/web.js +2 -2
- package/dist/common/src/SubPackages/react/jsx/index.js +64 -0
- package/dist/common/src/SubPackages/react/jsx/pure.js +10 -0
- package/dist/common/src/SubPackages/react/jsx/web.js +10 -0
- package/dist/common/{SubPackages/react-dom/component/web.js → src/SubPackages/react-dom/component/dynamic.js} +8 -14
- package/dist/common/src/SubPackages/react-dom/component/node.js +10 -0
- package/dist/common/src/SubPackages/react-dom/component/pure.js +10 -0
- package/dist/common/src/SubPackages/react-dom/component/static.js +26 -0
- package/dist/common/src/SubPackages/react-dom/component/web.js +16 -0
- package/dist/common/src/SubPackages/react-dom/jsx/dynamic.js +31 -0
- package/dist/common/src/SubPackages/react-dom/jsx/node.js +10 -0
- package/dist/common/src/SubPackages/react-dom/jsx/pure.js +10 -0
- package/dist/common/src/SubPackages/react-dom/jsx/static.js +59 -0
- package/dist/common/src/SubPackages/react-dom/jsx/web.js +16 -0
- package/dist/common/src/SubPackages/react-test-renderer/component/index.js +15 -0
- package/dist/common/src/SubPackages/react-test-renderer/component/pure.js +8 -0
- package/dist/common/src/SubPackages/react-test-renderer/component/test/implementation.js +57 -0
- package/dist/common/src/SubPackages/react-test-renderer/component/test/node.js +10 -0
- package/dist/common/src/SubPackages/react-test-renderer/component/test/pure.js +10 -0
- package/dist/common/src/SubPackages/react-test-renderer/component/test/web.js +10 -0
- package/dist/common/src/SubPackages/react-test-renderer/jsx/pure.js +10 -0
- package/dist/common/{Web.js → src/Web.js} +1 -4
- package/dist/common/src/build.js +223 -0
- package/dist/common/{defaultConfig.js → src/defaultConfig.js} +1 -3
- package/dist/common/{esbuildConfigs → src/esbuildConfigs}/index.js +1 -1
- package/dist/common/{esbuildConfigs → src/esbuildConfigs}/inputFilesPlugin.js +7 -3
- package/dist/common/{esbuildConfigs → src/esbuildConfigs}/node.js +7 -4
- package/dist/common/src/esbuildConfigs/pure.js +41 -0
- package/dist/common/{esbuildConfigs → src/esbuildConfigs}/web.js +8 -5
- package/dist/common/src/examples/react/component/index.js +33 -0
- package/dist/common/src/examples/react/component/test.js +36 -0
- package/dist/common/src/init-docs.js +9 -0
- package/dist/common/{lib → src/lib}/abstractBase.js +99 -95
- package/dist/common/{lib → src/lib}/basebuilder.js +24 -20
- package/dist/common/{lib → src/lib}/classBuilder.js +8 -5
- package/dist/common/{lib → src/lib}/core.js +10 -60
- package/dist/common/{lib → src/lib}/index.js +7 -2
- package/dist/common/{run.js → src/run.js} +12 -4
- package/dist/common/src/utils.js +65 -0
- package/dist/common/testeranto.config.js +41 -0
- package/dist/common/tsconfig.common.tsbuildinfo +1 -1
- package/dist/module/src/Init.js +26 -0
- package/dist/module/src/Node.js +42 -0
- package/dist/module/src/PM/base.js +223 -0
- package/dist/module/src/PM/main.js +986 -0
- package/dist/module/src/PM/node.js +154 -0
- package/dist/module/{PM/node.js → src/PM/pure.js} +25 -16
- package/dist/module/{PM → src/PM}/web.js +14 -47
- package/dist/module/src/Project.js +120 -0
- package/dist/module/{Node.js → src/Pure.js} +9 -7
- package/dist/module/{ReportClient.js → src/ReportClient.js} +1 -1
- package/dist/module/{SubPackages/react/component/web.js → src/SubPackages/react/component/index.js} +3 -4
- package/dist/module/src/SubPackages/react/component/node.js +5 -0
- package/dist/module/src/SubPackages/react/component/pure.js +5 -0
- package/dist/module/{SubPackages/react/jsx → src/SubPackages/react/component}/web.js +3 -3
- package/dist/module/src/SubPackages/react/jsx/index.js +58 -0
- package/dist/module/{SubPackages → src/SubPackages}/react/jsx/node.js +1 -1
- package/dist/module/src/SubPackages/react/jsx/pure.js +5 -0
- package/dist/module/src/SubPackages/react/jsx/web.js +5 -0
- package/dist/module/{SubPackages/react-dom/component/web.js → src/SubPackages/react-dom/component/dynamic.js} +5 -13
- package/dist/module/src/SubPackages/react-dom/component/node.js +5 -0
- package/dist/module/src/SubPackages/react-dom/component/pure.js +5 -0
- package/dist/module/src/SubPackages/react-dom/component/static.js +22 -0
- package/dist/module/src/SubPackages/react-dom/component/web.js +11 -0
- package/dist/module/{SubPackages/react-dom/jsx/node.js → src/SubPackages/react-dom/jsx/dynamic.js} +3 -7
- package/dist/module/src/SubPackages/react-dom/jsx/node.js +5 -0
- package/dist/module/src/SubPackages/react-dom/jsx/pure.js +5 -0
- package/dist/module/src/SubPackages/react-dom/jsx/static.js +53 -0
- package/dist/module/src/SubPackages/react-dom/jsx/web.js +11 -0
- package/dist/module/src/SubPackages/react-test-renderer/component/index.js +14 -0
- package/dist/module/src/SubPackages/react-test-renderer/component/pure.js +3 -0
- package/dist/module/src/SubPackages/react-test-renderer/component/test/implementation.js +54 -0
- package/dist/module/src/SubPackages/react-test-renderer/component/test/node.js +5 -0
- package/dist/module/src/SubPackages/react-test-renderer/component/test/pure.js +5 -0
- package/dist/module/src/SubPackages/react-test-renderer/component/test/web.js +5 -0
- package/dist/module/src/SubPackages/react-test-renderer/jsx/pure.js +5 -0
- package/dist/module/{TestReport.js → src/TestReport.js} +26 -14
- package/dist/module/{Web.js → src/Web.js} +1 -4
- package/dist/module/src/build.js +185 -0
- package/dist/module/{defaultConfig.js → src/defaultConfig.js} +1 -3
- package/dist/module/{esbuildConfigs → src/esbuildConfigs}/index.js +1 -1
- package/dist/module/{esbuildConfigs → src/esbuildConfigs}/inputFilesPlugin.js +7 -3
- package/dist/module/{esbuildConfigs → src/esbuildConfigs}/node.js +7 -4
- package/dist/module/src/esbuildConfigs/pure.js +36 -0
- package/dist/module/{esbuildConfigs → src/esbuildConfigs}/web.js +8 -5
- package/dist/module/src/examples/react/component/index.js +26 -0
- package/dist/module/src/examples/react/component/test.js +32 -0
- package/dist/module/src/init-docs.js +4 -0
- package/dist/module/{lib → src/lib}/abstractBase.js +99 -95
- package/dist/module/{lib → src/lib}/basebuilder.js +24 -20
- package/dist/module/{lib → src/lib}/classBuilder.js +8 -5
- package/dist/module/{lib → src/lib}/core.js +10 -60
- package/dist/module/{lib → src/lib}/index.js +7 -2
- package/dist/module/{run.js → src/run.js} +12 -4
- package/dist/module/src/utils.js +53 -0
- package/dist/module/testeranto.config.js +39 -0
- package/dist/module/tsconfig.module.tsbuildinfo +1 -1
- package/dist/prebuild/Project.css +11367 -0
- package/dist/prebuild/Project.js +24643 -0
- package/dist/prebuild/ReportClient.js +1 -1
- package/dist/prebuild/TestReport.js +13 -12
- package/dist/prebuild/build.mjs +217 -106
- package/dist/prebuild/init-docs.mjs +29 -83
- package/dist/prebuild/run.mjs +803 -686
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/src/Init.d.ts +2 -0
- package/dist/types/src/Node.d.ts +9 -0
- package/dist/types/src/PM/base.d.ts +34 -0
- package/dist/types/{PM → src/PM}/index.d.ts +21 -22
- package/dist/types/src/PM/main.d.ts +47 -0
- package/dist/types/src/PM/node.d.ts +38 -0
- package/dist/types/{PM/node.d.ts → src/PM/pure.d.ts} +16 -17
- package/dist/types/{PM → src/PM}/web.d.ts +10 -15
- package/dist/types/src/Pure.d.ts +9 -0
- package/dist/types/src/SubPackages/react/component/index.d.ts +4 -0
- package/dist/types/src/SubPackages/react/component/node.d.ts +4 -0
- package/dist/types/src/SubPackages/react/component/pure.d.ts +4 -0
- package/dist/types/src/SubPackages/react/component/web.d.ts +4 -0
- package/dist/types/src/SubPackages/react/jsx/index.d.ts +5 -0
- package/dist/types/src/SubPackages/react/jsx/node.d.ts +4 -0
- package/dist/types/src/SubPackages/react/jsx/pure.d.ts +4 -0
- package/dist/types/src/SubPackages/react/jsx/web.d.ts +4 -0
- package/dist/types/src/SubPackages/react-dom/component/dynamic.d.ts +20 -0
- package/dist/types/src/SubPackages/react-dom/component/node.d.ts +4 -0
- package/dist/types/src/SubPackages/react-dom/component/pure.d.ts +4 -0
- package/dist/types/src/SubPackages/react-dom/component/static.d.ts +9 -0
- package/dist/types/src/SubPackages/react-dom/component/web.d.ts +4 -0
- package/dist/types/src/SubPackages/react-dom/jsx/dynamic.d.ts +5 -0
- package/dist/types/src/SubPackages/react-dom/jsx/node.d.ts +4 -0
- package/dist/types/src/SubPackages/react-dom/jsx/pure.d.ts +4 -0
- package/dist/types/src/SubPackages/react-dom/jsx/static.d.ts +5 -0
- package/dist/types/src/SubPackages/react-dom/jsx/web.d.ts +5 -0
- package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/MemoExoticComponent/node.d.ts +1 -1
- package/dist/types/src/SubPackages/react-test-renderer/component/index.d.ts +5 -0
- package/dist/types/src/SubPackages/react-test-renderer/component/interface.d.ts +3 -0
- package/dist/types/src/SubPackages/react-test-renderer/component/node.d.ts +4 -0
- package/dist/types/src/SubPackages/react-test-renderer/component/pure.d.ts +4 -0
- package/dist/types/src/SubPackages/react-test-renderer/component/test/implementation.d.ts +4 -0
- package/dist/types/src/SubPackages/react-test-renderer/component/test/node.d.ts +3 -0
- package/dist/types/src/SubPackages/react-test-renderer/component/test/pure.d.ts +4 -0
- package/dist/types/src/SubPackages/react-test-renderer/component/test/web.d.ts +3 -0
- package/dist/types/src/SubPackages/react-test-renderer/component/web.d.ts +4 -0
- package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/fc/node.d.ts +1 -1
- package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/fc/web.d.ts +1 -1
- package/dist/types/src/SubPackages/react-test-renderer/jsx/index.d.ts +11 -0
- package/dist/types/src/SubPackages/react-test-renderer/jsx/node.d.ts +4 -0
- package/dist/types/src/SubPackages/react-test-renderer/jsx/pure.d.ts +4 -0
- package/dist/types/src/SubPackages/react-test-renderer/jsx/web.d.ts +4 -0
- package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/node.d.ts +1 -1
- package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/web.d.ts +1 -1
- package/dist/types/src/Types.d.ts +88 -0
- package/dist/types/src/Web.d.ts +9 -0
- package/dist/types/src/defaultConfig.d.ts +3 -0
- package/dist/types/src/esbuildConfigs/index.d.ts +4 -0
- package/dist/types/{esbuildConfigs → src/esbuildConfigs}/inputFilesPlugin.d.ts +2 -1
- package/dist/types/src/esbuildConfigs/node.d.ts +4 -0
- package/dist/types/src/esbuildConfigs/pure.d.ts +4 -0
- package/dist/types/src/esbuildConfigs/web.d.ts +4 -0
- package/dist/types/src/examples/react/component/index.d.ts +13 -0
- package/dist/types/src/examples/react/component/test.d.ts +17 -0
- package/dist/types/{lib → src/lib}/abstractBase.d.ts +47 -34
- package/dist/types/{lib → src/lib}/basebuilder.d.ts +7 -9
- package/dist/types/src/lib/classBuilder.d.ts +9 -0
- package/dist/types/src/lib/core.d.ts +7 -0
- package/dist/types/{lib → src/lib}/index.d.ts +14 -36
- package/dist/types/src/lib/types.d.ts +15 -0
- package/dist/types/src/utils.d.ts +18 -0
- package/dist/types/testeranto.config.d.ts +3 -0
- package/dist/types/tsconfig.types.tsbuildinfo +1 -1
- package/eslint.config.mjs +111 -0
- package/package.json +33 -12
- package/src/Init.ts +29 -75
- package/src/Node.ts +42 -46
- package/src/PM/base.ts +299 -0
- package/src/PM/index.ts +28 -21
- package/src/PM/main.ts +569 -819
- package/src/PM/node.ts +88 -44
- package/src/PM/pure.ts +209 -0
- package/src/PM/web.ts +19 -121
- package/src/Project.tsx +200 -0
- package/src/Pure.ts +69 -0
- package/src/ReportClient.tsx +8 -3
- package/src/SubPackages/react/component/index.ts +28 -0
- package/src/SubPackages/react/component/node.ts +12 -82
- package/src/SubPackages/react/component/pure.ts +17 -0
- package/src/SubPackages/react/component/web.ts +12 -81
- package/src/SubPackages/react/jsx/index.ts +56 -52
- package/src/SubPackages/react/jsx/node.ts +12 -29
- package/src/SubPackages/react/jsx/pure.ts +23 -0
- package/src/SubPackages/react/jsx/web.ts +17 -36
- package/src/SubPackages/react-dom/component/dynamic.ts +107 -0
- package/src/SubPackages/react-dom/component/node.ts +11 -116
- package/src/SubPackages/react-dom/component/pure.ts +17 -0
- package/src/SubPackages/react-dom/component/static.ts +41 -0
- package/src/SubPackages/react-dom/component/web.ts +7 -113
- package/src/SubPackages/react-dom/jsx/dynamic.ts +46 -0
- package/src/SubPackages/react-dom/jsx/node.ts +10 -58
- package/src/SubPackages/react-dom/jsx/pure.ts +18 -0
- package/src/SubPackages/react-dom/jsx/static.ts +87 -0
- package/src/SubPackages/react-dom/jsx/web.ts +7 -135
- package/src/SubPackages/react-test-renderer/component/index.ts +27 -51
- package/src/SubPackages/react-test-renderer/component/interface.ts +7 -5
- package/src/SubPackages/react-test-renderer/component/node.ts +7 -25
- package/src/SubPackages/react-test-renderer/component/pure.ts +18 -0
- package/src/SubPackages/react-test-renderer/component/test/implementation.ts +63 -0
- package/src/SubPackages/react-test-renderer/component/test/node.ts +14 -0
- package/src/SubPackages/react-test-renderer/component/test/pure.ts +14 -0
- package/src/SubPackages/react-test-renderer/component/test/web.ts +14 -0
- package/src/SubPackages/react-test-renderer/component/web.ts +7 -23
- package/src/SubPackages/react-test-renderer/jsx/index.ts +13 -46
- package/src/SubPackages/react-test-renderer/jsx/node.ts +9 -15
- package/src/SubPackages/react-test-renderer/jsx/pure.ts +31 -0
- package/src/SubPackages/react-test-renderer/jsx/web.ts +9 -14
- package/src/TestReport.tsx +37 -19
- package/src/Types.ts +114 -140
- package/src/Web.ts +13 -48
- package/src/build.ts +153 -143
- package/src/defaultConfig.ts +3 -5
- package/src/esbuildConfigs/index.ts +3 -3
- package/src/esbuildConfigs/inputFilesPlugin.ts +9 -7
- package/src/esbuildConfigs/node.ts +10 -6
- package/src/esbuildConfigs/pure.ts +72 -0
- package/src/esbuildConfigs/web.ts +11 -7
- package/src/examples/react/component/index.tsx +35 -0
- package/src/examples/react/component/test.ts +83 -0
- package/src/init-docs.ts +2 -15
- package/src/lib/abstractBase.ts +188 -260
- package/src/lib/basebuilder.ts +47 -48
- package/src/lib/classBuilder.ts +28 -35
- package/src/lib/core.ts +35 -102
- package/src/lib/index.ts +37 -65
- package/src/lib/types.ts +23 -98
- package/src/run.ts +18 -5
- package/src/utils.ts +73 -40
- package/testeranto/Project.css +11367 -0
- package/testeranto/Project.js +24643 -0
- package/testeranto/ReportClient.css +11367 -0
- package/testeranto/ReportClient.js +24641 -0
- package/testeranto/TestReport.css +11367 -0
- package/testeranto/TestReport.js +27485 -0
- package/testeranto/bundles/node/react/metafile.json +627 -0
- package/testeranto/bundles/node/react/src/SubPackages/react-test-renderer/component/test/node.mjs +24687 -0
- package/testeranto/bundles/pure/react/metafile.json +8 -0
- package/testeranto/bundles/pure/react/src/SubPackages/react-test-renderer/component/test/pure.mjs +24625 -0
- package/testeranto/bundles/web/react/metafile.json +8 -0
- package/testeranto/bundles/web/react/src/SubPackages/react-test-renderer/component/test/web.html +19 -0
- package/testeranto/bundles/web/react/src/SubPackages/react-test-renderer/component/test/web.mjs +21290 -0
- package/testeranto/index.html +28 -0
- package/testeranto/reports/react/config.json +22 -0
- package/testeranto/reports/react/index.html +24 -0
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/node/node/console_log.txt +0 -0
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/bdd_errors.txt +1 -0
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/featurePrompt.txt +0 -0
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/lint_errors.json +3381 -0
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/littleBoard.html +20 -0
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/log.txt +40 -0
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/prompt.txt +24 -0
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/tests.json +132 -0
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/pure/pure/type_errors.txt +17 -0
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/bdd_errors.txt +1 -0
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/console_log.txt +1 -0
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/lint_errors.json +2947 -0
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/littleBoard.html +20 -0
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/log.txt +40 -0
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/prompt.txt +23 -0
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/tests.json +132 -0
- package/testeranto/reports/react/src/SubPackages/react-test-renderer/component/test/web/web/type_errors.txt +18 -0
- package/testeranto/reports/react/summary.json +8 -0
- package/testeranto.config.ts +45 -0
- package/tsc.log +53 -76
- package/type-fix.txt +2 -0
- package/dist/common/Init.js +0 -68
- package/dist/common/PM/main.js +0 -1176
- package/dist/common/SubPackages/react/component/node.js +0 -19
- package/dist/common/SubPackages/react/jsx/index.js +0 -21
- package/dist/common/SubPackages/react-dom/component/node.js +0 -88
- package/dist/common/SubPackages/react-dom/jsx/node.js +0 -39
- package/dist/common/SubPackages/react-dom/jsx/web.js +0 -128
- package/dist/common/SubPackages/react-test-renderer/component/index.js +0 -2
- package/dist/common/build.js +0 -222
- package/dist/common/init-docs.js +0 -53
- package/dist/common/puppeteerConfiger.js +0 -24
- package/dist/common/utils.js +0 -43
- package/dist/module/Init.js +0 -63
- package/dist/module/PM/main.js +0 -1136
- package/dist/module/SubPackages/react/component/node.js +0 -14
- package/dist/module/SubPackages/react/jsx/index.js +0 -15
- package/dist/module/SubPackages/react-dom/component/node.js +0 -80
- package/dist/module/SubPackages/react-dom/jsx/web.js +0 -90
- package/dist/module/SubPackages/react-test-renderer/component/index.js +0 -1
- package/dist/module/build.js +0 -184
- package/dist/module/init-docs.js +0 -15
- package/dist/module/puppeteerConfiger.js +0 -19
- package/dist/module/utils.js +0 -29
- package/dist/types/Init.d.ts +0 -2
- package/dist/types/Node.d.ts +0 -12
- package/dist/types/PM/main.d.ts +0 -66
- package/dist/types/SubPackages/react/component/node.d.ts +0 -7
- package/dist/types/SubPackages/react/component/web.d.ts +0 -7
- package/dist/types/SubPackages/react/jsx/index.d.ts +0 -12
- package/dist/types/SubPackages/react/jsx/node.d.ts +0 -4
- package/dist/types/SubPackages/react/jsx/web.d.ts +0 -4
- package/dist/types/SubPackages/react-dom/component/node.d.ts +0 -11
- package/dist/types/SubPackages/react-dom/component/web.d.ts +0 -20
- package/dist/types/SubPackages/react-dom/jsx/node.d.ts +0 -7
- package/dist/types/SubPackages/react-dom/jsx/web.d.ts +0 -5
- package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +0 -13
- package/dist/types/SubPackages/react-test-renderer/component/interface.d.ts +0 -9
- package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +0 -4
- package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +0 -4
- package/dist/types/SubPackages/react-test-renderer/jsx/index.d.ts +0 -16
- package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +0 -9
- package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +0 -9
- package/dist/types/Types.d.ts +0 -61
- package/dist/types/Web.d.ts +0 -9
- package/dist/types/defaultConfig.d.ts +0 -3
- package/dist/types/esbuildConfigs/index.d.ts +0 -4
- package/dist/types/esbuildConfigs/node.d.ts +0 -4
- package/dist/types/esbuildConfigs/web.d.ts +0 -4
- package/dist/types/lib/classBuilder.d.ts +0 -7
- package/dist/types/lib/core.d.ts +0 -7
- package/dist/types/lib/types.d.ts +0 -14
- package/dist/types/puppeteerConfiger.d.ts +0 -4
- package/dist/types/utils.d.ts +0 -15
- package/src/puppeteerConfiger.ts +0 -26
- /package/dist/common/{PM → src/PM}/index.js +0 -0
- /package/dist/common/{ReportServer.js → src/ReportServer.js} +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react/jsx/node.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-dom/jsx/index.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/MemoExoticComponent/node.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/component/interface.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/component/node.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/component/web.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/fc/node.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/fc/web.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx/index.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx/node.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx/web.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/index.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/node.js +0 -0
- /package/dist/common/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
- /package/dist/common/{Types.js → src/Types.js} +0 -0
- /package/dist/common/{esbuildConfigs → src/esbuildConfigs}/eslint-formatter-testeranto.js +0 -0
- /package/dist/common/{esbuildConfigs → src/esbuildConfigs}/featuresPlugin.js +0 -0
- /package/dist/common/{lib → src/lib}/types.js +0 -0
- /package/dist/common/{web.html.js → src/web.html.js} +0 -0
- /package/dist/module/{Footer.js → src/Footer.js} +0 -0
- /package/dist/module/{PM → src/PM}/index.js +0 -0
- /package/dist/module/{ReportServer.js → src/ReportServer.js} +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-dom/jsx/index.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/MemoExoticComponent/node.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/component/interface.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/component/node.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/component/web.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/fc/node.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/fc/web.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx/index.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx/node.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx/web.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/index.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/node.js +0 -0
- /package/dist/module/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/web.js +0 -0
- /package/dist/module/{Types.js → src/Types.js} +0 -0
- /package/dist/module/{esbuildConfigs → src/esbuildConfigs}/eslint-formatter-testeranto.js +0 -0
- /package/dist/module/{esbuildConfigs → src/esbuildConfigs}/featuresPlugin.js +0 -0
- /package/dist/module/{lib → src/lib}/types.js +0 -0
- /package/dist/module/{web.html.js → src/web.html.js} +0 -0
- /package/dist/types/{ReportServer.d.ts → src/ReportServer.d.ts} +0 -0
- /package/dist/types/{SubPackages → src/SubPackages}/react-dom/jsx/index.d.ts +0 -0
- /package/dist/types/{SubPackages → src/SubPackages}/react-test-renderer/jsx-promised/index.d.ts +0 -0
- /package/dist/types/{build.d.ts → src/build.d.ts} +0 -0
- /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/eslint-formatter-testeranto.d.ts +0 -0
- /package/dist/types/{esbuildConfigs → src/esbuildConfigs}/featuresPlugin.d.ts +0 -0
- /package/dist/types/{init-docs.d.ts → src/init-docs.d.ts} +0 -0
- /package/dist/types/{run.d.ts → src/run.d.ts} +0 -0
- /package/dist/types/{web.html.d.ts → src/web.html.d.ts} +0 -0
package/src/PM/main.ts
CHANGED
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import ts from "typescript";
|
|
4
|
+
import net from "net";
|
|
5
|
+
import { Page } from "puppeteer-core/lib/esm/puppeteer";
|
|
4
6
|
import fs, { watch } from "fs";
|
|
5
7
|
import path from "path";
|
|
6
|
-
import puppeteer, {
|
|
7
|
-
Browser,
|
|
8
|
-
ConsoleMessage,
|
|
9
|
-
ScreenRecorder,
|
|
10
|
-
ScreenshotOptions,
|
|
11
|
-
} from "puppeteer-core";
|
|
12
|
-
import { PassThrough } from "stream";
|
|
8
|
+
import puppeteer, { ConsoleMessage, ScreenshotOptions } from "puppeteer-core";
|
|
13
9
|
import ansiC from "ansi-colors";
|
|
14
10
|
import crypto from "node:crypto";
|
|
15
11
|
import { ESLint } from "eslint";
|
|
16
12
|
import tsc from "tsc-prog";
|
|
13
|
+
|
|
14
|
+
import { IFinalResults, IRunnables } from "../lib/index.js";
|
|
17
15
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} from "../
|
|
24
|
-
import {
|
|
16
|
+
getRunnables,
|
|
17
|
+
ISummary,
|
|
18
|
+
lintPather,
|
|
19
|
+
promptPather,
|
|
20
|
+
tscPather,
|
|
21
|
+
} from "../utils";
|
|
22
|
+
import { IBuiltConfig, IRunTime, ITestTypes } from "../Types.js";
|
|
25
23
|
|
|
26
|
-
import {
|
|
24
|
+
import { PM_Base } from "./base.js";
|
|
27
25
|
|
|
28
26
|
type IOutputs = Record<
|
|
29
27
|
string,
|
|
@@ -38,11 +36,7 @@ const formatter = await eslint.loadFormatter(
|
|
|
38
36
|
);
|
|
39
37
|
const changes: Record<string, string> = {};
|
|
40
38
|
const fileHashes = {};
|
|
41
|
-
const fileStreams3: fs.WriteStream[] = [];
|
|
42
|
-
type IFPaths = string[];
|
|
43
|
-
const fPaths: IFPaths = [];
|
|
44
39
|
const files: Record<string, Set<string>> = {};
|
|
45
|
-
const recorders: Record<string, ScreenRecorder> = {};
|
|
46
40
|
const screenshots: Record<string, Promise<Uint8Array>[]> = {};
|
|
47
41
|
|
|
48
42
|
async function fileHash(filePath, algorithm = "md5") {
|
|
@@ -65,32 +59,6 @@ async function fileHash(filePath, algorithm = "md5") {
|
|
|
65
59
|
});
|
|
66
60
|
}
|
|
67
61
|
|
|
68
|
-
const getRunnables = (
|
|
69
|
-
tests: ITestTypes[],
|
|
70
|
-
payload = {
|
|
71
|
-
nodeEntryPoints: {},
|
|
72
|
-
webEntryPoints: {},
|
|
73
|
-
}
|
|
74
|
-
): IRunnables => {
|
|
75
|
-
return tests.reduce((pt, cv, cndx, cry) => {
|
|
76
|
-
if (cv[1] === "node") {
|
|
77
|
-
pt.nodeEntryPoints[cv[0]] = path.resolve(
|
|
78
|
-
`./docs/node/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`
|
|
79
|
-
);
|
|
80
|
-
} else if (cv[1] === "web") {
|
|
81
|
-
pt.webEntryPoints[cv[0]] = path.resolve(
|
|
82
|
-
`./docs/web/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (cv[3].length) {
|
|
87
|
-
getRunnables(cv[3], payload);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return pt;
|
|
91
|
-
}, payload as IRunnables);
|
|
92
|
-
};
|
|
93
|
-
|
|
94
62
|
const statusMessagePretty = (failures: number, test: string) => {
|
|
95
63
|
if (failures === 0) {
|
|
96
64
|
console.log(ansiC.green(ansiC.inverse(`> ${test} completed successfully`)));
|
|
@@ -129,27 +97,36 @@ function isValidUrl(string) {
|
|
|
129
97
|
}
|
|
130
98
|
}
|
|
131
99
|
|
|
132
|
-
|
|
133
|
-
|
|
100
|
+
// Wait for file to exist, checks every 2 seconds by default
|
|
101
|
+
function pollForFile(path, timeout = 2000) {
|
|
102
|
+
const intervalObj = setInterval(function () {
|
|
103
|
+
const file = path;
|
|
104
|
+
const fileExists = fs.existsSync(file);
|
|
134
105
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
ports: Record<number, boolean>;
|
|
138
|
-
queue: any[];
|
|
106
|
+
// console.log("Checking for: ", file);
|
|
107
|
+
// console.log("Exists: ", fileExists);
|
|
139
108
|
|
|
140
|
-
|
|
109
|
+
if (fileExists) {
|
|
110
|
+
clearInterval(intervalObj);
|
|
111
|
+
}
|
|
112
|
+
}, timeout);
|
|
113
|
+
}
|
|
141
114
|
|
|
115
|
+
export class PM_Main extends PM_Base {
|
|
116
|
+
name: string;
|
|
117
|
+
ports: Record<number, boolean>;
|
|
118
|
+
queue: any[];
|
|
119
|
+
mode: "once" | "dev";
|
|
142
120
|
bigBoard: ISummary = {};
|
|
143
121
|
webMetafileWatcher: fs.FSWatcher;
|
|
144
122
|
nodeMetafileWatcher: fs.FSWatcher;
|
|
123
|
+
importMetafileWatcher: fs.FSWatcher;
|
|
145
124
|
|
|
146
|
-
constructor(configs: IBuiltConfig) {
|
|
147
|
-
super();
|
|
148
|
-
|
|
149
|
-
this.mode = configs.devMode ? "DEV" : "PROD";
|
|
125
|
+
constructor(configs: IBuiltConfig, name: string, mode: "once" | "dev") {
|
|
126
|
+
super(configs);
|
|
150
127
|
|
|
151
|
-
this.
|
|
152
|
-
this.
|
|
128
|
+
this.name = name;
|
|
129
|
+
this.mode = mode;
|
|
153
130
|
this.ports = {};
|
|
154
131
|
|
|
155
132
|
this.configs.tests.forEach(([t]) => {
|
|
@@ -164,290 +141,192 @@ export class PM_Main extends PM {
|
|
|
164
141
|
this.configs.ports.forEach((element) => {
|
|
165
142
|
this.ports[element] = "true"; // set ports as open
|
|
166
143
|
});
|
|
144
|
+
}
|
|
167
145
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
146
|
+
mapping(): [string, (...a) => any][] {
|
|
147
|
+
return [
|
|
148
|
+
["$", this.$],
|
|
149
|
+
["click", this.click],
|
|
150
|
+
["closePage", this.closePage],
|
|
151
|
+
["createWriteStream", this.createWriteStream],
|
|
152
|
+
["customclose", this.customclose],
|
|
153
|
+
["customScreenShot", this.customScreenShot],
|
|
154
|
+
["end", this.end],
|
|
155
|
+
["existsSync", this.existsSync],
|
|
156
|
+
["focusOn", this.focusOn],
|
|
157
|
+
["getAttribute", this.getAttribute],
|
|
158
|
+
["getValue", this.getValue],
|
|
159
|
+
["goto", this.goto],
|
|
160
|
+
["isDisabled", this.isDisabled],
|
|
161
|
+
["mkdirSync", this.mkdirSync],
|
|
162
|
+
["newPage", this.newPage],
|
|
163
|
+
["page", this.page],
|
|
164
|
+
["pages", this.pages],
|
|
165
|
+
["screencast", this.screencast],
|
|
166
|
+
["screencastStop", this.screencastStop],
|
|
167
|
+
["typeInto", this.typeInto],
|
|
168
|
+
["waitForSelector", this.waitForSelector],
|
|
169
|
+
["write", this.write],
|
|
170
|
+
["writeFileSync", this.writeFileSync],
|
|
171
|
+
];
|
|
172
|
+
}
|
|
179
173
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
return page.close();
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
globalThis["goto"] = async (pageKey: string, url: string) => {
|
|
190
|
-
const page = (await this.browser.pages()).find(
|
|
191
|
-
/* @ts-ignore:next-line */
|
|
192
|
-
(p) => p.mainFrame()._id === pageKey
|
|
193
|
-
);
|
|
194
|
-
await page?.goto(url);
|
|
195
|
-
return;
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
globalThis["newPage"] = () => {
|
|
199
|
-
return this.browser.newPage();
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
globalThis["pages"] = () => {
|
|
203
|
-
return this.browser.pages();
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
globalThis["mkdirSync"] = (fp: string) => {
|
|
207
|
-
if (!fs.existsSync(fp)) {
|
|
208
|
-
return fs.mkdirSync(fp, {
|
|
209
|
-
recursive: true,
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
return false;
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
globalThis["writeFileSync"] = (
|
|
216
|
-
filepath: string,
|
|
217
|
-
contents: string,
|
|
218
|
-
testName: string
|
|
219
|
-
) => {
|
|
220
|
-
fs.mkdirSync(path.dirname(filepath), {
|
|
221
|
-
recursive: true,
|
|
222
|
-
});
|
|
223
|
-
if (!files[testName]) {
|
|
224
|
-
files[testName] = new Set();
|
|
225
|
-
}
|
|
226
|
-
files[testName].add(filepath);
|
|
227
|
-
return fs.writeFileSync(filepath, contents);
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
globalThis["createWriteStream"] = (filepath: string, testName: string) => {
|
|
231
|
-
const f = fs.createWriteStream(filepath);
|
|
232
|
-
fileStreams3.push(f);
|
|
233
|
-
// files.add(filepath);
|
|
234
|
-
if (!files[testName]) {
|
|
235
|
-
files[testName] = new Set();
|
|
236
|
-
}
|
|
237
|
-
files[testName].add(filepath);
|
|
238
|
-
return {
|
|
239
|
-
...JSON.parse(JSON.stringify(f)),
|
|
240
|
-
uid: fileStreams3.length - 1,
|
|
241
|
-
};
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
globalThis["write"] = (uid: number, contents: string) => {
|
|
245
|
-
fileStreams3[uid].write(contents);
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
globalThis["end"] = (uid: number) => {
|
|
249
|
-
fileStreams3[uid].end();
|
|
250
|
-
};
|
|
251
|
-
|
|
252
|
-
globalThis["customScreenShot"] = async (
|
|
253
|
-
opts: { path: string },
|
|
254
|
-
pageKey: string,
|
|
255
|
-
testName: string
|
|
256
|
-
) => {
|
|
257
|
-
const page = (await this.browser.pages()).find(
|
|
258
|
-
/* @ts-ignore:next-line */
|
|
259
|
-
(p) => p.mainFrame()._id === pageKey
|
|
260
|
-
);
|
|
174
|
+
async start() {
|
|
175
|
+
// set up the "pure" listeners
|
|
176
|
+
this.mapping().forEach(async ([command, func]) => {
|
|
177
|
+
// page.exposeFunction(command, func);
|
|
178
|
+
globalThis[command] = func;
|
|
179
|
+
});
|
|
261
180
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
recursive: true,
|
|
266
|
-
});
|
|
267
|
-
if (!files[opts.path]) {
|
|
268
|
-
files[opts.path] = new Set();
|
|
269
|
-
}
|
|
270
|
-
files[opts.path].add(opts.path as string);
|
|
181
|
+
if (!fs.existsSync(`testeranto/reports/${this.name}`)) {
|
|
182
|
+
fs.mkdirSync(`testeranto/reports/${this.name}`);
|
|
183
|
+
}
|
|
271
184
|
|
|
272
|
-
|
|
273
|
-
...opts,
|
|
274
|
-
path: p,
|
|
275
|
-
});
|
|
185
|
+
// await pollForFile();
|
|
276
186
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
globalThis["screencast"] = async (
|
|
287
|
-
opts: ScreenshotOptions,
|
|
288
|
-
pageKey: string
|
|
289
|
-
) => {
|
|
290
|
-
const page = (await this.browser.pages()).find(
|
|
291
|
-
/* @ts-ignore:next-line */
|
|
292
|
-
(p) => p.mainFrame()._id === pageKey
|
|
293
|
-
);
|
|
187
|
+
this.browser = (await puppeteer.launch({
|
|
188
|
+
slowMo: 1,
|
|
189
|
+
waitForInitialPage: false,
|
|
190
|
+
executablePath:
|
|
191
|
+
// process.env.CHROMIUM_PATH || "/opt/homebrew/bin/chromium",
|
|
192
|
+
"/opt/homebrew/bin/chromium",
|
|
193
|
+
headless: true,
|
|
194
|
+
dumpio: false,
|
|
195
|
+
devtools: false,
|
|
294
196
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
197
|
+
args: [
|
|
198
|
+
"--allow-file-access-from-files",
|
|
199
|
+
"--allow-insecure-localhost",
|
|
200
|
+
"--allow-running-insecure-content",
|
|
201
|
+
"--auto-open-devtools-for-tabs",
|
|
202
|
+
"--disable-dev-shm-usage",
|
|
203
|
+
"--disable-extensions",
|
|
204
|
+
"--disable-gpu",
|
|
205
|
+
"--disable-setuid-sandbox",
|
|
206
|
+
"--disable-site-isolation-trials",
|
|
207
|
+
"--disable-site-isolation-trials",
|
|
208
|
+
"--disable-web-security",
|
|
209
|
+
"--no-first-run",
|
|
210
|
+
"--no-sandbox",
|
|
211
|
+
"--no-startup-window",
|
|
212
|
+
"--reduce-security-for-testing",
|
|
213
|
+
"--remote-allow-origins=*",
|
|
214
|
+
`--remote-debugging-port=3234`,
|
|
215
|
+
"--unsafely-treat-insecure-origin-as-secure=*",
|
|
216
|
+
// "--disable-features=IsolateOrigins,site-per-process",
|
|
217
|
+
// "--disable-features=IsolateOrigins",
|
|
218
|
+
// "--disk-cache-dir=/dev/null",
|
|
219
|
+
// "--disk-cache-size=1",
|
|
220
|
+
// "--no-zygote",
|
|
221
|
+
// "--remote-allow-origins=ws://localhost:3234",
|
|
222
|
+
// "--single-process",
|
|
223
|
+
// "--start-maximized",
|
|
224
|
+
// "--unsafely-treat-insecure-origin-as-secure",
|
|
225
|
+
// "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
|
|
226
|
+
],
|
|
227
|
+
})) as any;
|
|
300
228
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
229
|
+
const { nodeEntryPoints, webEntryPoints, importEntryPoints } =
|
|
230
|
+
this.getRunnables(this.configs.tests, this.name);
|
|
231
|
+
|
|
232
|
+
[
|
|
233
|
+
[
|
|
234
|
+
nodeEntryPoints,
|
|
235
|
+
this.launchNode,
|
|
236
|
+
"node",
|
|
237
|
+
(w) => {
|
|
238
|
+
this.nodeMetafileWatcher = w;
|
|
239
|
+
},
|
|
240
|
+
],
|
|
241
|
+
[
|
|
242
|
+
webEntryPoints,
|
|
243
|
+
this.launchWeb,
|
|
244
|
+
"web",
|
|
245
|
+
(w) => {
|
|
246
|
+
this.webMetafileWatcher = w;
|
|
247
|
+
},
|
|
248
|
+
],
|
|
249
|
+
[
|
|
250
|
+
importEntryPoints,
|
|
251
|
+
this.launchPure,
|
|
252
|
+
"pure",
|
|
253
|
+
(w) => {
|
|
254
|
+
this.importMetafileWatcher = w;
|
|
255
|
+
},
|
|
256
|
+
],
|
|
257
|
+
].forEach(
|
|
258
|
+
async ([eps, launcher, runtime, watcher]: [
|
|
259
|
+
Record<string, string>,
|
|
260
|
+
(src: string, dest: string) => Promise<void>,
|
|
261
|
+
IRunTime,
|
|
262
|
+
(f: fs.FSWatcher) => void
|
|
263
|
+
]) => {
|
|
264
|
+
const metafile = `./testeranto/bundles/${runtime}/${this.name}/metafile.json`;
|
|
265
|
+
|
|
266
|
+
await pollForFile(metafile);
|
|
267
|
+
|
|
268
|
+
Object.entries(eps).forEach(
|
|
269
|
+
async ([k, outputFile]: [string, string]) => {
|
|
270
|
+
// await pollForFile(outputFile);
|
|
271
|
+
|
|
272
|
+
launcher(k, outputFile);
|
|
273
|
+
try {
|
|
274
|
+
watch(outputFile, async (e, filename) => {
|
|
275
|
+
const hash = await fileHash(outputFile);
|
|
276
|
+
if (fileHashes[k] !== hash) {
|
|
277
|
+
fileHashes[k] = hash;
|
|
278
|
+
console.log(ansiC.green(ansiC.inverse(`< ${e} ${filename}`)));
|
|
279
|
+
launcher(k, outputFile);
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
} catch (e) {
|
|
283
|
+
console.error(e);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
);
|
|
305
287
|
|
|
306
|
-
|
|
288
|
+
this.metafileOutputs(runtime);
|
|
307
289
|
|
|
308
|
-
|
|
309
|
-
|
|
290
|
+
watcher(
|
|
291
|
+
watch(metafile, async (e, filename) => {
|
|
292
|
+
console.log(
|
|
293
|
+
ansiC.green(ansiC.inverse(`< ${e} ${filename} (${runtime})`))
|
|
294
|
+
);
|
|
295
|
+
this.metafileOutputs(runtime);
|
|
296
|
+
})
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
);
|
|
310
300
|
}
|
|
311
301
|
|
|
312
|
-
stop
|
|
302
|
+
async stop() {
|
|
313
303
|
console.log(ansiC.inverse("Testeranto-Run is shutting down gracefully..."));
|
|
314
|
-
this.mode = "
|
|
304
|
+
this.mode = "once";
|
|
315
305
|
this.nodeMetafileWatcher.close();
|
|
316
306
|
this.webMetafileWatcher.close();
|
|
307
|
+
this.importMetafileWatcher.close();
|
|
317
308
|
this.checkForShutdown();
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
customclose() {
|
|
321
|
-
throw new Error("Method not implemented.");
|
|
322
|
-
}
|
|
323
|
-
waitForSelector(p: string, s: string): any {
|
|
324
|
-
throw new Error("Method not implemented.");
|
|
325
|
-
}
|
|
326
|
-
closePage(p): any {
|
|
327
|
-
throw new Error("Method not implemented.");
|
|
328
|
-
}
|
|
329
|
-
newPage(): CdpPage {
|
|
330
|
-
throw new Error("Method not implemented.");
|
|
331
|
-
}
|
|
332
|
-
goto(p, url: string): any {
|
|
333
|
-
throw new Error("Method not implemented.");
|
|
334
|
-
}
|
|
335
|
-
$(selector: string): boolean {
|
|
336
|
-
throw new Error("Method not implemented.");
|
|
337
|
-
}
|
|
338
|
-
screencast(opts: object) {
|
|
339
|
-
throw new Error("Method not implemented.");
|
|
340
|
-
}
|
|
341
|
-
customScreenShot(opts: object, cdpPage?: CdpPage) {
|
|
342
|
-
throw new Error("Method not implemented.");
|
|
343
|
-
}
|
|
344
|
-
end(accessObject: { uid: number }): boolean {
|
|
345
|
-
throw new Error("Method not implemented.");
|
|
346
|
-
}
|
|
347
|
-
existsSync(destFolder: string): boolean {
|
|
348
|
-
return fs.existsSync(destFolder);
|
|
349
309
|
}
|
|
350
310
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
}
|
|
311
|
+
getRunnables = (
|
|
312
|
+
tests: ITestTypes[],
|
|
313
|
+
testName: string,
|
|
314
|
+
payload = {
|
|
315
|
+
nodeEntryPoints: {},
|
|
316
|
+
webEntryPoints: {},
|
|
317
|
+
importEntryPoints: {},
|
|
356
318
|
}
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
writeFileSync(fp: string, contents: string) {
|
|
361
|
-
fs.writeFileSync(fp, contents);
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
createWriteStream(filepath: string): fs.WriteStream {
|
|
365
|
-
return fs.createWriteStream(filepath);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
testArtiFactoryfileWriter(tLog: ITLog, callback: (Promise) => void) {
|
|
369
|
-
return (fPath, value: string | Buffer | PassThrough) => {
|
|
370
|
-
callback(
|
|
371
|
-
new Promise<void>((res, rej) => {
|
|
372
|
-
tLog("testArtiFactory =>", fPath);
|
|
373
|
-
|
|
374
|
-
const cleanPath = path.resolve(fPath);
|
|
375
|
-
fPaths.push(cleanPath.replace(process.cwd(), ``));
|
|
376
|
-
|
|
377
|
-
const targetDir = cleanPath.split("/").slice(0, -1).join("/");
|
|
378
|
-
|
|
379
|
-
fs.mkdir(targetDir, { recursive: true }, async (error) => {
|
|
380
|
-
if (error) {
|
|
381
|
-
console.error(`❗️testArtiFactory failed`, targetDir, error);
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
fs.writeFileSync(
|
|
385
|
-
path.resolve(
|
|
386
|
-
targetDir.split("/").slice(0, -1).join("/"),
|
|
387
|
-
"manifest"
|
|
388
|
-
),
|
|
389
|
-
fPaths.join(`\n`),
|
|
390
|
-
{
|
|
391
|
-
encoding: "utf-8",
|
|
392
|
-
}
|
|
393
|
-
);
|
|
394
|
-
|
|
395
|
-
if (Buffer.isBuffer(value)) {
|
|
396
|
-
fs.writeFileSync(fPath, value, "binary");
|
|
397
|
-
res();
|
|
398
|
-
} else if (`string` === typeof value) {
|
|
399
|
-
fs.writeFileSync(fPath, value.toString(), {
|
|
400
|
-
encoding: "utf-8",
|
|
401
|
-
});
|
|
402
|
-
res();
|
|
403
|
-
} else {
|
|
404
|
-
/* @ts-ignore:next-line */
|
|
405
|
-
const pipeStream: PassThrough = value;
|
|
406
|
-
const myFile = fs.createWriteStream(fPath);
|
|
407
|
-
pipeStream.pipe(myFile);
|
|
408
|
-
pipeStream.on("close", () => {
|
|
409
|
-
myFile.close();
|
|
410
|
-
res();
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
});
|
|
414
|
-
})
|
|
415
|
-
);
|
|
416
|
-
};
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
write(accessObject: { uid: number }, contents: string): boolean {
|
|
420
|
-
throw new Error("Method not implemented.");
|
|
421
|
-
}
|
|
422
|
-
page(): string | undefined {
|
|
423
|
-
throw new Error("Method not implemented.");
|
|
424
|
-
}
|
|
425
|
-
click(selector: string): string | undefined {
|
|
426
|
-
throw new Error("Method not implemented.");
|
|
427
|
-
}
|
|
428
|
-
focusOn(selector: string) {
|
|
429
|
-
throw new Error("Method not implemented.");
|
|
430
|
-
}
|
|
431
|
-
typeInto(value: string) {
|
|
432
|
-
throw new Error("Method not implemented.");
|
|
433
|
-
}
|
|
434
|
-
getValue(value: string) {
|
|
435
|
-
throw new Error("Method not implemented.");
|
|
436
|
-
}
|
|
437
|
-
getAttribute(selector: string, attribute: string) {
|
|
438
|
-
throw new Error("Method not implemented.");
|
|
439
|
-
}
|
|
440
|
-
isDisabled(selector: string): Promise<boolean> {
|
|
441
|
-
throw new Error("Method not implemented.");
|
|
442
|
-
}
|
|
443
|
-
screencastStop(s: string) {
|
|
444
|
-
throw new Error("Method not implemented.");
|
|
445
|
-
}
|
|
446
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
319
|
+
): IRunnables => {
|
|
320
|
+
return getRunnables(tests, testName, payload);
|
|
321
|
+
};
|
|
447
322
|
|
|
448
|
-
async metafileOutputs(platform:
|
|
323
|
+
async metafileOutputs(platform: IRunTime) {
|
|
449
324
|
const metafile = JSON.parse(
|
|
450
|
-
fs
|
|
325
|
+
fs
|
|
326
|
+
.readFileSync(
|
|
327
|
+
`./testeranto/bundles/${platform}/${this.name}/metafile.json`
|
|
328
|
+
)
|
|
329
|
+
.toString()
|
|
451
330
|
).metafile;
|
|
452
331
|
|
|
453
332
|
if (!metafile) return;
|
|
@@ -487,139 +366,37 @@ export class PM_Main extends PM {
|
|
|
487
366
|
});
|
|
488
367
|
}
|
|
489
368
|
|
|
490
|
-
async start(): Promise<any> {
|
|
491
|
-
this.browser = (await puppeteer.launch({
|
|
492
|
-
slowMo: 1,
|
|
493
|
-
// timeout: 1,
|
|
494
|
-
waitForInitialPage: false,
|
|
495
|
-
executablePath:
|
|
496
|
-
// process.env.CHROMIUM_PATH || "/opt/homebrew/bin/chromium",
|
|
497
|
-
"/opt/homebrew/bin/chromium",
|
|
498
|
-
headless: true,
|
|
499
|
-
dumpio: true,
|
|
500
|
-
// timeout: 0,
|
|
501
|
-
devtools: true,
|
|
502
|
-
|
|
503
|
-
args: [
|
|
504
|
-
"--auto-open-devtools-for-tabs",
|
|
505
|
-
`--remote-debugging-port=3234`,
|
|
506
|
-
|
|
507
|
-
// "--disable-features=IsolateOrigins,site-per-process",
|
|
508
|
-
"--disable-site-isolation-trials",
|
|
509
|
-
"--allow-insecure-localhost",
|
|
510
|
-
"--allow-file-access-from-files",
|
|
511
|
-
"--allow-running-insecure-content",
|
|
512
|
-
|
|
513
|
-
"--disable-dev-shm-usage",
|
|
514
|
-
"--disable-extensions",
|
|
515
|
-
"--disable-gpu",
|
|
516
|
-
"--disable-setuid-sandbox",
|
|
517
|
-
"--disable-site-isolation-trials",
|
|
518
|
-
"--disable-web-security",
|
|
519
|
-
"--no-first-run",
|
|
520
|
-
"--no-sandbox",
|
|
521
|
-
"--no-startup-window",
|
|
522
|
-
// "--no-zygote",
|
|
523
|
-
"--reduce-security-for-testing",
|
|
524
|
-
"--remote-allow-origins=*",
|
|
525
|
-
"--unsafely-treat-insecure-origin-as-secure=*",
|
|
526
|
-
// "--disable-features=IsolateOrigins",
|
|
527
|
-
// "--remote-allow-origins=ws://localhost:3234",
|
|
528
|
-
// "--single-process",
|
|
529
|
-
// "--unsafely-treat-insecure-origin-as-secure",
|
|
530
|
-
// "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
|
|
531
|
-
|
|
532
|
-
// "--disk-cache-dir=/dev/null",
|
|
533
|
-
// "--disk-cache-size=1",
|
|
534
|
-
// "--start-maximized",
|
|
535
|
-
],
|
|
536
|
-
})) as any;
|
|
537
|
-
|
|
538
|
-
const { nodeEntryPoints, webEntryPoints } = getRunnables(
|
|
539
|
-
this.configs.tests
|
|
540
|
-
);
|
|
541
|
-
|
|
542
|
-
Object.entries(nodeEntryPoints).forEach(
|
|
543
|
-
([k, outputFile]: [string, string]) => {
|
|
544
|
-
this.launchNode(k, outputFile);
|
|
545
|
-
try {
|
|
546
|
-
watch(outputFile, async (e, filename) => {
|
|
547
|
-
const hash = await fileHash(outputFile);
|
|
548
|
-
if (fileHashes[k] !== hash) {
|
|
549
|
-
fileHashes[k] = hash;
|
|
550
|
-
console.log(ansiC.green(ansiC.inverse(`< ${e} ${filename}`)));
|
|
551
|
-
this.launchNode(k, outputFile);
|
|
552
|
-
}
|
|
553
|
-
});
|
|
554
|
-
} catch (e) {
|
|
555
|
-
console.error(e);
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
);
|
|
559
|
-
|
|
560
|
-
Object.entries(webEntryPoints).forEach(
|
|
561
|
-
([k, outputFile]: [string, string]) => {
|
|
562
|
-
this.launchWeb(k, outputFile);
|
|
563
|
-
watch(outputFile, async (e, filename) => {
|
|
564
|
-
const hash = await fileHash(outputFile);
|
|
565
|
-
if (fileHashes[k] !== hash) {
|
|
566
|
-
fileHashes[k] = hash;
|
|
567
|
-
console.log(ansiC.green(ansiC.inverse(`< ${e} ${filename}`)));
|
|
568
|
-
this.launchWeb(k, outputFile);
|
|
569
|
-
}
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
|
-
);
|
|
573
|
-
|
|
574
|
-
this.metafileOutputs("node");
|
|
575
|
-
this.nodeMetafileWatcher = watch(
|
|
576
|
-
"docs/node/metafile.json",
|
|
577
|
-
async (e, filename) => {
|
|
578
|
-
console.log(ansiC.green(ansiC.inverse(`< ${e} ${filename} (node)`)));
|
|
579
|
-
this.metafileOutputs("node");
|
|
580
|
-
}
|
|
581
|
-
);
|
|
582
|
-
|
|
583
|
-
this.metafileOutputs("web");
|
|
584
|
-
this.webMetafileWatcher = watch(
|
|
585
|
-
"docs/web/metafile.json",
|
|
586
|
-
async (e, filename) => {
|
|
587
|
-
console.log(ansiC.green(ansiC.inverse(`< ${e} ${filename} (web)`)));
|
|
588
|
-
this.metafileOutputs("web");
|
|
589
|
-
}
|
|
590
|
-
);
|
|
591
|
-
}
|
|
592
|
-
|
|
593
369
|
tscCheck = async ({
|
|
594
370
|
entrypoint,
|
|
595
371
|
addableFiles,
|
|
596
372
|
platform,
|
|
597
373
|
}: {
|
|
598
|
-
platform:
|
|
374
|
+
platform: IRunTime;
|
|
599
375
|
entrypoint: string;
|
|
600
376
|
addableFiles: string[];
|
|
601
377
|
}) => {
|
|
602
378
|
console.log(ansiC.green(ansiC.inverse(`tsc < ${entrypoint}`)));
|
|
603
|
-
this.
|
|
379
|
+
this.typeCheckIsRunning(entrypoint);
|
|
604
380
|
|
|
605
381
|
const program = tsc.createProgramFromConfig({
|
|
606
382
|
basePath: process.cwd(), // always required, used for relative paths
|
|
607
383
|
configFilePath: "tsconfig.json", // config to inherit from (optional)
|
|
608
384
|
compilerOptions: {
|
|
609
385
|
rootDir: "src",
|
|
610
|
-
outDir: tscPather(entrypoint, platform),
|
|
386
|
+
outDir: tscPather(entrypoint, platform, this.name),
|
|
611
387
|
// declaration: true,
|
|
612
388
|
// skipLibCheck: true,
|
|
613
389
|
noEmit: true,
|
|
614
390
|
},
|
|
615
391
|
include: addableFiles, //["src/**/*"],
|
|
392
|
+
// exclude: ["node_modules", "../testeranto"],
|
|
616
393
|
// exclude: ["**/*.test.ts", "**/*.spec.ts"],
|
|
617
394
|
});
|
|
618
|
-
const tscPath = tscPather(entrypoint, platform);
|
|
395
|
+
const tscPath = tscPather(entrypoint, platform, this.name);
|
|
619
396
|
|
|
620
397
|
let allDiagnostics = program.getSemanticDiagnostics();
|
|
621
398
|
|
|
622
|
-
const
|
|
399
|
+
const results: string[] = [];
|
|
623
400
|
allDiagnostics.forEach((diagnostic) => {
|
|
624
401
|
if (diagnostic.file) {
|
|
625
402
|
let { line, character } = ts.getLineAndCharacterOfPosition(
|
|
@@ -630,34 +407,31 @@ export class PM_Main extends PM {
|
|
|
630
407
|
diagnostic.messageText,
|
|
631
408
|
"\n"
|
|
632
409
|
);
|
|
633
|
-
|
|
410
|
+
results.push(
|
|
634
411
|
`${diagnostic.file.fileName} (${line + 1},${
|
|
635
412
|
character + 1
|
|
636
413
|
}): ${message}`
|
|
637
414
|
);
|
|
638
415
|
} else {
|
|
639
|
-
|
|
416
|
+
results.push(
|
|
417
|
+
ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")
|
|
418
|
+
);
|
|
640
419
|
}
|
|
641
420
|
});
|
|
642
421
|
|
|
643
|
-
fs.writeFileSync(tscPath,
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
this.checkForShutdown();
|
|
647
|
-
}
|
|
648
|
-
// fs.writeFileSync(
|
|
649
|
-
// tscExitCodePather(entrypoint, platform),
|
|
650
|
-
// d.length.toString()
|
|
651
|
-
// );
|
|
422
|
+
fs.writeFileSync(tscPath, results.join("\n"));
|
|
423
|
+
|
|
424
|
+
this.typeCheckIsNowDone(entrypoint, results.length);
|
|
652
425
|
};
|
|
653
426
|
|
|
654
427
|
eslintCheck = async (
|
|
655
428
|
entrypoint: string,
|
|
656
|
-
platform:
|
|
429
|
+
platform: IRunTime,
|
|
657
430
|
addableFiles: string[]
|
|
658
431
|
) => {
|
|
659
|
-
this.bigBoard[entrypoint].staticErrors = "?";
|
|
660
432
|
console.log(ansiC.green(ansiC.inverse(`eslint < ${entrypoint}`)));
|
|
433
|
+
this.lintIsRunning(entrypoint);
|
|
434
|
+
|
|
661
435
|
const results = (await eslint.lintFiles(addableFiles))
|
|
662
436
|
.filter((r) => r.messages.length)
|
|
663
437
|
.filter((r) => {
|
|
@@ -669,41 +443,33 @@ export class PM_Main extends PM {
|
|
|
669
443
|
});
|
|
670
444
|
|
|
671
445
|
fs.writeFileSync(
|
|
672
|
-
lintPather(entrypoint, platform),
|
|
446
|
+
lintPather(entrypoint, platform, this.name),
|
|
673
447
|
await formatter.format(results)
|
|
674
448
|
);
|
|
675
|
-
this.
|
|
676
|
-
if (this.shutdownMode) {
|
|
677
|
-
this.checkForShutdown();
|
|
678
|
-
}
|
|
679
|
-
// fs.writeFileSync(
|
|
680
|
-
// lintExitCodePather(entrypoint, platform),
|
|
681
|
-
// results.length.toString()
|
|
682
|
-
// );
|
|
449
|
+
this.lintIsNowDone(entrypoint, results.length);
|
|
683
450
|
};
|
|
684
451
|
|
|
685
452
|
makePrompt = async (
|
|
686
453
|
entryPoint: string,
|
|
687
454
|
addableFiles: string[],
|
|
688
|
-
platform:
|
|
455
|
+
platform: IRunTime
|
|
689
456
|
) => {
|
|
690
457
|
this.bigBoard[entryPoint].prompt = "?";
|
|
691
|
-
const promptPath =
|
|
692
|
-
"./docs/",
|
|
693
|
-
platform,
|
|
694
|
-
entryPoint.split(".").slice(0, -1).join("."),
|
|
695
|
-
`prompt.txt`
|
|
696
|
-
);
|
|
458
|
+
const promptPath = promptPather(entryPoint, platform, this.name);
|
|
697
459
|
|
|
698
460
|
const testPaths = path.join(
|
|
699
|
-
"
|
|
461
|
+
"testeranto",
|
|
462
|
+
"reports",
|
|
463
|
+
this.name,
|
|
700
464
|
platform,
|
|
701
465
|
entryPoint.split(".").slice(0, -1).join("."),
|
|
702
466
|
`tests.json`
|
|
703
467
|
);
|
|
704
468
|
|
|
705
469
|
const featuresPath = path.join(
|
|
706
|
-
"
|
|
470
|
+
"testeranto",
|
|
471
|
+
"reports",
|
|
472
|
+
this.name,
|
|
707
473
|
platform,
|
|
708
474
|
entryPoint.split(".").slice(0, -1).join("."),
|
|
709
475
|
`featurePrompt.txt`
|
|
@@ -718,71 +484,122 @@ ${addableFiles
|
|
|
718
484
|
})
|
|
719
485
|
.join("\n")}
|
|
720
486
|
|
|
721
|
-
/read ${lintPather(entryPoint, platform)}
|
|
722
|
-
/read ${tscPather(entryPoint, platform)}
|
|
487
|
+
/read ${lintPather(entryPoint, platform, this.name)}
|
|
488
|
+
/read ${tscPather(entryPoint, platform, this.name)}
|
|
723
489
|
/read ${testPaths}
|
|
724
490
|
|
|
725
491
|
/load ${featuresPath}
|
|
726
492
|
|
|
727
493
|
/code Fix the failing tests described in ${testPaths}. Correct any type signature errors described in the files ${tscPather(
|
|
728
494
|
entryPoint,
|
|
729
|
-
platform
|
|
495
|
+
platform,
|
|
496
|
+
this.name
|
|
730
497
|
)}. Implement any method which throws "Function not implemented. Resolve the lint errors described in ${lintPather(
|
|
731
498
|
entryPoint,
|
|
732
|
-
platform
|
|
499
|
+
platform,
|
|
500
|
+
this.name
|
|
733
501
|
)}"
|
|
734
502
|
`
|
|
735
503
|
);
|
|
736
504
|
this.bigBoard[
|
|
737
505
|
entryPoint
|
|
738
|
-
].prompt = `aider --model deepseek/deepseek-chat --load
|
|
506
|
+
].prompt = `aider --model deepseek/deepseek-chat --load testeranto/${
|
|
507
|
+
this.name
|
|
508
|
+
}/reports/${platform}/${entryPoint
|
|
739
509
|
.split(".")
|
|
740
510
|
.slice(0, -1)
|
|
741
511
|
.join(".")}/prompt.txt`;
|
|
742
|
-
|
|
743
|
-
this.checkForShutdown();
|
|
744
|
-
}
|
|
512
|
+
this.checkForShutdown();
|
|
745
513
|
};
|
|
746
514
|
|
|
747
515
|
checkForShutdown = () => {
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
}
|
|
516
|
+
this.writeBigBoard();
|
|
517
|
+
|
|
518
|
+
if (this.mode === "dev") return;
|
|
519
|
+
|
|
520
|
+
let inflight = false;
|
|
521
|
+
|
|
522
|
+
Object.keys(this.bigBoard).forEach((k) => {
|
|
523
|
+
if (this.bigBoard[k].prompt === "?") {
|
|
524
|
+
console.log(ansiC.blue(ansiC.inverse(`🕕 prompt ${k}`)));
|
|
525
|
+
inflight = true;
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
Object.keys(this.bigBoard).forEach((k) => {
|
|
530
|
+
if (this.bigBoard[k].runTimeError === "?") {
|
|
531
|
+
console.log(ansiC.blue(ansiC.inverse(`🕕 runTimeError ${k}`)));
|
|
532
|
+
inflight = true;
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
|
|
536
|
+
Object.keys(this.bigBoard).forEach((k) => {
|
|
537
|
+
if (this.bigBoard[k].staticErrors === "?") {
|
|
538
|
+
console.log(ansiC.blue(ansiC.inverse(`🕕 staticErrors ${k}`)));
|
|
539
|
+
inflight = true;
|
|
540
|
+
}
|
|
541
|
+
});
|
|
542
|
+
|
|
543
|
+
Object.keys(this.bigBoard).forEach((k) => {
|
|
544
|
+
if (this.bigBoard[k].typeErrors === "?") {
|
|
545
|
+
console.log(ansiC.blue(ansiC.inverse(`🕕 typeErrors ${k}`)));
|
|
546
|
+
inflight = true;
|
|
547
|
+
}
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
this.writeBigBoard();
|
|
551
|
+
|
|
552
|
+
if (!inflight) {
|
|
760
553
|
this.browser.disconnect().then(() => {
|
|
761
|
-
|
|
762
|
-
"docs/summary.json",
|
|
763
|
-
JSON.stringify(this.bigBoard, null, 2)
|
|
764
|
-
);
|
|
765
|
-
console.log(ansiC.inverse("Goodbye"));
|
|
554
|
+
console.log(ansiC.inverse(`${this.name} has been tested. Goodbye.`));
|
|
766
555
|
process.exit();
|
|
767
556
|
});
|
|
768
557
|
}
|
|
769
558
|
};
|
|
770
559
|
|
|
771
|
-
|
|
772
|
-
this.bigBoard[src].
|
|
560
|
+
typeCheckIsRunning = (src: string) => {
|
|
561
|
+
this.bigBoard[src].typeErrors = "?";
|
|
773
562
|
};
|
|
774
563
|
|
|
775
|
-
|
|
776
|
-
this.bigBoard[src].
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
}
|
|
564
|
+
typeCheckIsNowDone = (src: string, failures: number) => {
|
|
565
|
+
this.bigBoard[src].typeErrors = failures;
|
|
566
|
+
this.writeBigBoard();
|
|
567
|
+
this.checkForShutdown();
|
|
780
568
|
};
|
|
781
569
|
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
570
|
+
lintIsRunning = (src: string) => {
|
|
571
|
+
this.bigBoard[src].staticErrors = "?";
|
|
572
|
+
this.writeBigBoard();
|
|
573
|
+
};
|
|
574
|
+
|
|
575
|
+
lintIsNowDone = (src: string, failures: number) => {
|
|
576
|
+
this.bigBoard[src].staticErrors = failures;
|
|
577
|
+
this.writeBigBoard();
|
|
578
|
+
this.checkForShutdown();
|
|
579
|
+
};
|
|
580
|
+
|
|
581
|
+
bddTestIsRunning = (src: string) => {
|
|
582
|
+
this.bigBoard[src].runTimeError = "?";
|
|
583
|
+
this.writeBigBoard();
|
|
584
|
+
};
|
|
585
|
+
|
|
586
|
+
bddTestIsNowDone = (src: string, failures: number) => {
|
|
587
|
+
this.bigBoard[src].runTimeError = failures;
|
|
588
|
+
this.writeBigBoard();
|
|
589
|
+
this.checkForShutdown();
|
|
590
|
+
};
|
|
591
|
+
|
|
592
|
+
launchPure = async (src: string, dest: string) => {
|
|
593
|
+
console.log(ansiC.green(ansiC.inverse(`! pure, ${src}`)));
|
|
594
|
+
this.bddTestIsRunning(src);
|
|
595
|
+
|
|
596
|
+
const reportDest = `testeranto/reports/${this.name}/${src
|
|
597
|
+
.split(".")
|
|
598
|
+
.slice(0, -1)
|
|
599
|
+
.join(".")}/pure`;
|
|
600
|
+
if (!fs.existsSync(reportDest)) {
|
|
601
|
+
fs.mkdirSync(reportDest, { recursive: true });
|
|
602
|
+
}
|
|
786
603
|
|
|
787
604
|
const destFolder = dest.replace(".mjs", "");
|
|
788
605
|
|
|
@@ -804,7 +621,7 @@ ${addableFiles
|
|
|
804
621
|
scheduled: true,
|
|
805
622
|
name: src,
|
|
806
623
|
ports: portsToUse,
|
|
807
|
-
fs:
|
|
624
|
+
fs: reportDest,
|
|
808
625
|
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
809
626
|
});
|
|
810
627
|
} else if (testConfigResource.ports > 0) {
|
|
@@ -822,7 +639,6 @@ ${addableFiles
|
|
|
822
639
|
argz = JSON.stringify({
|
|
823
640
|
scheduled: true,
|
|
824
641
|
name: src,
|
|
825
|
-
// ports: [3333],
|
|
826
642
|
ports: portsToUse,
|
|
827
643
|
fs: destFolder,
|
|
828
644
|
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
@@ -840,6 +656,11 @@ ${addableFiles
|
|
|
840
656
|
|
|
841
657
|
const webSideCares: Page[] = [];
|
|
842
658
|
|
|
659
|
+
// fs.writeFileSync(
|
|
660
|
+
// `${reportDest}/stdlog.txt`,
|
|
661
|
+
// "THIS FILE IS AUTO GENERATED. IT IS PURPOSEFULLY LEFT BLANK."
|
|
662
|
+
// );
|
|
663
|
+
|
|
843
664
|
// await Promise.all(
|
|
844
665
|
// testConfig[3].map(async (sidecar) => {
|
|
845
666
|
// if (sidecar[1] === "web") {
|
|
@@ -862,25 +683,21 @@ ${addableFiles
|
|
|
862
683
|
// })
|
|
863
684
|
// );
|
|
864
685
|
|
|
865
|
-
|
|
866
|
-
`${builtfile}?cacheBust=${Date.now()}`
|
|
867
|
-
).then((module) => {
|
|
686
|
+
await import(`${builtfile}?cacheBust=${Date.now()}`).then((module) => {
|
|
868
687
|
return module.default.then((defaultModule) => {
|
|
869
688
|
defaultModule
|
|
870
689
|
.receiveTestResourceConfig(argz)
|
|
871
|
-
.then(async (
|
|
872
|
-
this.receiveFeatures(features, destFolder, src);
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
this.receiveExitCode(src, failed);
|
|
690
|
+
.then(async (results: IFinalResults) => {
|
|
691
|
+
this.receiveFeatures(results.features, destFolder, src, "pure");
|
|
692
|
+
statusMessagePretty(results.fails, src);
|
|
693
|
+
this.bddTestIsNowDone(src, results.fails);
|
|
876
694
|
})
|
|
877
695
|
.catch((e) => {
|
|
878
696
|
console.log(ansiC.red(ansiC.inverse(`${src} errored with: ${e}`)));
|
|
879
|
-
|
|
697
|
+
this.bddTestIsNowDone(src, -1);
|
|
880
698
|
})
|
|
881
699
|
.finally(() => {
|
|
882
700
|
webSideCares.forEach((webSideCar) => webSideCar.close());
|
|
883
|
-
this.testIsNowDone(src);
|
|
884
701
|
});
|
|
885
702
|
});
|
|
886
703
|
});
|
|
@@ -893,6 +710,188 @@ ${addableFiles
|
|
|
893
710
|
}
|
|
894
711
|
};
|
|
895
712
|
|
|
713
|
+
launchNode = async (src: string, dest: string) => {
|
|
714
|
+
console.log(ansiC.green(ansiC.inverse(`! node, ${src}`)));
|
|
715
|
+
this.bddTestIsRunning(src);
|
|
716
|
+
|
|
717
|
+
const reportDest = `testeranto/reports/${this.name}/${src
|
|
718
|
+
.split(".")
|
|
719
|
+
.slice(0, -1)
|
|
720
|
+
.join(".")}/node`;
|
|
721
|
+
if (!fs.existsSync(reportDest)) {
|
|
722
|
+
fs.mkdirSync(reportDest, { recursive: true });
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
const destFolder = dest.replace(".mjs", "");
|
|
726
|
+
|
|
727
|
+
let testResources = "";
|
|
728
|
+
|
|
729
|
+
const testConfig = this.configs.tests.find((t) => {
|
|
730
|
+
return t[0] === src;
|
|
731
|
+
});
|
|
732
|
+
|
|
733
|
+
if (!testConfig) {
|
|
734
|
+
console.log(ansiC.inverse("missing test config! Exiting ungracefully!"));
|
|
735
|
+
process.exit(-1);
|
|
736
|
+
}
|
|
737
|
+
const testConfigResource = testConfig[2];
|
|
738
|
+
|
|
739
|
+
let portsToUse: string[] = [];
|
|
740
|
+
if (testConfigResource.ports === 0) {
|
|
741
|
+
testResources = JSON.stringify({
|
|
742
|
+
scheduled: true,
|
|
743
|
+
name: src,
|
|
744
|
+
ports: portsToUse,
|
|
745
|
+
fs: reportDest,
|
|
746
|
+
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
747
|
+
});
|
|
748
|
+
} else if (testConfigResource.ports > 0) {
|
|
749
|
+
const openPorts = Object.entries(this.ports).filter(
|
|
750
|
+
([portnumber, portopen]) => portopen
|
|
751
|
+
);
|
|
752
|
+
|
|
753
|
+
if (openPorts.length >= testConfigResource.ports) {
|
|
754
|
+
for (let i = 0; i < testConfigResource.ports; i++) {
|
|
755
|
+
portsToUse.push(openPorts[i][0]);
|
|
756
|
+
|
|
757
|
+
this.ports[openPorts[i][0]] = false; // port is now closed
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
testResources = JSON.stringify({
|
|
761
|
+
scheduled: true,
|
|
762
|
+
name: src,
|
|
763
|
+
ports: portsToUse,
|
|
764
|
+
fs: destFolder,
|
|
765
|
+
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
766
|
+
});
|
|
767
|
+
} else {
|
|
768
|
+
this.queue.push(src);
|
|
769
|
+
return;
|
|
770
|
+
}
|
|
771
|
+
} else {
|
|
772
|
+
console.error("negative port makes no sense", src);
|
|
773
|
+
process.exit(-1);
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
const builtfile = dest;
|
|
777
|
+
|
|
778
|
+
// const webSideCares: Page[] = [];
|
|
779
|
+
|
|
780
|
+
// await Promise.all(
|
|
781
|
+
// testConfig[3].map(async (sidecar) => {
|
|
782
|
+
// if (sidecar[1] === "web") {
|
|
783
|
+
// const s = await this.launchWebSideCar(
|
|
784
|
+
// sidecar[0],
|
|
785
|
+
// destinationOfRuntime(sidecar[0], "web", this.configs),
|
|
786
|
+
// sidecar
|
|
787
|
+
// );
|
|
788
|
+
// webSideCares.push(s);
|
|
789
|
+
// return s;
|
|
790
|
+
// }
|
|
791
|
+
|
|
792
|
+
// if (sidecar[1] === "node") {
|
|
793
|
+
// return this.launchNodeSideCar(
|
|
794
|
+
// sidecar[0],
|
|
795
|
+
// destinationOfRuntime(sidecar[0], "node", this.configs),
|
|
796
|
+
// sidecar
|
|
797
|
+
// );
|
|
798
|
+
// }
|
|
799
|
+
// })
|
|
800
|
+
// );
|
|
801
|
+
|
|
802
|
+
// const f = fork(builtfile, [testResources], {
|
|
803
|
+
// silent: true,
|
|
804
|
+
// // detached: true,
|
|
805
|
+
// // stdio: "ignore",
|
|
806
|
+
// });
|
|
807
|
+
|
|
808
|
+
let haltReturns = false;
|
|
809
|
+
|
|
810
|
+
let buffer: Buffer<ArrayBufferLike> = new Buffer("");
|
|
811
|
+
const server = net.createServer((socket) => {
|
|
812
|
+
socket.on("data", (data) => {
|
|
813
|
+
buffer = Buffer.concat([buffer, data]);
|
|
814
|
+
|
|
815
|
+
let messages: string[][] = [];
|
|
816
|
+
for (let b = 0; b < buffer.length + 1; b++) {
|
|
817
|
+
let c = buffer.slice(0, b);
|
|
818
|
+
let d;
|
|
819
|
+
try {
|
|
820
|
+
d = JSON.parse(c.toString());
|
|
821
|
+
|
|
822
|
+
messages.push(d);
|
|
823
|
+
buffer = buffer.slice(b, buffer.length + 1);
|
|
824
|
+
b = 0;
|
|
825
|
+
} catch (e) {
|
|
826
|
+
// b++;
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
messages.forEach(async (payload) => {
|
|
831
|
+
// set up the "node" listeners
|
|
832
|
+
this.mapping().forEach(async ([command, func]) => {
|
|
833
|
+
if (payload[0] === command) {
|
|
834
|
+
const x = payload.slice(1, -1);
|
|
835
|
+
const r = await this[command](...x);
|
|
836
|
+
|
|
837
|
+
if (!haltReturns) {
|
|
838
|
+
child.send(
|
|
839
|
+
JSON.stringify({
|
|
840
|
+
payload: r,
|
|
841
|
+
key: payload[payload.length - 1],
|
|
842
|
+
})
|
|
843
|
+
);
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
});
|
|
847
|
+
});
|
|
848
|
+
});
|
|
849
|
+
});
|
|
850
|
+
|
|
851
|
+
const oStream = fs.createWriteStream(`${reportDest}/console_log.txt`);
|
|
852
|
+
|
|
853
|
+
const child = spawn("node", [builtfile, testResources], {
|
|
854
|
+
stdio: ["pipe", "pipe", "pipe", "ipc"],
|
|
855
|
+
// silent: true
|
|
856
|
+
});
|
|
857
|
+
|
|
858
|
+
const p = destFolder + "/pipe";
|
|
859
|
+
server.listen(p, () => {
|
|
860
|
+
child.stderr?.on("data", (data) => {
|
|
861
|
+
oStream.write(`stderr data ${data}`);
|
|
862
|
+
});
|
|
863
|
+
child.stdout?.on("data", (data) => {
|
|
864
|
+
oStream.write(`stdout data ${data}`);
|
|
865
|
+
});
|
|
866
|
+
child.on("close", (code) => {
|
|
867
|
+
oStream.close();
|
|
868
|
+
server.close();
|
|
869
|
+
|
|
870
|
+
if (code === null) {
|
|
871
|
+
this.bddTestIsNowDone(src, -1);
|
|
872
|
+
statusMessagePretty(-1, src);
|
|
873
|
+
} else if (code === 0) {
|
|
874
|
+
this.bddTestIsNowDone(src, 0);
|
|
875
|
+
statusMessagePretty(0, src);
|
|
876
|
+
} else {
|
|
877
|
+
this.bddTestIsNowDone(src, code);
|
|
878
|
+
statusMessagePretty(code, src);
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
// haltReturns = true;
|
|
882
|
+
});
|
|
883
|
+
child.on("exit", (code) => {});
|
|
884
|
+
});
|
|
885
|
+
|
|
886
|
+
child.send({ path: p });
|
|
887
|
+
|
|
888
|
+
for (let i = 0; i <= portsToUse.length; i++) {
|
|
889
|
+
if (portsToUse[i]) {
|
|
890
|
+
this.ports[portsToUse[i]] = "true"; //port is open again
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
};
|
|
894
|
+
|
|
896
895
|
launchWebSideCar = async (
|
|
897
896
|
src: string,
|
|
898
897
|
dest: string,
|
|
@@ -918,7 +917,6 @@ ${addableFiles
|
|
|
918
917
|
page.exposeFunction(
|
|
919
918
|
"custom-screenshot",
|
|
920
919
|
async (ssOpts: ScreenshotOptions, testName: string) => {
|
|
921
|
-
// console.log("main.ts browser custom-screenshot", testName);
|
|
922
920
|
const p = ssOpts.path as string;
|
|
923
921
|
const dir = path.dirname(p);
|
|
924
922
|
fs.mkdirSync(dir, {
|
|
@@ -935,10 +933,8 @@ ${addableFiles
|
|
|
935
933
|
screenshots[testName] = [];
|
|
936
934
|
}
|
|
937
935
|
screenshots[testName].push(sPromise);
|
|
938
|
-
// sPromise.then(())
|
|
939
936
|
await sPromise;
|
|
940
937
|
return sPromise;
|
|
941
|
-
// page.evaluate(`window["screenshot done"]`);
|
|
942
938
|
}
|
|
943
939
|
);
|
|
944
940
|
|
|
@@ -983,9 +979,6 @@ ${addableFiles
|
|
|
983
979
|
(fp: string, testName: string) => {
|
|
984
980
|
const f = fs.createWriteStream(fp);
|
|
985
981
|
|
|
986
|
-
// if (!files[testName]) {
|
|
987
|
-
// files[testName] = new Set();
|
|
988
|
-
// }
|
|
989
982
|
files[testName].add(fp);
|
|
990
983
|
|
|
991
984
|
const p = new Promise<string>((res, rej) => {
|
|
@@ -1014,24 +1007,12 @@ ${addableFiles
|
|
|
1014
1007
|
return fileStreams2[uid].end();
|
|
1015
1008
|
});
|
|
1016
1009
|
|
|
1017
|
-
// page.exposeFunction("customclose", (p: string, testName: string) => {
|
|
1018
|
-
// fs.writeFileSync(
|
|
1019
|
-
// p + "/manifest.json",
|
|
1020
|
-
// JSON.stringify(Array.from(files[testName]))
|
|
1021
|
-
// );
|
|
1022
|
-
// delete files[testName];
|
|
1023
|
-
|
|
1024
|
-
// Promise.all(screenshots[testName] || []).then(() => {
|
|
1025
|
-
// delete screenshots[testName];
|
|
1026
|
-
// // page.close();
|
|
1027
|
-
// });
|
|
1028
|
-
// });
|
|
1029
|
-
|
|
1030
1010
|
return page;
|
|
1031
1011
|
})
|
|
1032
1012
|
.then(async (page) => {
|
|
1033
1013
|
await page.goto(`file://${`${dest}.html`}`, {});
|
|
1034
1014
|
|
|
1015
|
+
/* @ts-ignore:next-line */
|
|
1035
1016
|
res(page);
|
|
1036
1017
|
});
|
|
1037
1018
|
});
|
|
@@ -1091,9 +1072,7 @@ ${addableFiles
|
|
|
1091
1072
|
|
|
1092
1073
|
const builtfile = dest + ".mjs";
|
|
1093
1074
|
|
|
1094
|
-
|
|
1095
|
-
`${builtfile}?cacheBust=${Date.now()}`
|
|
1096
|
-
).then((module) => {
|
|
1075
|
+
await import(`${builtfile}?cacheBust=${Date.now()}`).then((module) => {
|
|
1097
1076
|
return module.default.then((defaultModule) => {
|
|
1098
1077
|
// console.log("defaultModule", defaultModule);
|
|
1099
1078
|
const s = new defaultModule();
|
|
@@ -1119,27 +1098,24 @@ ${addableFiles
|
|
|
1119
1098
|
}
|
|
1120
1099
|
};
|
|
1121
1100
|
|
|
1122
|
-
launchWeb = (
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
// );
|
|
1134
|
-
// }
|
|
1135
|
-
// });
|
|
1101
|
+
launchWeb = async (src: string, dest: string) => {
|
|
1102
|
+
console.log(ansiC.green(ansiC.inverse(`! web ${src}`)));
|
|
1103
|
+
this.bddTestIsRunning(src);
|
|
1104
|
+
|
|
1105
|
+
const reportDest = `testeranto/reports/${this.name}/${src
|
|
1106
|
+
.split(".")
|
|
1107
|
+
.slice(0, -1)
|
|
1108
|
+
.join(".")}/web`;
|
|
1109
|
+
if (!fs.existsSync(reportDest)) {
|
|
1110
|
+
fs.mkdirSync(reportDest, { recursive: true });
|
|
1111
|
+
}
|
|
1136
1112
|
|
|
1137
1113
|
const destFolder = dest.replace(".mjs", "");
|
|
1138
1114
|
|
|
1139
1115
|
const webArgz = JSON.stringify({
|
|
1140
1116
|
name: dest,
|
|
1141
1117
|
ports: [].toString(),
|
|
1142
|
-
fs:
|
|
1118
|
+
fs: reportDest,
|
|
1143
1119
|
browserWSEndpoint: this.browser.wsEndpoint(),
|
|
1144
1120
|
});
|
|
1145
1121
|
|
|
@@ -1156,303 +1132,82 @@ ${addableFiles
|
|
|
1156
1132
|
}
|
|
1157
1133
|
})`;
|
|
1158
1134
|
|
|
1159
|
-
const
|
|
1160
|
-
const doneFileStream2: Promise<any>[] = [];
|
|
1161
|
-
|
|
1162
|
-
const stdoutStream = fs.createWriteStream(`${destFolder}/stdout.log`);
|
|
1163
|
-
const stderrStream = fs.createWriteStream(`${destFolder}/stderr.log`);
|
|
1135
|
+
const oStream = fs.createWriteStream(`${reportDest}/console_log.txt`);
|
|
1164
1136
|
|
|
1165
1137
|
this.browser
|
|
1166
1138
|
.newPage()
|
|
1167
1139
|
.then((page) => {
|
|
1168
|
-
//
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
page.exposeFunction(
|
|
1173
|
-
"screencast",
|
|
1174
|
-
async (ssOpts: ScreenshotOptions, testName: string) => {
|
|
1175
|
-
const p = ssOpts.path as string;
|
|
1176
|
-
const dir = path.dirname(p);
|
|
1177
|
-
fs.mkdirSync(dir, {
|
|
1178
|
-
recursive: true,
|
|
1179
|
-
});
|
|
1180
|
-
if (!files[testName]) {
|
|
1181
|
-
files[testName] = new Set();
|
|
1182
|
-
}
|
|
1183
|
-
files[testName].add(ssOpts.path as string);
|
|
1184
|
-
|
|
1185
|
-
const sPromise = page.screenshot({
|
|
1186
|
-
...ssOpts,
|
|
1187
|
-
path: p,
|
|
1188
|
-
});
|
|
1189
|
-
|
|
1190
|
-
if (!screenshots[testName]) {
|
|
1191
|
-
screenshots[testName] = [];
|
|
1192
|
-
}
|
|
1193
|
-
screenshots[testName].push(sPromise);
|
|
1194
|
-
// sPromise.then(())
|
|
1195
|
-
await sPromise;
|
|
1196
|
-
return sPromise;
|
|
1197
|
-
// page.evaluate(`window["screenshot done"]`);
|
|
1198
|
-
}
|
|
1199
|
-
);
|
|
1200
|
-
|
|
1201
|
-
page.exposeFunction(
|
|
1202
|
-
"customScreenShot",
|
|
1203
|
-
async (ssOpts: ScreenshotOptions, testName: string) => {
|
|
1204
|
-
const p = ssOpts.path as string;
|
|
1205
|
-
const dir = path.dirname(p);
|
|
1206
|
-
fs.mkdirSync(dir, {
|
|
1207
|
-
recursive: true,
|
|
1208
|
-
});
|
|
1209
|
-
if (!files[testName]) {
|
|
1210
|
-
files[testName] = new Set();
|
|
1211
|
-
}
|
|
1212
|
-
files[testName].add(ssOpts.path as string);
|
|
1213
|
-
|
|
1214
|
-
const sPromise = page.screenshot({
|
|
1215
|
-
...ssOpts,
|
|
1216
|
-
path: p,
|
|
1217
|
-
});
|
|
1218
|
-
|
|
1219
|
-
if (!screenshots[testName]) {
|
|
1220
|
-
screenshots[testName] = [];
|
|
1221
|
-
}
|
|
1222
|
-
screenshots[testName].push(sPromise);
|
|
1223
|
-
// sPromise.then(())
|
|
1224
|
-
await sPromise;
|
|
1225
|
-
return sPromise;
|
|
1226
|
-
// page.evaluate(`window["screenshot done"]`);
|
|
1227
|
-
}
|
|
1228
|
-
);
|
|
1229
|
-
|
|
1230
|
-
page.exposeFunction(
|
|
1231
|
-
"writeFileSync",
|
|
1232
|
-
(fp: string, contents: string, testName: string) => {
|
|
1233
|
-
return globalThis["writeFileSync"](fp, contents, testName);
|
|
1234
|
-
// const dir = path.dirname(fp);
|
|
1235
|
-
|
|
1236
|
-
// fs.mkdirSync(dir, {
|
|
1237
|
-
// recursive: true,
|
|
1238
|
-
// });
|
|
1239
|
-
|
|
1240
|
-
// const p = new Promise<string>(async (res, rej) => {
|
|
1241
|
-
// fs.writeFileSync(fp, contents);
|
|
1242
|
-
// res(fp);
|
|
1243
|
-
// });
|
|
1244
|
-
// doneFileStream2.push(p);
|
|
1245
|
-
|
|
1246
|
-
// if (!files[testName]) {
|
|
1247
|
-
// files[testName] = new Set();
|
|
1248
|
-
// }
|
|
1249
|
-
// files[testName].add(fp);
|
|
1250
|
-
// return p;
|
|
1251
|
-
}
|
|
1252
|
-
);
|
|
1253
|
-
|
|
1254
|
-
page.exposeFunction("existsSync", (fp: string, contents: string) => {
|
|
1255
|
-
return fs.existsSync(fp);
|
|
1256
|
-
});
|
|
1257
|
-
|
|
1258
|
-
page.exposeFunction("mkdirSync", (fp: string) => {
|
|
1259
|
-
if (!fs.existsSync(fp)) {
|
|
1260
|
-
return fs.mkdirSync(fp, {
|
|
1261
|
-
recursive: true,
|
|
1262
|
-
});
|
|
1263
|
-
}
|
|
1264
|
-
return false;
|
|
1265
|
-
});
|
|
1266
|
-
|
|
1267
|
-
page.exposeFunction(
|
|
1268
|
-
"createWriteStream",
|
|
1269
|
-
(fp: string, testName: string) => {
|
|
1270
|
-
const f = fs.createWriteStream(fp);
|
|
1271
|
-
|
|
1272
|
-
if (!files[testName]) {
|
|
1273
|
-
files[testName] = new Set();
|
|
1274
|
-
}
|
|
1275
|
-
files[testName].add(fp);
|
|
1276
|
-
|
|
1277
|
-
const p = new Promise<string>((res, rej) => {
|
|
1278
|
-
res(fp);
|
|
1279
|
-
});
|
|
1280
|
-
doneFileStream2.push(p);
|
|
1281
|
-
f.on("close", async () => {
|
|
1282
|
-
await p;
|
|
1283
|
-
});
|
|
1284
|
-
fileStreams2.push(f);
|
|
1285
|
-
return {
|
|
1286
|
-
...JSON.parse(JSON.stringify(f)),
|
|
1287
|
-
uid: fileStreams2.length - 1,
|
|
1288
|
-
};
|
|
1289
|
-
}
|
|
1290
|
-
);
|
|
1291
|
-
|
|
1292
|
-
page.exposeFunction("write", async (uid: number, contents: string) => {
|
|
1293
|
-
return fileStreams2[uid].write(contents);
|
|
1294
|
-
});
|
|
1295
|
-
|
|
1296
|
-
page.exposeFunction("end", async (uid: number) => {
|
|
1297
|
-
return fileStreams2[uid].end();
|
|
1298
|
-
});
|
|
1299
|
-
|
|
1300
|
-
// page.exposeFunction("customclose", (p: string, testName: string) => {
|
|
1301
|
-
// // console.log("closing", p);
|
|
1302
|
-
|
|
1303
|
-
// console.log("\t GOODBYE customclose");
|
|
1304
|
-
|
|
1305
|
-
// fs.writeFileSync(
|
|
1306
|
-
// p + "/manifest.json",
|
|
1307
|
-
// JSON.stringify(Array.from(files[testName]))
|
|
1308
|
-
// );
|
|
1309
|
-
// delete files[testName];
|
|
1310
|
-
|
|
1311
|
-
// // console.log("screenshots[testName]", screenshots[testName]);
|
|
1312
|
-
// Promise.all(screenshots[testName] || []).then(() => {
|
|
1313
|
-
// delete screenshots[testName];
|
|
1314
|
-
// });
|
|
1315
|
-
|
|
1316
|
-
// // globalThis["writeFileSync"](
|
|
1317
|
-
// // p + "/manifest.json",
|
|
1318
|
-
// // // files.entries()
|
|
1319
|
-
// // JSON.stringify(Array.from(files[testName]))
|
|
1320
|
-
// // );
|
|
1321
|
-
|
|
1322
|
-
// // console.log("closing doneFileStream2", doneFileStream2);
|
|
1323
|
-
// // console.log("closing doneFileStream2", doneFileStream2);
|
|
1324
|
-
// // Promise.all([...doneFileStream2, ...screenshots2]).then(() => {
|
|
1325
|
-
// // page.close();
|
|
1326
|
-
// // });
|
|
1327
|
-
|
|
1328
|
-
// // Promise.all(screenshots).then(() => {
|
|
1329
|
-
// // page.close();
|
|
1330
|
-
// // });
|
|
1331
|
-
// // setTimeout(() => {
|
|
1332
|
-
// // console.log("Delayed for 1 second.");
|
|
1333
|
-
// // page.close();
|
|
1334
|
-
// // }, 5000);
|
|
1335
|
-
|
|
1336
|
-
// // return page.close();
|
|
1337
|
-
// });
|
|
1338
|
-
|
|
1339
|
-
page.exposeFunction("page", () => {
|
|
1340
|
-
return (page.mainFrame() as unknown as { _id: string })._id;
|
|
1341
|
-
});
|
|
1342
|
-
|
|
1343
|
-
page.exposeFunction("click", (sel) => {
|
|
1344
|
-
return page.click(sel);
|
|
1345
|
-
});
|
|
1346
|
-
|
|
1347
|
-
page.exposeFunction("focusOn", (sel) => {
|
|
1348
|
-
return page.focus(sel);
|
|
1349
|
-
});
|
|
1350
|
-
|
|
1351
|
-
page.exposeFunction(
|
|
1352
|
-
"typeInto",
|
|
1353
|
-
async (value) => await page.keyboard.type(value)
|
|
1354
|
-
);
|
|
1355
|
-
|
|
1356
|
-
page.exposeFunction("getValue", (selector) =>
|
|
1357
|
-
page.$eval(selector, (input) => input.getAttribute("value"))
|
|
1358
|
-
);
|
|
1359
|
-
|
|
1360
|
-
page.exposeFunction(
|
|
1361
|
-
"getAttribute",
|
|
1362
|
-
async (selector: string, attribute: string) => {
|
|
1363
|
-
const attributeValue = await page.$eval(selector, (input) => {
|
|
1364
|
-
return input.getAttribute(attribute);
|
|
1365
|
-
});
|
|
1366
|
-
return attributeValue;
|
|
1367
|
-
}
|
|
1368
|
-
);
|
|
1369
|
-
|
|
1370
|
-
page.exposeFunction("isDisabled", async (selector: string) => {
|
|
1371
|
-
const attributeValue = await page.$eval(
|
|
1372
|
-
selector,
|
|
1373
|
-
(input: HTMLButtonElement) => {
|
|
1374
|
-
return input.disabled;
|
|
1375
|
-
}
|
|
1376
|
-
);
|
|
1377
|
-
return attributeValue;
|
|
1378
|
-
});
|
|
1379
|
-
|
|
1380
|
-
page.exposeFunction("$", async (selector: string) => {
|
|
1381
|
-
const x = page.$(selector);
|
|
1382
|
-
const y = await x;
|
|
1383
|
-
|
|
1384
|
-
return y;
|
|
1140
|
+
// set up the "node" listeners
|
|
1141
|
+
this.mapping().forEach(async ([command, func]) => {
|
|
1142
|
+
page.exposeFunction(command, func);
|
|
1385
1143
|
});
|
|
1386
1144
|
|
|
1387
1145
|
return page;
|
|
1388
1146
|
})
|
|
1389
1147
|
.then(async (page) => {
|
|
1390
1148
|
const close = () => {
|
|
1391
|
-
if (!files[
|
|
1392
|
-
files[
|
|
1149
|
+
if (!files[src]) {
|
|
1150
|
+
files[src] = new Set();
|
|
1393
1151
|
}
|
|
1394
1152
|
// files[t].add(filepath);
|
|
1395
1153
|
|
|
1396
1154
|
fs.writeFileSync(
|
|
1397
1155
|
destFolder + "/manifest.json",
|
|
1398
|
-
JSON.stringify(Array.from(files[
|
|
1156
|
+
JSON.stringify(Array.from(files[src]))
|
|
1399
1157
|
);
|
|
1400
|
-
delete files[
|
|
1158
|
+
delete files[src];
|
|
1401
1159
|
|
|
1402
|
-
Promise.all(screenshots[
|
|
1403
|
-
delete screenshots[
|
|
1160
|
+
Promise.all(screenshots[src] || []).then(() => {
|
|
1161
|
+
delete screenshots[src];
|
|
1404
1162
|
page.close();
|
|
1405
|
-
|
|
1406
|
-
this.testIsNowDone(t);
|
|
1407
|
-
stderrStream.close();
|
|
1408
|
-
stdoutStream.close();
|
|
1163
|
+
oStream.close();
|
|
1409
1164
|
});
|
|
1410
1165
|
};
|
|
1411
1166
|
|
|
1412
1167
|
page.on("pageerror", (err: Error) => {
|
|
1413
|
-
console.debug(`Error from ${
|
|
1414
|
-
|
|
1168
|
+
console.debug(`Error from ${src}: [${err.name}] `);
|
|
1169
|
+
oStream.write(err.name);
|
|
1170
|
+
oStream.write("\n");
|
|
1415
1171
|
|
|
1416
1172
|
if (err.cause) {
|
|
1417
|
-
console.debug(`Error from ${
|
|
1418
|
-
|
|
1173
|
+
console.debug(`Error from ${src} cause: [${err.cause}] `);
|
|
1174
|
+
oStream.write(err.cause);
|
|
1175
|
+
oStream.write("\n");
|
|
1419
1176
|
}
|
|
1420
1177
|
|
|
1421
1178
|
if (err.stack) {
|
|
1422
|
-
console.debug(`Error from stack ${
|
|
1423
|
-
|
|
1179
|
+
console.debug(`Error from stack ${src}: [${err.stack}] `);
|
|
1180
|
+
oStream.write(err.stack);
|
|
1181
|
+
oStream.write("\n");
|
|
1424
1182
|
}
|
|
1425
1183
|
|
|
1426
|
-
console.debug(`Error from message ${
|
|
1427
|
-
|
|
1184
|
+
console.debug(`Error from message ${src}: [${err.message}] `);
|
|
1185
|
+
oStream.write(err.message);
|
|
1186
|
+
oStream.write("\n");
|
|
1187
|
+
|
|
1188
|
+
this.bddTestIsNowDone(src, -1);
|
|
1428
1189
|
close();
|
|
1429
1190
|
});
|
|
1430
1191
|
page.on("console", (log: ConsoleMessage) => {
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
// );
|
|
1436
|
-
stdoutStream.write(log.text());
|
|
1437
|
-
stdoutStream.write(JSON.stringify(log.location()));
|
|
1438
|
-
stdoutStream.write(JSON.stringify(log.stackTrace()));
|
|
1192
|
+
oStream.write(log.text());
|
|
1193
|
+
oStream.write(JSON.stringify(log.location()));
|
|
1194
|
+
oStream.write(JSON.stringify(log.stackTrace()));
|
|
1195
|
+
oStream.write("\n");
|
|
1439
1196
|
});
|
|
1440
1197
|
await page.goto(`file://${`${destFolder}.html`}`, {});
|
|
1441
1198
|
|
|
1442
1199
|
await page
|
|
1443
1200
|
.evaluate(evaluation)
|
|
1444
|
-
.then(async ({ failed, features }: IFinalResults) => {
|
|
1445
|
-
this.receiveFeatures(features, destFolder,
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
this.receiveExitCode(t, failed);
|
|
1201
|
+
.then(async ({ fails, failed, features }: IFinalResults) => {
|
|
1202
|
+
this.receiveFeatures(features, destFolder, src, "web");
|
|
1203
|
+
statusMessagePretty(fails, src);
|
|
1204
|
+
this.bddTestIsNowDone(src, fails);
|
|
1449
1205
|
})
|
|
1450
1206
|
.catch((e) => {
|
|
1451
|
-
|
|
1452
|
-
console.log(ansiC.red(ansiC.inverse(`${t} errored with: ${e}`)));
|
|
1207
|
+
console.log(ansiC.red(ansiC.inverse(`${src} errored with: ${e}`)));
|
|
1453
1208
|
})
|
|
1454
1209
|
.finally(() => {
|
|
1455
|
-
|
|
1210
|
+
this.bddTestIsNowDone(src, -1);
|
|
1456
1211
|
close();
|
|
1457
1212
|
});
|
|
1458
1213
|
|
|
@@ -1463,11 +1218,12 @@ ${addableFiles
|
|
|
1463
1218
|
receiveFeatures = (
|
|
1464
1219
|
features: string[],
|
|
1465
1220
|
destFolder: string,
|
|
1466
|
-
srcTest: string
|
|
1221
|
+
srcTest: string,
|
|
1222
|
+
platform: IRunTime
|
|
1467
1223
|
) => {
|
|
1468
1224
|
const featureDestination = path.resolve(
|
|
1469
1225
|
process.cwd(),
|
|
1470
|
-
"
|
|
1226
|
+
"reports",
|
|
1471
1227
|
"features",
|
|
1472
1228
|
"strings",
|
|
1473
1229
|
srcTest.split(".").slice(0, -1).join(".") + ".features.txt"
|
|
@@ -1483,7 +1239,7 @@ ${addableFiles
|
|
|
1483
1239
|
const u = new URL(featureStringKey);
|
|
1484
1240
|
|
|
1485
1241
|
if (u.protocol === "file:") {
|
|
1486
|
-
const newPath = `${process.cwd()}/
|
|
1242
|
+
const newPath = `${process.cwd()}/testeranto/features/internal/${path.relative(
|
|
1487
1243
|
process.cwd(),
|
|
1488
1244
|
u.pathname
|
|
1489
1245
|
)}`;
|
|
@@ -1508,7 +1264,7 @@ ${addableFiles
|
|
|
1508
1264
|
// });
|
|
1509
1265
|
accum.files.push(newPath);
|
|
1510
1266
|
} else if (u.protocol === "http:" || u.protocol === "https:") {
|
|
1511
|
-
const newPath = `${process.cwd()}/
|
|
1267
|
+
const newPath = `${process.cwd()}/testeranto/features/external${
|
|
1512
1268
|
u.hostname
|
|
1513
1269
|
}${u.pathname}`;
|
|
1514
1270
|
const body = await this.configs.featureIngestor(featureStringKey);
|
|
@@ -1527,10 +1283,11 @@ ${addableFiles
|
|
|
1527
1283
|
}, Promise.resolve({ files: [] as string[], strings: [] as string[] }))
|
|
1528
1284
|
|
|
1529
1285
|
.then(({ files, strings }: { files: string[]; strings: string[] }) => {
|
|
1530
|
-
// writeFileAndCreateDir(`${featureDestination}`, JSON.stringify(strings));
|
|
1531
|
-
|
|
1532
1286
|
fs.writeFileSync(
|
|
1533
|
-
|
|
1287
|
+
`testeranto/reports/${this.name}/${srcTest
|
|
1288
|
+
.split(".")
|
|
1289
|
+
.slice(0, -1)
|
|
1290
|
+
.join(".")}/${platform}/featurePrompt.txt`,
|
|
1534
1291
|
files
|
|
1535
1292
|
.map((f) => {
|
|
1536
1293
|
return `/read ${f}`;
|
|
@@ -1538,18 +1295,11 @@ ${addableFiles
|
|
|
1538
1295
|
.join("\n")
|
|
1539
1296
|
);
|
|
1540
1297
|
});
|
|
1541
|
-
|
|
1542
|
-
// this.writeBigBoard();
|
|
1543
|
-
};
|
|
1544
|
-
|
|
1545
|
-
receiveExitCode = (srcTest: string, failures: number) => {
|
|
1546
|
-
this.bigBoard[srcTest].runTimeError = failures;
|
|
1547
|
-
this.writeBigBoard();
|
|
1548
1298
|
};
|
|
1549
1299
|
|
|
1550
1300
|
writeBigBoard = () => {
|
|
1551
1301
|
fs.writeFileSync(
|
|
1552
|
-
|
|
1302
|
+
`./testeranto/reports/${this.name}/summary.json`,
|
|
1553
1303
|
JSON.stringify(this.bigBoard, null, 2)
|
|
1554
1304
|
);
|
|
1555
1305
|
};
|