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/dist/prebuild/run.mjs
CHANGED
|
@@ -5,9 +5,11 @@ import ansiC2 from "ansi-colors";
|
|
|
5
5
|
import readline from "readline";
|
|
6
6
|
|
|
7
7
|
// src/PM/main.ts
|
|
8
|
+
import { spawn } from "node:child_process";
|
|
8
9
|
import ts from "typescript";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
10
|
+
import net from "net";
|
|
11
|
+
import fs2, { watch } from "fs";
|
|
12
|
+
import path3 from "path";
|
|
11
13
|
import puppeteer from "puppeteer-core";
|
|
12
14
|
import ansiC from "ansi-colors";
|
|
13
15
|
import crypto from "node:crypto";
|
|
@@ -16,25 +18,291 @@ import tsc from "tsc-prog";
|
|
|
16
18
|
|
|
17
19
|
// src/utils.ts
|
|
18
20
|
import path from "path";
|
|
19
|
-
var tscPather = (entryPoint, platform) => {
|
|
21
|
+
var tscPather = (entryPoint, platform, projectName) => {
|
|
20
22
|
return path.join(
|
|
21
|
-
"
|
|
22
|
-
|
|
23
|
+
"testeranto",
|
|
24
|
+
"reports",
|
|
25
|
+
projectName,
|
|
23
26
|
entryPoint.split(".").slice(0, -1).join("."),
|
|
27
|
+
platform,
|
|
24
28
|
`type_errors.txt`
|
|
25
29
|
);
|
|
26
30
|
};
|
|
27
|
-
var lintPather = (entryPoint, platform) => {
|
|
31
|
+
var lintPather = (entryPoint, platform, projectName) => {
|
|
28
32
|
return path.join(
|
|
29
|
-
"
|
|
30
|
-
|
|
33
|
+
"testeranto",
|
|
34
|
+
"reports",
|
|
35
|
+
projectName,
|
|
31
36
|
entryPoint.split(".").slice(0, -1).join("."),
|
|
37
|
+
platform,
|
|
32
38
|
`lint_errors.json`
|
|
33
39
|
);
|
|
34
40
|
};
|
|
41
|
+
var promptPather = (entryPoint, platform, projectName) => {
|
|
42
|
+
return path.join(
|
|
43
|
+
"testeranto",
|
|
44
|
+
"reports",
|
|
45
|
+
projectName,
|
|
46
|
+
entryPoint.split(".").slice(0, -1).join("."),
|
|
47
|
+
platform,
|
|
48
|
+
`prompt.txt`
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
var getRunnables = (tests, projectName, payload = {
|
|
52
|
+
nodeEntryPoints: {},
|
|
53
|
+
webEntryPoints: {},
|
|
54
|
+
importEntryPoints: {}
|
|
55
|
+
}) => {
|
|
56
|
+
return tests.reduce((pt, cv, cndx, cry) => {
|
|
57
|
+
if (cv[1] === "node") {
|
|
58
|
+
pt.nodeEntryPoints[cv[0]] = path.resolve(
|
|
59
|
+
`./testeranto/bundles/node/${projectName}/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`
|
|
60
|
+
);
|
|
61
|
+
} else if (cv[1] === "web") {
|
|
62
|
+
pt.webEntryPoints[cv[0]] = path.resolve(
|
|
63
|
+
`./testeranto/bundles/web/${projectName}/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`
|
|
64
|
+
);
|
|
65
|
+
} else if (cv[1] === "pure") {
|
|
66
|
+
pt.importEntryPoints[cv[0]] = path.resolve(
|
|
67
|
+
`./testeranto/bundles/pure/${projectName}/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
return pt;
|
|
71
|
+
}, payload);
|
|
72
|
+
};
|
|
35
73
|
|
|
36
|
-
// src/PM/
|
|
37
|
-
|
|
74
|
+
// src/PM/base.ts
|
|
75
|
+
import fs from "fs";
|
|
76
|
+
import path2 from "path";
|
|
77
|
+
var fileStreams3 = [];
|
|
78
|
+
var fPaths = [];
|
|
79
|
+
var files = {};
|
|
80
|
+
var recorders = {};
|
|
81
|
+
var screenshots = {};
|
|
82
|
+
var PM_Base = class {
|
|
83
|
+
constructor(configs) {
|
|
84
|
+
this.configs = configs;
|
|
85
|
+
}
|
|
86
|
+
customclose() {
|
|
87
|
+
throw new Error("Method not implemented.");
|
|
88
|
+
}
|
|
89
|
+
waitForSelector(p, s) {
|
|
90
|
+
return new Promise((res) => {
|
|
91
|
+
this.doInPage(p, async (page) => {
|
|
92
|
+
const x = page.$(s);
|
|
93
|
+
const y = await x;
|
|
94
|
+
res(y !== null);
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
closePage(p) {
|
|
99
|
+
return new Promise((res) => {
|
|
100
|
+
this.doInPage(p, async (page) => {
|
|
101
|
+
page.close();
|
|
102
|
+
res({});
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
newPage() {
|
|
107
|
+
return this.browser.newPage();
|
|
108
|
+
}
|
|
109
|
+
goto(p, url) {
|
|
110
|
+
return new Promise((res) => {
|
|
111
|
+
this.doInPage(p, async (page) => {
|
|
112
|
+
await page?.goto(url);
|
|
113
|
+
res({});
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
$(selector, p) {
|
|
118
|
+
return new Promise((res) => {
|
|
119
|
+
this.doInPage(p, async (page) => {
|
|
120
|
+
const x = page.$(selector);
|
|
121
|
+
const y = await x;
|
|
122
|
+
res(y !== null);
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
async pages() {
|
|
127
|
+
return (await this.browser.pages()).map((p) => {
|
|
128
|
+
return p.mainFrame()._id;
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
async screencast(ssOpts, testName2, page) {
|
|
132
|
+
const p = ssOpts.path;
|
|
133
|
+
const dir = path2.dirname(p);
|
|
134
|
+
fs.mkdirSync(dir, {
|
|
135
|
+
recursive: true
|
|
136
|
+
});
|
|
137
|
+
if (!files[testName2]) {
|
|
138
|
+
files[testName2] = /* @__PURE__ */ new Set();
|
|
139
|
+
}
|
|
140
|
+
files[testName2].add(ssOpts.path);
|
|
141
|
+
const sPromise = page.screenshot({
|
|
142
|
+
...ssOpts,
|
|
143
|
+
path: p
|
|
144
|
+
});
|
|
145
|
+
if (!screenshots[testName2]) {
|
|
146
|
+
screenshots[testName2] = [];
|
|
147
|
+
}
|
|
148
|
+
screenshots[testName2].push(sPromise);
|
|
149
|
+
await sPromise;
|
|
150
|
+
return sPromise;
|
|
151
|
+
}
|
|
152
|
+
async customScreenShot(ssOpts, testName2, page) {
|
|
153
|
+
const p = ssOpts.path;
|
|
154
|
+
const dir = path2.dirname(p);
|
|
155
|
+
fs.mkdirSync(dir, {
|
|
156
|
+
recursive: true
|
|
157
|
+
});
|
|
158
|
+
if (!files[testName2]) {
|
|
159
|
+
files[testName2] = /* @__PURE__ */ new Set();
|
|
160
|
+
}
|
|
161
|
+
files[testName2].add(ssOpts.path);
|
|
162
|
+
const sPromise = page.screenshot({
|
|
163
|
+
...ssOpts,
|
|
164
|
+
path: p
|
|
165
|
+
});
|
|
166
|
+
if (!screenshots[testName2]) {
|
|
167
|
+
screenshots[testName2] = [];
|
|
168
|
+
}
|
|
169
|
+
screenshots[testName2].push(sPromise);
|
|
170
|
+
await sPromise;
|
|
171
|
+
return sPromise;
|
|
172
|
+
}
|
|
173
|
+
async end(uid) {
|
|
174
|
+
await fileStreams3[uid].end();
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
existsSync(destFolder) {
|
|
178
|
+
return fs.existsSync(destFolder);
|
|
179
|
+
}
|
|
180
|
+
async mkdirSync(fp) {
|
|
181
|
+
if (!fs.existsSync(fp)) {
|
|
182
|
+
return fs.mkdirSync(fp, {
|
|
183
|
+
recursive: true
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
async writeFileSync(filepath, contents, testName2) {
|
|
189
|
+
return new Promise(async (res) => {
|
|
190
|
+
fs.mkdirSync(path2.dirname(filepath), {
|
|
191
|
+
recursive: true
|
|
192
|
+
});
|
|
193
|
+
if (!files[testName2]) {
|
|
194
|
+
files[testName2] = /* @__PURE__ */ new Set();
|
|
195
|
+
}
|
|
196
|
+
files[testName2].add(filepath);
|
|
197
|
+
await fs.writeFileSync(filepath, contents);
|
|
198
|
+
res(true);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
async createWriteStream(filepath, testName2) {
|
|
202
|
+
return new Promise((res) => {
|
|
203
|
+
const f = fs.createWriteStream(filepath);
|
|
204
|
+
fileStreams3.push(f);
|
|
205
|
+
if (!files[testName2]) {
|
|
206
|
+
files[testName2] = /* @__PURE__ */ new Set();
|
|
207
|
+
}
|
|
208
|
+
files[testName2].add(filepath);
|
|
209
|
+
res(fileStreams3.length - 1);
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
testArtiFactoryfileWriter(tLog, callback) {
|
|
213
|
+
return (fPath, value) => {
|
|
214
|
+
callback(
|
|
215
|
+
new Promise((res, rej) => {
|
|
216
|
+
tLog("testArtiFactory =>", fPath);
|
|
217
|
+
const cleanPath = path2.resolve(fPath);
|
|
218
|
+
fPaths.push(cleanPath.replace(process.cwd(), ``));
|
|
219
|
+
const targetDir = cleanPath.split("/").slice(0, -1).join("/");
|
|
220
|
+
fs.mkdir(targetDir, { recursive: true }, async (error) => {
|
|
221
|
+
if (error) {
|
|
222
|
+
console.error(`\u2757\uFE0FtestArtiFactory failed`, targetDir, error);
|
|
223
|
+
}
|
|
224
|
+
fs.writeFileSync(
|
|
225
|
+
path2.resolve(
|
|
226
|
+
targetDir.split("/").slice(0, -1).join("/"),
|
|
227
|
+
"manifest"
|
|
228
|
+
),
|
|
229
|
+
fPaths.join(`
|
|
230
|
+
`),
|
|
231
|
+
{
|
|
232
|
+
encoding: "utf-8"
|
|
233
|
+
}
|
|
234
|
+
);
|
|
235
|
+
if (Buffer.isBuffer(value)) {
|
|
236
|
+
fs.writeFileSync(fPath, value, "binary");
|
|
237
|
+
res();
|
|
238
|
+
} else if (`string` === typeof value) {
|
|
239
|
+
fs.writeFileSync(fPath, value.toString(), {
|
|
240
|
+
encoding: "utf-8"
|
|
241
|
+
});
|
|
242
|
+
res();
|
|
243
|
+
} else {
|
|
244
|
+
const pipeStream = value;
|
|
245
|
+
const myFile = fs.createWriteStream(fPath);
|
|
246
|
+
pipeStream.pipe(myFile);
|
|
247
|
+
pipeStream.on("close", () => {
|
|
248
|
+
myFile.close();
|
|
249
|
+
res();
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
})
|
|
254
|
+
);
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
async write(uid, contents) {
|
|
258
|
+
return new Promise((res) => {
|
|
259
|
+
const x = fileStreams3[uid].write(contents);
|
|
260
|
+
res(x);
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
page() {
|
|
264
|
+
throw new Error("Method not implemented.");
|
|
265
|
+
}
|
|
266
|
+
click(selector, page) {
|
|
267
|
+
return page.click(selector);
|
|
268
|
+
}
|
|
269
|
+
async focusOn(selector, p) {
|
|
270
|
+
this.doInPage(p, (page) => {
|
|
271
|
+
return page.focus(selector);
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
async typeInto(value, p) {
|
|
275
|
+
this.doInPage(p, (page) => {
|
|
276
|
+
return page.keyboard.type(value);
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
getValue(value, p) {
|
|
280
|
+
this.doInPage(p, (page) => {
|
|
281
|
+
return page.keyboard.type(value);
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
getAttribute(selector, attribute, p) {
|
|
285
|
+
this.doInPage(p, (page) => {
|
|
286
|
+
return page.$eval(selector, (input) => input.getAttribute("value"));
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
isDisabled(selector, p) {
|
|
290
|
+
this.doInPage(p, async (page) => {
|
|
291
|
+
return await page.$eval(selector, (input) => {
|
|
292
|
+
return input.disabled;
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
screencastStop(s) {
|
|
297
|
+
return recorders[s].stop();
|
|
298
|
+
}
|
|
299
|
+
async doInPage(p, cb) {
|
|
300
|
+
(await this.browser.pages()).forEach((page) => {
|
|
301
|
+
if (page.mainFrame()._id === p) {
|
|
302
|
+
return cb(page);
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
}
|
|
38
306
|
};
|
|
39
307
|
|
|
40
308
|
// src/PM/main.ts
|
|
@@ -44,15 +312,12 @@ var formatter = await eslint.loadFormatter(
|
|
|
44
312
|
);
|
|
45
313
|
var changes = {};
|
|
46
314
|
var fileHashes = {};
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
var files = {};
|
|
50
|
-
var recorders = {};
|
|
51
|
-
var screenshots = {};
|
|
315
|
+
var files2 = {};
|
|
316
|
+
var screenshots2 = {};
|
|
52
317
|
async function fileHash(filePath, algorithm = "md5") {
|
|
53
318
|
return new Promise((resolve, reject) => {
|
|
54
319
|
const hash = crypto.createHash(algorithm);
|
|
55
|
-
const fileStream =
|
|
320
|
+
const fileStream = fs2.createReadStream(filePath);
|
|
56
321
|
fileStream.on("data", (data) => {
|
|
57
322
|
hash.update(data);
|
|
58
323
|
});
|
|
@@ -65,26 +330,6 @@ async function fileHash(filePath, algorithm = "md5") {
|
|
|
65
330
|
});
|
|
66
331
|
});
|
|
67
332
|
}
|
|
68
|
-
var getRunnables = (tests, payload = {
|
|
69
|
-
nodeEntryPoints: {},
|
|
70
|
-
webEntryPoints: {}
|
|
71
|
-
}) => {
|
|
72
|
-
return tests.reduce((pt, cv, cndx, cry) => {
|
|
73
|
-
if (cv[1] === "node") {
|
|
74
|
-
pt.nodeEntryPoints[cv[0]] = path2.resolve(
|
|
75
|
-
`./docs/node/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`
|
|
76
|
-
);
|
|
77
|
-
} else if (cv[1] === "web") {
|
|
78
|
-
pt.webEntryPoints[cv[0]] = path2.resolve(
|
|
79
|
-
`./docs/web/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
if (cv[3].length) {
|
|
83
|
-
getRunnables(cv[3], payload);
|
|
84
|
-
}
|
|
85
|
-
return pt;
|
|
86
|
-
}, payload);
|
|
87
|
-
};
|
|
88
333
|
var statusMessagePretty = (failures, test) => {
|
|
89
334
|
if (failures === 0) {
|
|
90
335
|
console.log(ansiC.green(ansiC.inverse(`> ${test} completed successfully`)));
|
|
@@ -93,18 +338,18 @@ var statusMessagePretty = (failures, test) => {
|
|
|
93
338
|
}
|
|
94
339
|
};
|
|
95
340
|
async function writeFileAndCreateDir(filePath, data) {
|
|
96
|
-
const dirPath =
|
|
341
|
+
const dirPath = path3.dirname(filePath);
|
|
97
342
|
try {
|
|
98
|
-
await
|
|
99
|
-
await
|
|
343
|
+
await fs2.promises.mkdir(dirPath, { recursive: true });
|
|
344
|
+
await fs2.appendFileSync(filePath, data);
|
|
100
345
|
} catch (error) {
|
|
101
346
|
console.error(`Error writing file: ${error}`);
|
|
102
347
|
}
|
|
103
348
|
}
|
|
104
|
-
var filesHash = async (
|
|
349
|
+
var filesHash = async (files3, algorithm = "md5") => {
|
|
105
350
|
return new Promise((resolve, reject) => {
|
|
106
351
|
resolve(
|
|
107
|
-
|
|
352
|
+
files3.reduce(async (mm, f) => {
|
|
108
353
|
return await mm + await fileHash(f);
|
|
109
354
|
}, Promise.resolve(""))
|
|
110
355
|
);
|
|
@@ -118,17 +363,25 @@ function isValidUrl(string) {
|
|
|
118
363
|
return false;
|
|
119
364
|
}
|
|
120
365
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
366
|
+
function pollForFile(path4, timeout = 2e3) {
|
|
367
|
+
const intervalObj = setInterval(function() {
|
|
368
|
+
const file = path4;
|
|
369
|
+
const fileExists = fs2.existsSync(file);
|
|
370
|
+
if (fileExists) {
|
|
371
|
+
clearInterval(intervalObj);
|
|
372
|
+
}
|
|
373
|
+
}, timeout);
|
|
374
|
+
}
|
|
375
|
+
var PM_Main = class extends PM_Base {
|
|
376
|
+
constructor(configs, name, mode2) {
|
|
377
|
+
super(configs);
|
|
125
378
|
this.bigBoard = {};
|
|
126
|
-
this.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
379
|
+
this.getRunnables = (tests, testName2, payload = {
|
|
380
|
+
nodeEntryPoints: {},
|
|
381
|
+
webEntryPoints: {},
|
|
382
|
+
importEntryPoints: {}
|
|
383
|
+
}) => {
|
|
384
|
+
return getRunnables(tests, testName2, payload);
|
|
132
385
|
};
|
|
133
386
|
this.tscCheck = async ({
|
|
134
387
|
entrypoint,
|
|
@@ -136,7 +389,7 @@ var PM_Main = class extends PM {
|
|
|
136
389
|
platform
|
|
137
390
|
}) => {
|
|
138
391
|
console.log(ansiC.green(ansiC.inverse(`tsc < ${entrypoint}`)));
|
|
139
|
-
this.
|
|
392
|
+
this.typeCheckIsRunning(entrypoint);
|
|
140
393
|
const program = tsc.createProgramFromConfig({
|
|
141
394
|
basePath: process.cwd(),
|
|
142
395
|
// always required, used for relative paths
|
|
@@ -144,18 +397,19 @@ var PM_Main = class extends PM {
|
|
|
144
397
|
// config to inherit from (optional)
|
|
145
398
|
compilerOptions: {
|
|
146
399
|
rootDir: "src",
|
|
147
|
-
outDir: tscPather(entrypoint, platform),
|
|
400
|
+
outDir: tscPather(entrypoint, platform, this.name),
|
|
148
401
|
// declaration: true,
|
|
149
402
|
// skipLibCheck: true,
|
|
150
403
|
noEmit: true
|
|
151
404
|
},
|
|
152
405
|
include: addableFiles
|
|
153
406
|
//["src/**/*"],
|
|
407
|
+
// exclude: ["node_modules", "../testeranto"],
|
|
154
408
|
// exclude: ["**/*.test.ts", "**/*.spec.ts"],
|
|
155
409
|
});
|
|
156
|
-
const tscPath = tscPather(entrypoint, platform);
|
|
410
|
+
const tscPath = tscPather(entrypoint, platform, this.name);
|
|
157
411
|
let allDiagnostics = program.getSemanticDiagnostics();
|
|
158
|
-
const
|
|
412
|
+
const results = [];
|
|
159
413
|
allDiagnostics.forEach((diagnostic) => {
|
|
160
414
|
if (diagnostic.file) {
|
|
161
415
|
let { line, character } = ts.getLineAndCharacterOfPosition(
|
|
@@ -166,111 +420,149 @@ var PM_Main = class extends PM {
|
|
|
166
420
|
diagnostic.messageText,
|
|
167
421
|
"\n"
|
|
168
422
|
);
|
|
169
|
-
|
|
423
|
+
results.push(
|
|
170
424
|
`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`
|
|
171
425
|
);
|
|
172
426
|
} else {
|
|
173
|
-
|
|
427
|
+
results.push(
|
|
428
|
+
ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")
|
|
429
|
+
);
|
|
174
430
|
}
|
|
175
431
|
});
|
|
176
|
-
|
|
177
|
-
this.
|
|
178
|
-
if (this.shutdownMode) {
|
|
179
|
-
this.checkForShutdown();
|
|
180
|
-
}
|
|
432
|
+
fs2.writeFileSync(tscPath, results.join("\n"));
|
|
433
|
+
this.typeCheckIsNowDone(entrypoint, results.length);
|
|
181
434
|
};
|
|
182
435
|
this.eslintCheck = async (entrypoint, platform, addableFiles) => {
|
|
183
|
-
this.bigBoard[entrypoint].staticErrors = "?";
|
|
184
436
|
console.log(ansiC.green(ansiC.inverse(`eslint < ${entrypoint}`)));
|
|
437
|
+
this.lintIsRunning(entrypoint);
|
|
185
438
|
const results = (await eslint.lintFiles(addableFiles)).filter((r) => r.messages.length).filter((r) => {
|
|
186
439
|
return r.messages[0].ruleId !== null;
|
|
187
440
|
}).map((r) => {
|
|
188
441
|
delete r.source;
|
|
189
442
|
return r;
|
|
190
443
|
});
|
|
191
|
-
|
|
192
|
-
lintPather(entrypoint, platform),
|
|
444
|
+
fs2.writeFileSync(
|
|
445
|
+
lintPather(entrypoint, platform, this.name),
|
|
193
446
|
await formatter.format(results)
|
|
194
447
|
);
|
|
195
|
-
this.
|
|
196
|
-
if (this.shutdownMode) {
|
|
197
|
-
this.checkForShutdown();
|
|
198
|
-
}
|
|
448
|
+
this.lintIsNowDone(entrypoint, results.length);
|
|
199
449
|
};
|
|
200
450
|
this.makePrompt = async (entryPoint, addableFiles, platform) => {
|
|
201
451
|
this.bigBoard[entryPoint].prompt = "?";
|
|
202
|
-
const promptPath =
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
);
|
|
208
|
-
const testPaths = path2.join(
|
|
209
|
-
"./docs/",
|
|
452
|
+
const promptPath = promptPather(entryPoint, platform, this.name);
|
|
453
|
+
const testPaths = path3.join(
|
|
454
|
+
"testeranto",
|
|
455
|
+
"reports",
|
|
456
|
+
this.name,
|
|
210
457
|
platform,
|
|
211
458
|
entryPoint.split(".").slice(0, -1).join("."),
|
|
212
459
|
`tests.json`
|
|
213
460
|
);
|
|
214
|
-
const featuresPath =
|
|
215
|
-
"
|
|
461
|
+
const featuresPath = path3.join(
|
|
462
|
+
"testeranto",
|
|
463
|
+
"reports",
|
|
464
|
+
this.name,
|
|
216
465
|
platform,
|
|
217
466
|
entryPoint.split(".").slice(0, -1).join("."),
|
|
218
467
|
`featurePrompt.txt`
|
|
219
468
|
);
|
|
220
|
-
|
|
469
|
+
fs2.writeFileSync(
|
|
221
470
|
promptPath,
|
|
222
471
|
`
|
|
223
472
|
${addableFiles.map((x) => {
|
|
224
473
|
return `/add ${x}`;
|
|
225
474
|
}).join("\n")}
|
|
226
475
|
|
|
227
|
-
/read ${lintPather(entryPoint, platform)}
|
|
228
|
-
/read ${tscPather(entryPoint, platform)}
|
|
476
|
+
/read ${lintPather(entryPoint, platform, this.name)}
|
|
477
|
+
/read ${tscPather(entryPoint, platform, this.name)}
|
|
229
478
|
/read ${testPaths}
|
|
230
479
|
|
|
231
480
|
/load ${featuresPath}
|
|
232
481
|
|
|
233
482
|
/code Fix the failing tests described in ${testPaths}. Correct any type signature errors described in the files ${tscPather(
|
|
234
483
|
entryPoint,
|
|
235
|
-
platform
|
|
484
|
+
platform,
|
|
485
|
+
this.name
|
|
236
486
|
)}. Implement any method which throws "Function not implemented. Resolve the lint errors described in ${lintPather(
|
|
237
487
|
entryPoint,
|
|
238
|
-
platform
|
|
488
|
+
platform,
|
|
489
|
+
this.name
|
|
239
490
|
)}"
|
|
240
491
|
`
|
|
241
492
|
);
|
|
242
|
-
this.bigBoard[entryPoint].prompt = `aider --model deepseek/deepseek-chat --load
|
|
243
|
-
|
|
244
|
-
this.checkForShutdown();
|
|
245
|
-
}
|
|
493
|
+
this.bigBoard[entryPoint].prompt = `aider --model deepseek/deepseek-chat --load testeranto/${this.name}/reports/${platform}/${entryPoint.split(".").slice(0, -1).join(".")}/prompt.txt`;
|
|
494
|
+
this.checkForShutdown();
|
|
246
495
|
};
|
|
247
496
|
this.checkForShutdown = () => {
|
|
248
|
-
|
|
249
|
-
if (
|
|
250
|
-
|
|
251
|
-
|
|
497
|
+
this.writeBigBoard();
|
|
498
|
+
if (this.mode === "dev")
|
|
499
|
+
return;
|
|
500
|
+
let inflight = false;
|
|
501
|
+
Object.keys(this.bigBoard).forEach((k) => {
|
|
502
|
+
if (this.bigBoard[k].prompt === "?") {
|
|
503
|
+
console.log(ansiC.blue(ansiC.inverse(`\u{1F555} prompt ${k}`)));
|
|
504
|
+
inflight = true;
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
Object.keys(this.bigBoard).forEach((k) => {
|
|
508
|
+
if (this.bigBoard[k].runTimeError === "?") {
|
|
509
|
+
console.log(ansiC.blue(ansiC.inverse(`\u{1F555} runTimeError ${k}`)));
|
|
510
|
+
inflight = true;
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
Object.keys(this.bigBoard).forEach((k) => {
|
|
514
|
+
if (this.bigBoard[k].staticErrors === "?") {
|
|
515
|
+
console.log(ansiC.blue(ansiC.inverse(`\u{1F555} staticErrors ${k}`)));
|
|
516
|
+
inflight = true;
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
Object.keys(this.bigBoard).forEach((k) => {
|
|
520
|
+
if (this.bigBoard[k].typeErrors === "?") {
|
|
521
|
+
console.log(ansiC.blue(ansiC.inverse(`\u{1F555} typeErrors ${k}`)));
|
|
522
|
+
inflight = true;
|
|
523
|
+
}
|
|
524
|
+
});
|
|
525
|
+
this.writeBigBoard();
|
|
526
|
+
if (!inflight) {
|
|
252
527
|
this.browser.disconnect().then(() => {
|
|
253
|
-
|
|
254
|
-
"docs/summary.json",
|
|
255
|
-
JSON.stringify(this.bigBoard, null, 2)
|
|
256
|
-
);
|
|
257
|
-
console.log(ansiC.inverse("Goodbye"));
|
|
528
|
+
console.log(ansiC.inverse(`${this.name} has been tested. Goodbye.`));
|
|
258
529
|
process.exit();
|
|
259
530
|
});
|
|
260
531
|
}
|
|
261
532
|
};
|
|
262
|
-
this.
|
|
263
|
-
this.bigBoard[src].
|
|
533
|
+
this.typeCheckIsRunning = (src) => {
|
|
534
|
+
this.bigBoard[src].typeErrors = "?";
|
|
264
535
|
};
|
|
265
|
-
this.
|
|
266
|
-
this.bigBoard[src].
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
536
|
+
this.typeCheckIsNowDone = (src, failures) => {
|
|
537
|
+
this.bigBoard[src].typeErrors = failures;
|
|
538
|
+
this.writeBigBoard();
|
|
539
|
+
this.checkForShutdown();
|
|
270
540
|
};
|
|
271
|
-
this.
|
|
272
|
-
|
|
273
|
-
this.
|
|
541
|
+
this.lintIsRunning = (src) => {
|
|
542
|
+
this.bigBoard[src].staticErrors = "?";
|
|
543
|
+
this.writeBigBoard();
|
|
544
|
+
};
|
|
545
|
+
this.lintIsNowDone = (src, failures) => {
|
|
546
|
+
this.bigBoard[src].staticErrors = failures;
|
|
547
|
+
this.writeBigBoard();
|
|
548
|
+
this.checkForShutdown();
|
|
549
|
+
};
|
|
550
|
+
this.bddTestIsRunning = (src) => {
|
|
551
|
+
this.bigBoard[src].runTimeError = "?";
|
|
552
|
+
this.writeBigBoard();
|
|
553
|
+
};
|
|
554
|
+
this.bddTestIsNowDone = (src, failures) => {
|
|
555
|
+
this.bigBoard[src].runTimeError = failures;
|
|
556
|
+
this.writeBigBoard();
|
|
557
|
+
this.checkForShutdown();
|
|
558
|
+
};
|
|
559
|
+
this.launchPure = async (src, dest) => {
|
|
560
|
+
console.log(ansiC.green(ansiC.inverse(`! pure, ${src}`)));
|
|
561
|
+
this.bddTestIsRunning(src);
|
|
562
|
+
const reportDest = `testeranto/reports/${this.name}/${src.split(".").slice(0, -1).join(".")}/pure`;
|
|
563
|
+
if (!fs2.existsSync(reportDest)) {
|
|
564
|
+
fs2.mkdirSync(reportDest, { recursive: true });
|
|
565
|
+
}
|
|
274
566
|
const destFolder = dest.replace(".mjs", "");
|
|
275
567
|
let argz = "";
|
|
276
568
|
const testConfig = this.configs.tests.find((t) => {
|
|
@@ -287,7 +579,7 @@ ${addableFiles.map((x) => {
|
|
|
287
579
|
scheduled: true,
|
|
288
580
|
name: src,
|
|
289
581
|
ports: portsToUse,
|
|
290
|
-
fs:
|
|
582
|
+
fs: reportDest,
|
|
291
583
|
browserWSEndpoint: this.browser.wsEndpoint()
|
|
292
584
|
});
|
|
293
585
|
} else if (testConfigResource.ports > 0) {
|
|
@@ -302,7 +594,6 @@ ${addableFiles.map((x) => {
|
|
|
302
594
|
argz = JSON.stringify({
|
|
303
595
|
scheduled: true,
|
|
304
596
|
name: src,
|
|
305
|
-
// ports: [3333],
|
|
306
597
|
ports: portsToUse,
|
|
307
598
|
fs: destFolder,
|
|
308
599
|
browserWSEndpoint: this.browser.wsEndpoint()
|
|
@@ -317,17 +608,17 @@ ${addableFiles.map((x) => {
|
|
|
317
608
|
}
|
|
318
609
|
const builtfile = dest;
|
|
319
610
|
const webSideCares = [];
|
|
320
|
-
|
|
611
|
+
await import(`${builtfile}?cacheBust=${Date.now()}`).then((module) => {
|
|
321
612
|
return module.default.then((defaultModule) => {
|
|
322
|
-
defaultModule.receiveTestResourceConfig(argz).then(async (
|
|
323
|
-
this.receiveFeatures(features, destFolder, src);
|
|
324
|
-
statusMessagePretty(
|
|
325
|
-
this.
|
|
613
|
+
defaultModule.receiveTestResourceConfig(argz).then(async (results) => {
|
|
614
|
+
this.receiveFeatures(results.features, destFolder, src, "pure");
|
|
615
|
+
statusMessagePretty(results.fails, src);
|
|
616
|
+
this.bddTestIsNowDone(src, results.fails);
|
|
326
617
|
}).catch((e) => {
|
|
327
618
|
console.log(ansiC.red(ansiC.inverse(`${src} errored with: ${e}`)));
|
|
619
|
+
this.bddTestIsNowDone(src, -1);
|
|
328
620
|
}).finally(() => {
|
|
329
621
|
webSideCares.forEach((webSideCar) => webSideCar.close());
|
|
330
|
-
this.testIsNowDone(src);
|
|
331
622
|
});
|
|
332
623
|
});
|
|
333
624
|
});
|
|
@@ -337,69 +628,192 @@ ${addableFiles.map((x) => {
|
|
|
337
628
|
}
|
|
338
629
|
}
|
|
339
630
|
};
|
|
340
|
-
this.
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
631
|
+
this.launchNode = async (src, dest) => {
|
|
632
|
+
console.log(ansiC.green(ansiC.inverse(`! node, ${src}`)));
|
|
633
|
+
this.bddTestIsRunning(src);
|
|
634
|
+
const reportDest = `testeranto/reports/${this.name}/${src.split(".").slice(0, -1).join(".")}/node`;
|
|
635
|
+
if (!fs2.existsSync(reportDest)) {
|
|
636
|
+
fs2.mkdirSync(reportDest, { recursive: true });
|
|
637
|
+
}
|
|
638
|
+
const destFolder = dest.replace(".mjs", "");
|
|
639
|
+
let testResources = "";
|
|
640
|
+
const testConfig = this.configs.tests.find((t) => {
|
|
641
|
+
return t[0] === src;
|
|
642
|
+
});
|
|
643
|
+
if (!testConfig) {
|
|
644
|
+
console.log(ansiC.inverse("missing test config! Exiting ungracefully!"));
|
|
645
|
+
process.exit(-1);
|
|
646
|
+
}
|
|
647
|
+
const testConfigResource = testConfig[2];
|
|
648
|
+
let portsToUse = [];
|
|
649
|
+
if (testConfigResource.ports === 0) {
|
|
650
|
+
testResources = JSON.stringify({
|
|
651
|
+
scheduled: true,
|
|
652
|
+
name: src,
|
|
653
|
+
ports: portsToUse,
|
|
654
|
+
fs: reportDest,
|
|
655
|
+
browserWSEndpoint: this.browser.wsEndpoint()
|
|
656
|
+
});
|
|
657
|
+
} else if (testConfigResource.ports > 0) {
|
|
658
|
+
const openPorts = Object.entries(this.ports).filter(
|
|
659
|
+
([portnumber, portopen]) => portopen
|
|
660
|
+
);
|
|
661
|
+
if (openPorts.length >= testConfigResource.ports) {
|
|
662
|
+
for (let i = 0; i < testConfigResource.ports; i++) {
|
|
663
|
+
portsToUse.push(openPorts[i][0]);
|
|
664
|
+
this.ports[openPorts[i][0]] = false;
|
|
665
|
+
}
|
|
666
|
+
testResources = JSON.stringify({
|
|
667
|
+
scheduled: true,
|
|
668
|
+
name: src,
|
|
669
|
+
ports: portsToUse,
|
|
670
|
+
fs: destFolder,
|
|
671
|
+
browserWSEndpoint: this.browser.wsEndpoint()
|
|
672
|
+
});
|
|
673
|
+
} else {
|
|
674
|
+
this.queue.push(src);
|
|
675
|
+
return;
|
|
676
|
+
}
|
|
677
|
+
} else {
|
|
678
|
+
console.error("negative port makes no sense", src);
|
|
679
|
+
process.exit(-1);
|
|
680
|
+
}
|
|
681
|
+
const builtfile = dest;
|
|
682
|
+
let haltReturns = false;
|
|
683
|
+
let buffer = new Buffer("");
|
|
684
|
+
const server = net.createServer((socket) => {
|
|
685
|
+
socket.on("data", (data) => {
|
|
686
|
+
buffer = Buffer.concat([buffer, data]);
|
|
687
|
+
let messages = [];
|
|
688
|
+
for (let b = 0; b < buffer.length + 1; b++) {
|
|
689
|
+
let c = buffer.slice(0, b);
|
|
690
|
+
let d;
|
|
691
|
+
try {
|
|
692
|
+
d = JSON.parse(c.toString());
|
|
693
|
+
messages.push(d);
|
|
694
|
+
buffer = buffer.slice(b, buffer.length + 1);
|
|
695
|
+
b = 0;
|
|
696
|
+
} catch (e) {
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
messages.forEach(async (payload) => {
|
|
700
|
+
this.mapping().forEach(async ([command, func]) => {
|
|
701
|
+
if (payload[0] === command) {
|
|
702
|
+
const x = payload.slice(1, -1);
|
|
703
|
+
const r = await this[command](...x);
|
|
704
|
+
if (!haltReturns) {
|
|
705
|
+
child.send(
|
|
706
|
+
JSON.stringify({
|
|
707
|
+
payload: r,
|
|
708
|
+
key: payload[payload.length - 1]
|
|
709
|
+
})
|
|
710
|
+
);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
});
|
|
714
|
+
});
|
|
715
|
+
});
|
|
716
|
+
});
|
|
717
|
+
const oStream = fs2.createWriteStream(`${reportDest}/console_log.txt`);
|
|
718
|
+
const child = spawn("node", [builtfile, testResources], {
|
|
719
|
+
stdio: ["pipe", "pipe", "pipe", "ipc"]
|
|
720
|
+
// silent: true
|
|
721
|
+
});
|
|
722
|
+
const p = destFolder + "/pipe";
|
|
723
|
+
server.listen(p, () => {
|
|
724
|
+
child.stderr?.on("data", (data) => {
|
|
725
|
+
oStream.write(`stderr data ${data}`);
|
|
726
|
+
});
|
|
727
|
+
child.stdout?.on("data", (data) => {
|
|
728
|
+
oStream.write(`stdout data ${data}`);
|
|
729
|
+
});
|
|
730
|
+
child.on("close", (code) => {
|
|
731
|
+
oStream.close();
|
|
732
|
+
server.close();
|
|
733
|
+
if (code === null) {
|
|
734
|
+
this.bddTestIsNowDone(src, -1);
|
|
735
|
+
statusMessagePretty(-1, src);
|
|
736
|
+
} else if (code === 0) {
|
|
737
|
+
this.bddTestIsNowDone(src, 0);
|
|
738
|
+
statusMessagePretty(0, src);
|
|
739
|
+
} else {
|
|
740
|
+
this.bddTestIsNowDone(src, code);
|
|
741
|
+
statusMessagePretty(code, src);
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
child.on("exit", (code) => {
|
|
745
|
+
});
|
|
746
|
+
});
|
|
747
|
+
child.send({ path: p });
|
|
748
|
+
for (let i = 0; i <= portsToUse.length; i++) {
|
|
749
|
+
if (portsToUse[i]) {
|
|
750
|
+
this.ports[portsToUse[i]] = "true";
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
};
|
|
754
|
+
this.launchWebSideCar = async (src, dest, testConfig) => {
|
|
755
|
+
const d = dest + ".mjs";
|
|
756
|
+
console.log(ansiC.green(ansiC.inverse(`launchWebSideCar ${src}`)));
|
|
757
|
+
const fileStreams2 = [];
|
|
758
|
+
const doneFileStream2 = [];
|
|
759
|
+
return new Promise((res, rej) => {
|
|
760
|
+
this.browser.newPage().then((page) => {
|
|
761
|
+
page.exposeFunction(
|
|
762
|
+
"custom-screenshot",
|
|
763
|
+
async (ssOpts, testName2) => {
|
|
764
|
+
const p = ssOpts.path;
|
|
765
|
+
const dir = path3.dirname(p);
|
|
766
|
+
fs2.mkdirSync(dir, {
|
|
767
|
+
recursive: true
|
|
768
|
+
});
|
|
769
|
+
files2[testName2].add(ssOpts.path);
|
|
770
|
+
const sPromise = page.screenshot({
|
|
771
|
+
...ssOpts,
|
|
772
|
+
path: p
|
|
773
|
+
});
|
|
774
|
+
if (!screenshots2[testName2]) {
|
|
775
|
+
screenshots2[testName2] = [];
|
|
776
|
+
}
|
|
777
|
+
screenshots2[testName2].push(sPromise);
|
|
778
|
+
await sPromise;
|
|
779
|
+
return sPromise;
|
|
780
|
+
}
|
|
781
|
+
);
|
|
782
|
+
page.exposeFunction(
|
|
783
|
+
"writeFileSync",
|
|
784
|
+
(fp, contents, testName2) => {
|
|
785
|
+
const dir = path3.dirname(fp);
|
|
786
|
+
fs2.mkdirSync(dir, {
|
|
787
|
+
recursive: true
|
|
788
|
+
});
|
|
789
|
+
const p = new Promise(async (res2, rej2) => {
|
|
790
|
+
fs2.writeFileSync(fp, contents);
|
|
791
|
+
res2(fp);
|
|
792
|
+
});
|
|
793
|
+
doneFileStream2.push(p);
|
|
794
|
+
if (!files2[testName2]) {
|
|
795
|
+
files2[testName2] = /* @__PURE__ */ new Set();
|
|
796
|
+
}
|
|
797
|
+
files2[testName2].add(fp);
|
|
798
|
+
return p;
|
|
799
|
+
}
|
|
800
|
+
);
|
|
801
|
+
page.exposeFunction("existsSync", (fp, contents) => {
|
|
802
|
+
return fs2.existsSync(fp);
|
|
803
|
+
});
|
|
804
|
+
page.exposeFunction("mkdirSync", (fp) => {
|
|
805
|
+
if (!fs2.existsSync(fp)) {
|
|
806
|
+
return fs2.mkdirSync(fp, {
|
|
807
|
+
recursive: true
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
return false;
|
|
811
|
+
});
|
|
812
|
+
page.exposeFunction(
|
|
399
813
|
"createWriteStream",
|
|
400
|
-
(fp,
|
|
401
|
-
const f =
|
|
402
|
-
|
|
814
|
+
(fp, testName2) => {
|
|
815
|
+
const f = fs2.createWriteStream(fp);
|
|
816
|
+
files2[testName2].add(fp);
|
|
403
817
|
const p = new Promise((res2, rej2) => {
|
|
404
818
|
res2(fp);
|
|
405
819
|
});
|
|
@@ -471,7 +885,7 @@ ${addableFiles.map((x) => {
|
|
|
471
885
|
process.exit(-1);
|
|
472
886
|
}
|
|
473
887
|
const builtfile = dest + ".mjs";
|
|
474
|
-
|
|
888
|
+
await import(`${builtfile}?cacheBust=${Date.now()}`).then((module) => {
|
|
475
889
|
return module.default.then((defaultModule) => {
|
|
476
890
|
const s = new defaultModule();
|
|
477
891
|
s.receiveTestResourceConfig(argz);
|
|
@@ -483,14 +897,18 @@ ${addableFiles.map((x) => {
|
|
|
483
897
|
}
|
|
484
898
|
}
|
|
485
899
|
};
|
|
486
|
-
this.launchWeb = (
|
|
487
|
-
console.log(ansiC.green(ansiC.inverse(`! web ${
|
|
488
|
-
this.
|
|
900
|
+
this.launchWeb = async (src, dest) => {
|
|
901
|
+
console.log(ansiC.green(ansiC.inverse(`! web ${src}`)));
|
|
902
|
+
this.bddTestIsRunning(src);
|
|
903
|
+
const reportDest = `testeranto/reports/${this.name}/${src.split(".").slice(0, -1).join(".")}/web`;
|
|
904
|
+
if (!fs2.existsSync(reportDest)) {
|
|
905
|
+
fs2.mkdirSync(reportDest, { recursive: true });
|
|
906
|
+
}
|
|
489
907
|
const destFolder = dest.replace(".mjs", "");
|
|
490
908
|
const webArgz = JSON.stringify({
|
|
491
909
|
name: dest,
|
|
492
910
|
ports: [].toString(),
|
|
493
|
-
fs:
|
|
911
|
+
fs: reportDest,
|
|
494
912
|
browserWSEndpoint: this.browser.wsEndpoint()
|
|
495
913
|
});
|
|
496
914
|
const d = `${dest}?cacheBust=${Date.now()}`;
|
|
@@ -504,200 +922,72 @@ ${addableFiles.map((x) => {
|
|
|
504
922
|
console.log("fail", e)
|
|
505
923
|
}
|
|
506
924
|
})`;
|
|
507
|
-
const
|
|
508
|
-
const doneFileStream2 = [];
|
|
509
|
-
const stdoutStream = fs.createWriteStream(`${destFolder}/stdout.log`);
|
|
510
|
-
const stderrStream = fs.createWriteStream(`${destFolder}/stderr.log`);
|
|
925
|
+
const oStream = fs2.createWriteStream(`${reportDest}/console_log.txt`);
|
|
511
926
|
this.browser.newPage().then((page) => {
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
async (ssOpts, testName) => {
|
|
515
|
-
const p = ssOpts.path;
|
|
516
|
-
const dir = path2.dirname(p);
|
|
517
|
-
fs.mkdirSync(dir, {
|
|
518
|
-
recursive: true
|
|
519
|
-
});
|
|
520
|
-
if (!files[testName]) {
|
|
521
|
-
files[testName] = /* @__PURE__ */ new Set();
|
|
522
|
-
}
|
|
523
|
-
files[testName].add(ssOpts.path);
|
|
524
|
-
const sPromise = page.screenshot({
|
|
525
|
-
...ssOpts,
|
|
526
|
-
path: p
|
|
527
|
-
});
|
|
528
|
-
if (!screenshots[testName]) {
|
|
529
|
-
screenshots[testName] = [];
|
|
530
|
-
}
|
|
531
|
-
screenshots[testName].push(sPromise);
|
|
532
|
-
await sPromise;
|
|
533
|
-
return sPromise;
|
|
534
|
-
}
|
|
535
|
-
);
|
|
536
|
-
page.exposeFunction(
|
|
537
|
-
"customScreenShot",
|
|
538
|
-
async (ssOpts, testName) => {
|
|
539
|
-
const p = ssOpts.path;
|
|
540
|
-
const dir = path2.dirname(p);
|
|
541
|
-
fs.mkdirSync(dir, {
|
|
542
|
-
recursive: true
|
|
543
|
-
});
|
|
544
|
-
if (!files[testName]) {
|
|
545
|
-
files[testName] = /* @__PURE__ */ new Set();
|
|
546
|
-
}
|
|
547
|
-
files[testName].add(ssOpts.path);
|
|
548
|
-
const sPromise = page.screenshot({
|
|
549
|
-
...ssOpts,
|
|
550
|
-
path: p
|
|
551
|
-
});
|
|
552
|
-
if (!screenshots[testName]) {
|
|
553
|
-
screenshots[testName] = [];
|
|
554
|
-
}
|
|
555
|
-
screenshots[testName].push(sPromise);
|
|
556
|
-
await sPromise;
|
|
557
|
-
return sPromise;
|
|
558
|
-
}
|
|
559
|
-
);
|
|
560
|
-
page.exposeFunction(
|
|
561
|
-
"writeFileSync",
|
|
562
|
-
(fp, contents, testName) => {
|
|
563
|
-
return globalThis["writeFileSync"](fp, contents, testName);
|
|
564
|
-
}
|
|
565
|
-
);
|
|
566
|
-
page.exposeFunction("existsSync", (fp, contents) => {
|
|
567
|
-
return fs.existsSync(fp);
|
|
568
|
-
});
|
|
569
|
-
page.exposeFunction("mkdirSync", (fp) => {
|
|
570
|
-
if (!fs.existsSync(fp)) {
|
|
571
|
-
return fs.mkdirSync(fp, {
|
|
572
|
-
recursive: true
|
|
573
|
-
});
|
|
574
|
-
}
|
|
575
|
-
return false;
|
|
576
|
-
});
|
|
577
|
-
page.exposeFunction(
|
|
578
|
-
"createWriteStream",
|
|
579
|
-
(fp, testName) => {
|
|
580
|
-
const f = fs.createWriteStream(fp);
|
|
581
|
-
if (!files[testName]) {
|
|
582
|
-
files[testName] = /* @__PURE__ */ new Set();
|
|
583
|
-
}
|
|
584
|
-
files[testName].add(fp);
|
|
585
|
-
const p = new Promise((res, rej) => {
|
|
586
|
-
res(fp);
|
|
587
|
-
});
|
|
588
|
-
doneFileStream2.push(p);
|
|
589
|
-
f.on("close", async () => {
|
|
590
|
-
await p;
|
|
591
|
-
});
|
|
592
|
-
fileStreams2.push(f);
|
|
593
|
-
return {
|
|
594
|
-
...JSON.parse(JSON.stringify(f)),
|
|
595
|
-
uid: fileStreams2.length - 1
|
|
596
|
-
};
|
|
597
|
-
}
|
|
598
|
-
);
|
|
599
|
-
page.exposeFunction("write", async (uid, contents) => {
|
|
600
|
-
return fileStreams2[uid].write(contents);
|
|
601
|
-
});
|
|
602
|
-
page.exposeFunction("end", async (uid) => {
|
|
603
|
-
return fileStreams2[uid].end();
|
|
604
|
-
});
|
|
605
|
-
page.exposeFunction("page", () => {
|
|
606
|
-
return page.mainFrame()._id;
|
|
607
|
-
});
|
|
608
|
-
page.exposeFunction("click", (sel) => {
|
|
609
|
-
return page.click(sel);
|
|
610
|
-
});
|
|
611
|
-
page.exposeFunction("focusOn", (sel) => {
|
|
612
|
-
return page.focus(sel);
|
|
613
|
-
});
|
|
614
|
-
page.exposeFunction(
|
|
615
|
-
"typeInto",
|
|
616
|
-
async (value) => await page.keyboard.type(value)
|
|
617
|
-
);
|
|
618
|
-
page.exposeFunction(
|
|
619
|
-
"getValue",
|
|
620
|
-
(selector) => page.$eval(selector, (input) => input.getAttribute("value"))
|
|
621
|
-
);
|
|
622
|
-
page.exposeFunction(
|
|
623
|
-
"getAttribute",
|
|
624
|
-
async (selector, attribute) => {
|
|
625
|
-
const attributeValue = await page.$eval(selector, (input) => {
|
|
626
|
-
return input.getAttribute(attribute);
|
|
627
|
-
});
|
|
628
|
-
return attributeValue;
|
|
629
|
-
}
|
|
630
|
-
);
|
|
631
|
-
page.exposeFunction("isDisabled", async (selector) => {
|
|
632
|
-
const attributeValue = await page.$eval(
|
|
633
|
-
selector,
|
|
634
|
-
(input) => {
|
|
635
|
-
return input.disabled;
|
|
636
|
-
}
|
|
637
|
-
);
|
|
638
|
-
return attributeValue;
|
|
639
|
-
});
|
|
640
|
-
page.exposeFunction("$", async (selector) => {
|
|
641
|
-
const x = page.$(selector);
|
|
642
|
-
const y = await x;
|
|
643
|
-
return y;
|
|
927
|
+
this.mapping().forEach(async ([command, func]) => {
|
|
928
|
+
page.exposeFunction(command, func);
|
|
644
929
|
});
|
|
645
930
|
return page;
|
|
646
931
|
}).then(async (page) => {
|
|
647
932
|
const close = () => {
|
|
648
|
-
if (!
|
|
649
|
-
|
|
933
|
+
if (!files2[src]) {
|
|
934
|
+
files2[src] = /* @__PURE__ */ new Set();
|
|
650
935
|
}
|
|
651
|
-
|
|
936
|
+
fs2.writeFileSync(
|
|
652
937
|
destFolder + "/manifest.json",
|
|
653
|
-
JSON.stringify(Array.from(
|
|
938
|
+
JSON.stringify(Array.from(files2[src]))
|
|
654
939
|
);
|
|
655
|
-
delete
|
|
656
|
-
Promise.all(
|
|
657
|
-
delete
|
|
940
|
+
delete files2[src];
|
|
941
|
+
Promise.all(screenshots2[src] || []).then(() => {
|
|
942
|
+
delete screenshots2[src];
|
|
658
943
|
page.close();
|
|
659
|
-
|
|
660
|
-
stderrStream.close();
|
|
661
|
-
stdoutStream.close();
|
|
944
|
+
oStream.close();
|
|
662
945
|
});
|
|
663
946
|
};
|
|
664
947
|
page.on("pageerror", (err) => {
|
|
665
|
-
console.debug(`Error from ${
|
|
666
|
-
|
|
948
|
+
console.debug(`Error from ${src}: [${err.name}] `);
|
|
949
|
+
oStream.write(err.name);
|
|
950
|
+
oStream.write("\n");
|
|
667
951
|
if (err.cause) {
|
|
668
|
-
console.debug(`Error from ${
|
|
669
|
-
|
|
952
|
+
console.debug(`Error from ${src} cause: [${err.cause}] `);
|
|
953
|
+
oStream.write(err.cause);
|
|
954
|
+
oStream.write("\n");
|
|
670
955
|
}
|
|
671
956
|
if (err.stack) {
|
|
672
|
-
console.debug(`Error from stack ${
|
|
673
|
-
|
|
957
|
+
console.debug(`Error from stack ${src}: [${err.stack}] `);
|
|
958
|
+
oStream.write(err.stack);
|
|
959
|
+
oStream.write("\n");
|
|
674
960
|
}
|
|
675
|
-
console.debug(`Error from message ${
|
|
676
|
-
|
|
961
|
+
console.debug(`Error from message ${src}: [${err.message}] `);
|
|
962
|
+
oStream.write(err.message);
|
|
963
|
+
oStream.write("\n");
|
|
964
|
+
this.bddTestIsNowDone(src, -1);
|
|
677
965
|
close();
|
|
678
966
|
});
|
|
679
967
|
page.on("console", (log) => {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
968
|
+
oStream.write(log.text());
|
|
969
|
+
oStream.write(JSON.stringify(log.location()));
|
|
970
|
+
oStream.write(JSON.stringify(log.stackTrace()));
|
|
971
|
+
oStream.write("\n");
|
|
683
972
|
});
|
|
684
973
|
await page.goto(`file://${`${destFolder}.html`}`, {});
|
|
685
|
-
await page.evaluate(evaluation).then(async ({ failed, features }) => {
|
|
686
|
-
this.receiveFeatures(features, destFolder,
|
|
687
|
-
statusMessagePretty(
|
|
688
|
-
this.
|
|
974
|
+
await page.evaluate(evaluation).then(async ({ fails, failed, features }) => {
|
|
975
|
+
this.receiveFeatures(features, destFolder, src, "web");
|
|
976
|
+
statusMessagePretty(fails, src);
|
|
977
|
+
this.bddTestIsNowDone(src, fails);
|
|
689
978
|
}).catch((e) => {
|
|
690
|
-
console.log(ansiC.red(ansiC.inverse(`${
|
|
979
|
+
console.log(ansiC.red(ansiC.inverse(`${src} errored with: ${e}`)));
|
|
691
980
|
}).finally(() => {
|
|
981
|
+
this.bddTestIsNowDone(src, -1);
|
|
692
982
|
close();
|
|
693
983
|
});
|
|
694
984
|
return page;
|
|
695
985
|
});
|
|
696
986
|
};
|
|
697
|
-
this.receiveFeatures = (features, destFolder, srcTest) => {
|
|
698
|
-
const featureDestination =
|
|
987
|
+
this.receiveFeatures = (features, destFolder, srcTest, platform) => {
|
|
988
|
+
const featureDestination = path3.resolve(
|
|
699
989
|
process.cwd(),
|
|
700
|
-
"
|
|
990
|
+
"reports",
|
|
701
991
|
"features",
|
|
702
992
|
"strings",
|
|
703
993
|
srcTest.split(".").slice(0, -1).join(".") + ".features.txt"
|
|
@@ -708,53 +998,48 @@ ${addableFiles.map((x) => {
|
|
|
708
998
|
if (isUrl) {
|
|
709
999
|
const u = new URL(featureStringKey);
|
|
710
1000
|
if (u.protocol === "file:") {
|
|
711
|
-
const newPath = `${process.cwd()}/
|
|
1001
|
+
const newPath = `${process.cwd()}/testeranto/features/internal/${path3.relative(
|
|
712
1002
|
process.cwd(),
|
|
713
1003
|
u.pathname
|
|
714
1004
|
)}`;
|
|
715
|
-
await
|
|
1005
|
+
await fs2.promises.mkdir(path3.dirname(newPath), { recursive: true });
|
|
716
1006
|
try {
|
|
717
|
-
await
|
|
1007
|
+
await fs2.unlinkSync(newPath);
|
|
718
1008
|
} catch (error) {
|
|
719
1009
|
if (error.code !== "ENOENT") {
|
|
720
1010
|
}
|
|
721
1011
|
}
|
|
722
1012
|
accum.files.push(newPath);
|
|
723
1013
|
} else if (u.protocol === "http:" || u.protocol === "https:") {
|
|
724
|
-
const newPath = `${process.cwd()}/
|
|
1014
|
+
const newPath = `${process.cwd()}/testeranto/features/external${u.hostname}${u.pathname}`;
|
|
725
1015
|
const body = await this.configs.featureIngestor(featureStringKey);
|
|
726
1016
|
writeFileAndCreateDir(newPath, body);
|
|
727
1017
|
accum.files.push(newPath);
|
|
728
1018
|
}
|
|
729
1019
|
} else {
|
|
730
|
-
await
|
|
1020
|
+
await fs2.promises.mkdir(path3.dirname(featureDestination), {
|
|
731
1021
|
recursive: true
|
|
732
1022
|
});
|
|
733
1023
|
accum.strings.push(featureStringKey);
|
|
734
1024
|
}
|
|
735
1025
|
return accum;
|
|
736
|
-
}, Promise.resolve({ files: [], strings: [] })).then(({ files:
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
1026
|
+
}, Promise.resolve({ files: [], strings: [] })).then(({ files: files3, strings }) => {
|
|
1027
|
+
fs2.writeFileSync(
|
|
1028
|
+
`testeranto/reports/${this.name}/${srcTest.split(".").slice(0, -1).join(".")}/${platform}/featurePrompt.txt`,
|
|
1029
|
+
files3.map((f) => {
|
|
740
1030
|
return `/read ${f}`;
|
|
741
1031
|
}).join("\n")
|
|
742
1032
|
);
|
|
743
1033
|
});
|
|
744
1034
|
};
|
|
745
|
-
this.receiveExitCode = (srcTest, failures) => {
|
|
746
|
-
this.bigBoard[srcTest].runTimeError = failures;
|
|
747
|
-
this.writeBigBoard();
|
|
748
|
-
};
|
|
749
1035
|
this.writeBigBoard = () => {
|
|
750
|
-
|
|
751
|
-
|
|
1036
|
+
fs2.writeFileSync(
|
|
1037
|
+
`./testeranto/reports/${this.name}/summary.json`,
|
|
752
1038
|
JSON.stringify(this.bigBoard, null, 2)
|
|
753
1039
|
);
|
|
754
1040
|
};
|
|
755
|
-
this.
|
|
756
|
-
this.
|
|
757
|
-
this.configs = configs;
|
|
1041
|
+
this.name = name;
|
|
1042
|
+
this.mode = mode2;
|
|
758
1043
|
this.ports = {};
|
|
759
1044
|
this.configs.tests.forEach(([t]) => {
|
|
760
1045
|
this.bigBoard[t] = {
|
|
@@ -767,362 +1052,186 @@ ${addableFiles.map((x) => {
|
|
|
767
1052
|
this.configs.ports.forEach((element) => {
|
|
768
1053
|
this.ports[element] = "true";
|
|
769
1054
|
});
|
|
770
|
-
globalThis["waitForSelector"] = async (pageKey, sel) => {
|
|
771
|
-
const page = (await this.browser.pages()).find(
|
|
772
|
-
/* @ts-ignore:next-line */
|
|
773
|
-
(p) => p.mainFrame()._id === pageKey
|
|
774
|
-
);
|
|
775
|
-
await page?.waitForSelector(sel);
|
|
776
|
-
};
|
|
777
|
-
globalThis["screencastStop"] = async (path3) => {
|
|
778
|
-
return recorders[path3].stop();
|
|
779
|
-
};
|
|
780
|
-
globalThis["closePage"] = async (pageKey) => {
|
|
781
|
-
const page = (await this.browser.pages()).find(
|
|
782
|
-
/* @ts-ignore:next-line */
|
|
783
|
-
(p) => p.mainFrame()._id === pageKey
|
|
784
|
-
);
|
|
785
|
-
return page.close();
|
|
786
|
-
};
|
|
787
|
-
globalThis["goto"] = async (pageKey, url) => {
|
|
788
|
-
const page = (await this.browser.pages()).find(
|
|
789
|
-
/* @ts-ignore:next-line */
|
|
790
|
-
(p) => p.mainFrame()._id === pageKey
|
|
791
|
-
);
|
|
792
|
-
await page?.goto(url);
|
|
793
|
-
return;
|
|
794
|
-
};
|
|
795
|
-
globalThis["newPage"] = () => {
|
|
796
|
-
return this.browser.newPage();
|
|
797
|
-
};
|
|
798
|
-
globalThis["pages"] = () => {
|
|
799
|
-
return this.browser.pages();
|
|
800
|
-
};
|
|
801
|
-
globalThis["mkdirSync"] = (fp) => {
|
|
802
|
-
if (!fs.existsSync(fp)) {
|
|
803
|
-
return fs.mkdirSync(fp, {
|
|
804
|
-
recursive: true
|
|
805
|
-
});
|
|
806
|
-
}
|
|
807
|
-
return false;
|
|
808
|
-
};
|
|
809
|
-
globalThis["writeFileSync"] = (filepath, contents, testName) => {
|
|
810
|
-
fs.mkdirSync(path2.dirname(filepath), {
|
|
811
|
-
recursive: true
|
|
812
|
-
});
|
|
813
|
-
if (!files[testName]) {
|
|
814
|
-
files[testName] = /* @__PURE__ */ new Set();
|
|
815
|
-
}
|
|
816
|
-
files[testName].add(filepath);
|
|
817
|
-
return fs.writeFileSync(filepath, contents);
|
|
818
|
-
};
|
|
819
|
-
globalThis["createWriteStream"] = (filepath, testName) => {
|
|
820
|
-
const f = fs.createWriteStream(filepath);
|
|
821
|
-
fileStreams3.push(f);
|
|
822
|
-
if (!files[testName]) {
|
|
823
|
-
files[testName] = /* @__PURE__ */ new Set();
|
|
824
|
-
}
|
|
825
|
-
files[testName].add(filepath);
|
|
826
|
-
return {
|
|
827
|
-
...JSON.parse(JSON.stringify(f)),
|
|
828
|
-
uid: fileStreams3.length - 1
|
|
829
|
-
};
|
|
830
|
-
};
|
|
831
|
-
globalThis["write"] = (uid, contents) => {
|
|
832
|
-
fileStreams3[uid].write(contents);
|
|
833
|
-
};
|
|
834
|
-
globalThis["end"] = (uid) => {
|
|
835
|
-
fileStreams3[uid].end();
|
|
836
|
-
};
|
|
837
|
-
globalThis["customScreenShot"] = async (opts, pageKey, testName) => {
|
|
838
|
-
const page = (await this.browser.pages()).find(
|
|
839
|
-
/* @ts-ignore:next-line */
|
|
840
|
-
(p2) => p2.mainFrame()._id === pageKey
|
|
841
|
-
);
|
|
842
|
-
const p = opts.path;
|
|
843
|
-
const dir = path2.dirname(p);
|
|
844
|
-
fs.mkdirSync(dir, {
|
|
845
|
-
recursive: true
|
|
846
|
-
});
|
|
847
|
-
if (!files[opts.path]) {
|
|
848
|
-
files[opts.path] = /* @__PURE__ */ new Set();
|
|
849
|
-
}
|
|
850
|
-
files[opts.path].add(opts.path);
|
|
851
|
-
const sPromise = page.screenshot({
|
|
852
|
-
...opts,
|
|
853
|
-
path: p
|
|
854
|
-
});
|
|
855
|
-
if (!screenshots[opts.path]) {
|
|
856
|
-
screenshots[opts.path] = [];
|
|
857
|
-
}
|
|
858
|
-
screenshots[opts.path].push(sPromise);
|
|
859
|
-
await sPromise;
|
|
860
|
-
return sPromise;
|
|
861
|
-
};
|
|
862
|
-
globalThis["screencast"] = async (opts, pageKey) => {
|
|
863
|
-
const page = (await this.browser.pages()).find(
|
|
864
|
-
/* @ts-ignore:next-line */
|
|
865
|
-
(p2) => p2.mainFrame()._id === pageKey
|
|
866
|
-
);
|
|
867
|
-
const p = opts.path;
|
|
868
|
-
const dir = path2.dirname(p);
|
|
869
|
-
fs.mkdirSync(dir, {
|
|
870
|
-
recursive: true
|
|
871
|
-
});
|
|
872
|
-
const recorder = await page?.screencast({
|
|
873
|
-
...opts,
|
|
874
|
-
path: p
|
|
875
|
-
});
|
|
876
|
-
recorders[opts.path] = recorder;
|
|
877
|
-
return opts.path;
|
|
878
|
-
};
|
|
879
|
-
}
|
|
880
|
-
customclose() {
|
|
881
|
-
throw new Error("Method not implemented.");
|
|
882
|
-
}
|
|
883
|
-
waitForSelector(p, s) {
|
|
884
|
-
throw new Error("Method not implemented.");
|
|
885
1055
|
}
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
return fs.mkdirSync(fp, {
|
|
913
|
-
recursive: true
|
|
914
|
-
});
|
|
915
|
-
}
|
|
916
|
-
return false;
|
|
917
|
-
}
|
|
918
|
-
writeFileSync(fp, contents) {
|
|
919
|
-
fs.writeFileSync(fp, contents);
|
|
920
|
-
}
|
|
921
|
-
createWriteStream(filepath) {
|
|
922
|
-
return fs.createWriteStream(filepath);
|
|
923
|
-
}
|
|
924
|
-
testArtiFactoryfileWriter(tLog, callback) {
|
|
925
|
-
return (fPath, value) => {
|
|
926
|
-
callback(
|
|
927
|
-
new Promise((res, rej) => {
|
|
928
|
-
tLog("testArtiFactory =>", fPath);
|
|
929
|
-
const cleanPath = path2.resolve(fPath);
|
|
930
|
-
fPaths.push(cleanPath.replace(process.cwd(), ``));
|
|
931
|
-
const targetDir = cleanPath.split("/").slice(0, -1).join("/");
|
|
932
|
-
fs.mkdir(targetDir, { recursive: true }, async (error) => {
|
|
933
|
-
if (error) {
|
|
934
|
-
console.error(`\u2757\uFE0FtestArtiFactory failed`, targetDir, error);
|
|
935
|
-
}
|
|
936
|
-
fs.writeFileSync(
|
|
937
|
-
path2.resolve(
|
|
938
|
-
targetDir.split("/").slice(0, -1).join("/"),
|
|
939
|
-
"manifest"
|
|
940
|
-
),
|
|
941
|
-
fPaths.join(`
|
|
942
|
-
`),
|
|
943
|
-
{
|
|
944
|
-
encoding: "utf-8"
|
|
945
|
-
}
|
|
946
|
-
);
|
|
947
|
-
if (Buffer.isBuffer(value)) {
|
|
948
|
-
fs.writeFileSync(fPath, value, "binary");
|
|
949
|
-
res();
|
|
950
|
-
} else if (`string` === typeof value) {
|
|
951
|
-
fs.writeFileSync(fPath, value.toString(), {
|
|
952
|
-
encoding: "utf-8"
|
|
953
|
-
});
|
|
954
|
-
res();
|
|
955
|
-
} else {
|
|
956
|
-
const pipeStream = value;
|
|
957
|
-
const myFile = fs.createWriteStream(fPath);
|
|
958
|
-
pipeStream.pipe(myFile);
|
|
959
|
-
pipeStream.on("close", () => {
|
|
960
|
-
myFile.close();
|
|
961
|
-
res();
|
|
962
|
-
});
|
|
963
|
-
}
|
|
964
|
-
});
|
|
965
|
-
})
|
|
966
|
-
);
|
|
967
|
-
};
|
|
968
|
-
}
|
|
969
|
-
write(accessObject, contents) {
|
|
970
|
-
throw new Error("Method not implemented.");
|
|
971
|
-
}
|
|
972
|
-
page() {
|
|
973
|
-
throw new Error("Method not implemented.");
|
|
974
|
-
}
|
|
975
|
-
click(selector) {
|
|
976
|
-
throw new Error("Method not implemented.");
|
|
977
|
-
}
|
|
978
|
-
focusOn(selector) {
|
|
979
|
-
throw new Error("Method not implemented.");
|
|
980
|
-
}
|
|
981
|
-
typeInto(value) {
|
|
982
|
-
throw new Error("Method not implemented.");
|
|
983
|
-
}
|
|
984
|
-
getValue(value) {
|
|
985
|
-
throw new Error("Method not implemented.");
|
|
986
|
-
}
|
|
987
|
-
getAttribute(selector, attribute) {
|
|
988
|
-
throw new Error("Method not implemented.");
|
|
989
|
-
}
|
|
990
|
-
isDisabled(selector) {
|
|
991
|
-
throw new Error("Method not implemented.");
|
|
992
|
-
}
|
|
993
|
-
screencastStop(s) {
|
|
994
|
-
throw new Error("Method not implemented.");
|
|
995
|
-
}
|
|
996
|
-
////////////////////////////////////////////////////////////////////////////////
|
|
997
|
-
async metafileOutputs(platform) {
|
|
998
|
-
const metafile = JSON.parse(
|
|
999
|
-
fs.readFileSync(`docs/${platform}/metafile.json`).toString()
|
|
1000
|
-
).metafile;
|
|
1001
|
-
if (!metafile)
|
|
1002
|
-
return;
|
|
1003
|
-
const outputs = metafile.outputs;
|
|
1004
|
-
Object.keys(outputs).forEach(async (k) => {
|
|
1005
|
-
const addableFiles = Object.keys(outputs[k].inputs).filter((i) => {
|
|
1006
|
-
if (!fs.existsSync(i))
|
|
1007
|
-
return false;
|
|
1008
|
-
if (i.startsWith("node_modules"))
|
|
1009
|
-
return false;
|
|
1010
|
-
return true;
|
|
1011
|
-
});
|
|
1012
|
-
const f = `${k.split(".").slice(0, -1).join(".")}/`;
|
|
1013
|
-
if (!fs.existsSync(f)) {
|
|
1014
|
-
fs.mkdirSync(f);
|
|
1015
|
-
}
|
|
1016
|
-
const entrypoint = outputs[k].entryPoint;
|
|
1017
|
-
if (entrypoint) {
|
|
1018
|
-
const changeDigest = await filesHash(addableFiles);
|
|
1019
|
-
if (changeDigest === changes[entrypoint]) {
|
|
1020
|
-
} else {
|
|
1021
|
-
changes[entrypoint] = changeDigest;
|
|
1022
|
-
this.tscCheck({
|
|
1023
|
-
platform,
|
|
1024
|
-
addableFiles,
|
|
1025
|
-
entrypoint: "./" + entrypoint
|
|
1026
|
-
});
|
|
1027
|
-
this.eslintCheck("./" + entrypoint, platform, addableFiles);
|
|
1028
|
-
this.makePrompt("./" + entrypoint, addableFiles, platform);
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
});
|
|
1056
|
+
mapping() {
|
|
1057
|
+
return [
|
|
1058
|
+
["$", this.$],
|
|
1059
|
+
["click", this.click],
|
|
1060
|
+
["closePage", this.closePage],
|
|
1061
|
+
["createWriteStream", this.createWriteStream],
|
|
1062
|
+
["customclose", this.customclose],
|
|
1063
|
+
["customScreenShot", this.customScreenShot],
|
|
1064
|
+
["end", this.end],
|
|
1065
|
+
["existsSync", this.existsSync],
|
|
1066
|
+
["focusOn", this.focusOn],
|
|
1067
|
+
["getAttribute", this.getAttribute],
|
|
1068
|
+
["getValue", this.getValue],
|
|
1069
|
+
["goto", this.goto],
|
|
1070
|
+
["isDisabled", this.isDisabled],
|
|
1071
|
+
["mkdirSync", this.mkdirSync],
|
|
1072
|
+
["newPage", this.newPage],
|
|
1073
|
+
["page", this.page],
|
|
1074
|
+
["pages", this.pages],
|
|
1075
|
+
["screencast", this.screencast],
|
|
1076
|
+
["screencastStop", this.screencastStop],
|
|
1077
|
+
["typeInto", this.typeInto],
|
|
1078
|
+
["waitForSelector", this.waitForSelector],
|
|
1079
|
+
["write", this.write],
|
|
1080
|
+
["writeFileSync", this.writeFileSync]
|
|
1081
|
+
];
|
|
1032
1082
|
}
|
|
1033
1083
|
async start() {
|
|
1084
|
+
this.mapping().forEach(async ([command, func]) => {
|
|
1085
|
+
globalThis[command] = func;
|
|
1086
|
+
});
|
|
1087
|
+
if (!fs2.existsSync(`testeranto/reports/${this.name}`)) {
|
|
1088
|
+
fs2.mkdirSync(`testeranto/reports/${this.name}`);
|
|
1089
|
+
}
|
|
1034
1090
|
this.browser = await puppeteer.launch({
|
|
1035
1091
|
slowMo: 1,
|
|
1036
|
-
// timeout: 1,
|
|
1037
1092
|
waitForInitialPage: false,
|
|
1038
1093
|
executablePath: (
|
|
1039
1094
|
// process.env.CHROMIUM_PATH || "/opt/homebrew/bin/chromium",
|
|
1040
1095
|
"/opt/homebrew/bin/chromium"
|
|
1041
1096
|
),
|
|
1042
1097
|
headless: true,
|
|
1043
|
-
dumpio:
|
|
1044
|
-
|
|
1045
|
-
devtools: true,
|
|
1098
|
+
dumpio: false,
|
|
1099
|
+
devtools: false,
|
|
1046
1100
|
args: [
|
|
1047
|
-
"--auto-open-devtools-for-tabs",
|
|
1048
|
-
`--remote-debugging-port=3234`,
|
|
1049
|
-
// "--disable-features=IsolateOrigins,site-per-process",
|
|
1050
|
-
"--disable-site-isolation-trials",
|
|
1051
|
-
"--allow-insecure-localhost",
|
|
1052
1101
|
"--allow-file-access-from-files",
|
|
1102
|
+
"--allow-insecure-localhost",
|
|
1053
1103
|
"--allow-running-insecure-content",
|
|
1104
|
+
"--auto-open-devtools-for-tabs",
|
|
1054
1105
|
"--disable-dev-shm-usage",
|
|
1055
1106
|
"--disable-extensions",
|
|
1056
1107
|
"--disable-gpu",
|
|
1057
1108
|
"--disable-setuid-sandbox",
|
|
1058
1109
|
"--disable-site-isolation-trials",
|
|
1110
|
+
"--disable-site-isolation-trials",
|
|
1059
1111
|
"--disable-web-security",
|
|
1060
1112
|
"--no-first-run",
|
|
1061
1113
|
"--no-sandbox",
|
|
1062
1114
|
"--no-startup-window",
|
|
1063
|
-
// "--no-zygote",
|
|
1064
1115
|
"--reduce-security-for-testing",
|
|
1065
1116
|
"--remote-allow-origins=*",
|
|
1117
|
+
`--remote-debugging-port=3234`,
|
|
1066
1118
|
"--unsafely-treat-insecure-origin-as-secure=*"
|
|
1119
|
+
// "--disable-features=IsolateOrigins,site-per-process",
|
|
1067
1120
|
// "--disable-features=IsolateOrigins",
|
|
1121
|
+
// "--disk-cache-dir=/dev/null",
|
|
1122
|
+
// "--disk-cache-size=1",
|
|
1123
|
+
// "--no-zygote",
|
|
1068
1124
|
// "--remote-allow-origins=ws://localhost:3234",
|
|
1069
1125
|
// "--single-process",
|
|
1126
|
+
// "--start-maximized",
|
|
1070
1127
|
// "--unsafely-treat-insecure-origin-as-secure",
|
|
1071
1128
|
// "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
|
|
1072
|
-
// "--disk-cache-dir=/dev/null",
|
|
1073
|
-
// "--disk-cache-size=1",
|
|
1074
|
-
// "--start-maximized",
|
|
1075
1129
|
]
|
|
1076
1130
|
});
|
|
1077
|
-
const { nodeEntryPoints, webEntryPoints } = getRunnables(
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
const hash = await fileHash(outputFile);
|
|
1086
|
-
if (fileHashes[k] !== hash) {
|
|
1087
|
-
fileHashes[k] = hash;
|
|
1088
|
-
console.log(ansiC.green(ansiC.inverse(`< ${e} ${filename}`)));
|
|
1089
|
-
this.launchNode(k, outputFile);
|
|
1090
|
-
}
|
|
1091
|
-
});
|
|
1092
|
-
} catch (e) {
|
|
1093
|
-
console.error(e);
|
|
1131
|
+
const { nodeEntryPoints, webEntryPoints, importEntryPoints } = this.getRunnables(this.configs.tests, this.name);
|
|
1132
|
+
[
|
|
1133
|
+
[
|
|
1134
|
+
nodeEntryPoints,
|
|
1135
|
+
this.launchNode,
|
|
1136
|
+
"node",
|
|
1137
|
+
(w) => {
|
|
1138
|
+
this.nodeMetafileWatcher = w;
|
|
1094
1139
|
}
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1140
|
+
],
|
|
1141
|
+
[
|
|
1142
|
+
webEntryPoints,
|
|
1143
|
+
this.launchWeb,
|
|
1144
|
+
"web",
|
|
1145
|
+
(w) => {
|
|
1146
|
+
this.webMetafileWatcher = w;
|
|
1147
|
+
}
|
|
1148
|
+
],
|
|
1149
|
+
[
|
|
1150
|
+
importEntryPoints,
|
|
1151
|
+
this.launchPure,
|
|
1152
|
+
"pure",
|
|
1153
|
+
(w) => {
|
|
1154
|
+
this.importMetafileWatcher = w;
|
|
1155
|
+
}
|
|
1156
|
+
]
|
|
1157
|
+
].forEach(
|
|
1158
|
+
async ([eps, launcher, runtime, watcher]) => {
|
|
1159
|
+
const metafile = `./testeranto/bundles/${runtime}/${this.name}/metafile.json`;
|
|
1160
|
+
await pollForFile(metafile);
|
|
1161
|
+
Object.entries(eps).forEach(
|
|
1162
|
+
async ([k, outputFile]) => {
|
|
1163
|
+
launcher(k, outputFile);
|
|
1164
|
+
try {
|
|
1165
|
+
watch(outputFile, async (e, filename) => {
|
|
1166
|
+
const hash = await fileHash(outputFile);
|
|
1167
|
+
if (fileHashes[k] !== hash) {
|
|
1168
|
+
fileHashes[k] = hash;
|
|
1169
|
+
console.log(ansiC.green(ansiC.inverse(`< ${e} ${filename}`)));
|
|
1170
|
+
launcher(k, outputFile);
|
|
1171
|
+
}
|
|
1172
|
+
});
|
|
1173
|
+
} catch (e) {
|
|
1174
|
+
console.error(e);
|
|
1175
|
+
}
|
|
1106
1176
|
}
|
|
1107
|
-
|
|
1177
|
+
);
|
|
1178
|
+
this.metafileOutputs(runtime);
|
|
1179
|
+
watcher(
|
|
1180
|
+
watch(metafile, async (e, filename) => {
|
|
1181
|
+
console.log(
|
|
1182
|
+
ansiC.green(ansiC.inverse(`< ${e} ${filename} (${runtime})`))
|
|
1183
|
+
);
|
|
1184
|
+
this.metafileOutputs(runtime);
|
|
1185
|
+
})
|
|
1186
|
+
);
|
|
1108
1187
|
}
|
|
1109
1188
|
);
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1189
|
+
}
|
|
1190
|
+
async stop() {
|
|
1191
|
+
console.log(ansiC.inverse("Testeranto-Run is shutting down gracefully..."));
|
|
1192
|
+
this.mode = "once";
|
|
1193
|
+
this.nodeMetafileWatcher.close();
|
|
1194
|
+
this.webMetafileWatcher.close();
|
|
1195
|
+
this.importMetafileWatcher.close();
|
|
1196
|
+
this.checkForShutdown();
|
|
1197
|
+
}
|
|
1198
|
+
async metafileOutputs(platform) {
|
|
1199
|
+
const metafile = JSON.parse(
|
|
1200
|
+
fs2.readFileSync(
|
|
1201
|
+
`./testeranto/bundles/${platform}/${this.name}/metafile.json`
|
|
1202
|
+
).toString()
|
|
1203
|
+
).metafile;
|
|
1204
|
+
if (!metafile)
|
|
1205
|
+
return;
|
|
1206
|
+
const outputs = metafile.outputs;
|
|
1207
|
+
Object.keys(outputs).forEach(async (k) => {
|
|
1208
|
+
const addableFiles = Object.keys(outputs[k].inputs).filter((i) => {
|
|
1209
|
+
if (!fs2.existsSync(i))
|
|
1210
|
+
return false;
|
|
1211
|
+
if (i.startsWith("node_modules"))
|
|
1212
|
+
return false;
|
|
1213
|
+
return true;
|
|
1214
|
+
});
|
|
1215
|
+
const f = `${k.split(".").slice(0, -1).join(".")}/`;
|
|
1216
|
+
if (!fs2.existsSync(f)) {
|
|
1217
|
+
fs2.mkdirSync(f);
|
|
1116
1218
|
}
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1219
|
+
const entrypoint = outputs[k].entryPoint;
|
|
1220
|
+
if (entrypoint) {
|
|
1221
|
+
const changeDigest = await filesHash(addableFiles);
|
|
1222
|
+
if (changeDigest === changes[entrypoint]) {
|
|
1223
|
+
} else {
|
|
1224
|
+
changes[entrypoint] = changeDigest;
|
|
1225
|
+
this.tscCheck({
|
|
1226
|
+
platform,
|
|
1227
|
+
addableFiles,
|
|
1228
|
+
entrypoint: "./" + entrypoint
|
|
1229
|
+
});
|
|
1230
|
+
this.eslintCheck("./" + entrypoint, platform, addableFiles);
|
|
1231
|
+
this.makePrompt("./" + entrypoint, addableFiles, platform);
|
|
1232
|
+
}
|
|
1124
1233
|
}
|
|
1125
|
-
);
|
|
1234
|
+
});
|
|
1126
1235
|
}
|
|
1127
1236
|
};
|
|
1128
1237
|
|
|
@@ -1137,13 +1246,21 @@ process.stdin.on("keypress", (str, key) => {
|
|
|
1137
1246
|
process.exit(-1);
|
|
1138
1247
|
}
|
|
1139
1248
|
});
|
|
1140
|
-
|
|
1141
|
-
|
|
1249
|
+
var testName = process.argv[2];
|
|
1250
|
+
var mode = process.argv[3];
|
|
1251
|
+
if (mode !== "once" && mode !== "dev") {
|
|
1252
|
+
console.error("the 2nd argument should be 'dev' or 'once' ");
|
|
1253
|
+
process.exit(-1);
|
|
1254
|
+
}
|
|
1255
|
+
console.log("testeranto is running", testName, mode);
|
|
1256
|
+
import(process.cwd() + "/testeranto.config.ts").then(async (module) => {
|
|
1257
|
+
const bigConfig = module.default;
|
|
1258
|
+
const rawConfig = bigConfig.projects[testName];
|
|
1142
1259
|
const config = {
|
|
1143
1260
|
...rawConfig,
|
|
1144
|
-
buildDir: process.cwd() +
|
|
1261
|
+
buildDir: process.cwd() + `/testeranto/${testName}.json`
|
|
1145
1262
|
};
|
|
1146
|
-
const pm = new PM_Main(config);
|
|
1263
|
+
const pm = new PM_Main(config, testName, mode);
|
|
1147
1264
|
pm.start();
|
|
1148
1265
|
process.stdin.on("keypress", (str, key) => {
|
|
1149
1266
|
if (key.name === "q") {
|