@elench/testkit 0.1.65 → 0.1.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -62
- package/lib/app/browser-bridge.mjs +66 -0
- package/lib/app/configs.mjs +81 -0
- package/lib/app/configs.test.mjs +34 -0
- package/lib/app/doctor.mjs +139 -0
- package/lib/app/typecheck.mjs +203 -0
- package/lib/cli/command-helpers.mjs +2 -10
- package/lib/cli/commands/browser/serve.mjs +3 -62
- package/lib/cli/commands/doctor.mjs +39 -0
- package/lib/cli/commands/typecheck.mjs +28 -0
- package/lib/cli/db.mjs +3 -68
- package/lib/cli/entrypoint.mjs +2 -0
- package/lib/config/binaries.mjs +34 -0
- package/lib/config/database.mjs +9 -6
- package/lib/config/index.mjs +13 -31
- package/lib/config/runtime.mjs +35 -96
- package/lib/config/runtime.test.mjs +26 -0
- package/lib/config/validation.mjs +18 -62
- package/lib/coverage/backend-discovery.mjs +68 -85
- package/lib/coverage/backend-discovery.test.mjs +55 -46
- package/lib/coverage/graph-builder.mjs +5 -5
- package/lib/coverage/index.test.mjs +4 -2
- package/lib/coverage/next-ir-to-graph.mjs +0 -1
- package/lib/coverage/routing.mjs +2 -29
- package/lib/coverage/routing.test.mjs +0 -16
- package/lib/coverage/shared.mjs +22 -82
- package/lib/database/fingerprint.mjs +1 -1
- package/lib/discovery/file-metadata.mjs +122 -0
- package/lib/discovery/file-metadata.test.mjs +51 -0
- package/lib/discovery/index.mjs +10 -2
- package/lib/discovery/index.test.mjs +19 -19
- package/lib/known-failures/github-cache.mjs +159 -0
- package/lib/known-failures/github-transport.mjs +174 -0
- package/lib/known-failures/github.mjs +17 -325
- package/lib/runner/default-runtime-runner.mjs +4 -10
- package/lib/runner/execution-config.mjs +12 -83
- package/lib/runner/live-run.mjs +45 -0
- package/lib/runner/managed-processes.mjs +29 -0
- package/lib/runner/orchestrator.mjs +57 -188
- package/lib/runner/planning.mjs +10 -3
- package/lib/runner/planning.test.mjs +26 -0
- package/lib/runner/playwright-runner.mjs +4 -11
- package/lib/runner/run-finalization.mjs +132 -0
- package/lib/runner/run-guards.mjs +45 -0
- package/lib/runner/runtime-preparation.mjs +1 -1
- package/lib/runner/services.mjs +3 -4
- package/lib/runner/template-steps.mjs +8 -45
- package/lib/runner/template.mjs +7 -28
- package/lib/setup/index.d.ts +88 -21
- package/lib/setup/index.mjs +177 -50
- package/lib/setup/index.test.mjs +194 -64
- package/lib/shared/build-config.mjs +144 -0
- package/lib/shared/build-config.test.mjs +81 -0
- package/lib/shared/configured-steps.mjs +178 -0
- package/lib/shared/configured-steps.test.mjs +73 -0
- package/lib/shared/execution-schema.mjs +74 -0
- package/lib/shared/execution-schema.test.mjs +26 -0
- package/node_modules/@elench/next-analysis/dist/api-routes.d.ts +7 -0
- package/node_modules/@elench/next-analysis/dist/api-routes.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/api-routes.js +66 -0
- package/node_modules/@elench/next-analysis/dist/api-routes.js.map +1 -0
- package/node_modules/@elench/next-analysis/dist/app-root.d.ts +2 -0
- package/node_modules/@elench/next-analysis/dist/app-root.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/app-root.js +7 -0
- package/node_modules/@elench/next-analysis/dist/app-root.js.map +1 -0
- package/node_modules/@elench/next-analysis/dist/backend-links.d.ts +8 -0
- package/node_modules/@elench/next-analysis/dist/backend-links.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/backend-links.js +30 -0
- package/node_modules/@elench/next-analysis/dist/backend-links.js.map +1 -0
- package/node_modules/@elench/next-analysis/dist/index.d.ts +11 -0
- package/node_modules/@elench/next-analysis/dist/index.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/index.js +10 -0
- package/node_modules/@elench/next-analysis/dist/index.js.map +1 -0
- package/node_modules/@elench/next-analysis/dist/pages.d.ts +7 -0
- package/node_modules/@elench/next-analysis/dist/pages.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/pages.js +47 -0
- package/node_modules/@elench/next-analysis/dist/pages.js.map +1 -0
- package/node_modules/@elench/next-analysis/dist/project.d.ts +3 -0
- package/node_modules/@elench/next-analysis/dist/project.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/project.js +102 -0
- package/node_modules/@elench/next-analysis/dist/project.js.map +1 -0
- package/node_modules/@elench/next-analysis/dist/route-tree.d.ts +7 -0
- package/node_modules/@elench/next-analysis/dist/route-tree.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/route-tree.js +575 -0
- package/node_modules/@elench/next-analysis/dist/route-tree.js.map +1 -0
- package/node_modules/@elench/next-analysis/dist/routes.d.ts +6 -0
- package/node_modules/@elench/next-analysis/dist/routes.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/routes.js +41 -0
- package/node_modules/@elench/next-analysis/dist/routes.js.map +1 -0
- package/node_modules/@elench/next-analysis/dist/server-actions.d.ts +7 -0
- package/node_modules/@elench/next-analysis/dist/server-actions.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/server-actions.js +37 -0
- package/node_modules/@elench/next-analysis/dist/server-actions.js.map +1 -0
- package/node_modules/@elench/next-analysis/dist/shared.d.ts +57 -0
- package/node_modules/@elench/next-analysis/dist/shared.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/shared.js +229 -0
- package/node_modules/@elench/next-analysis/dist/shared.js.map +1 -0
- package/node_modules/@elench/next-analysis/dist/swc.d.ts +53 -0
- package/node_modules/@elench/next-analysis/dist/swc.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/swc.js +387 -0
- package/node_modules/@elench/next-analysis/dist/swc.js.map +1 -0
- package/node_modules/@elench/next-analysis/dist/types.d.ts +125 -0
- package/node_modules/@elench/next-analysis/dist/types.d.ts.map +1 -0
- package/node_modules/@elench/next-analysis/dist/types.js +2 -0
- package/node_modules/@elench/next-analysis/dist/types.js.map +1 -0
- package/node_modules/@elench/next-analysis/package.json +15 -2
- package/node_modules/@elench/testkit-bridge/dist/index.d.ts +36 -0
- package/node_modules/@elench/testkit-bridge/dist/index.d.ts.map +1 -0
- package/node_modules/@elench/testkit-bridge/dist/index.js +538 -0
- package/node_modules/@elench/testkit-bridge/dist/index.js.map +1 -0
- package/node_modules/@elench/testkit-bridge/package.json +16 -5
- package/node_modules/@elench/testkit-protocol/dist/index.d.ts +190 -0
- package/node_modules/@elench/testkit-protocol/dist/index.d.ts.map +1 -0
- package/node_modules/@elench/testkit-protocol/dist/index.js +296 -0
- package/node_modules/@elench/testkit-protocol/dist/index.js.map +1 -0
- package/node_modules/@elench/testkit-protocol/package.json +14 -7
- package/node_modules/@elench/ts-analysis/dist/callables.d.ts +8 -0
- package/node_modules/@elench/ts-analysis/dist/callables.d.ts.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/callables.js +126 -0
- package/node_modules/@elench/ts-analysis/dist/callables.js.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/exports.d.ts +6 -0
- package/node_modules/@elench/ts-analysis/dist/exports.d.ts.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/exports.js +70 -0
- package/node_modules/@elench/ts-analysis/dist/exports.js.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/index.d.ts +10 -0
- package/node_modules/@elench/ts-analysis/dist/index.d.ts.map +1 -0
- package/node_modules/@elench/ts-analysis/{src/index.mjs → dist/index.js} +9 -14
- package/node_modules/@elench/ts-analysis/dist/index.js.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/jsx.d.ts +9 -0
- package/node_modules/@elench/ts-analysis/dist/jsx.d.ts.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/jsx.js +68 -0
- package/node_modules/@elench/ts-analysis/dist/jsx.js.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/project.d.ts +5 -0
- package/node_modules/@elench/ts-analysis/dist/project.d.ts.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/project.js +90 -0
- package/node_modules/@elench/ts-analysis/dist/project.js.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/requests.d.ts +6 -0
- package/node_modules/@elench/ts-analysis/dist/requests.d.ts.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/requests.js +140 -0
- package/node_modules/@elench/ts-analysis/dist/requests.js.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/resolution.d.ts +4 -0
- package/node_modules/@elench/ts-analysis/dist/resolution.d.ts.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/resolution.js +53 -0
- package/node_modules/@elench/ts-analysis/dist/resolution.js.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/shared.d.ts +6 -0
- package/node_modules/@elench/ts-analysis/dist/shared.d.ts.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/shared.js +31 -0
- package/node_modules/@elench/ts-analysis/dist/shared.js.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/syntax.d.ts +7 -0
- package/node_modules/@elench/ts-analysis/dist/syntax.d.ts.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/syntax.js +27 -0
- package/node_modules/@elench/ts-analysis/dist/syntax.js.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/types.d.ts +58 -0
- package/node_modules/@elench/ts-analysis/dist/types.d.ts.map +1 -0
- package/node_modules/@elench/ts-analysis/dist/types.js +2 -0
- package/node_modules/@elench/ts-analysis/dist/types.js.map +1 -0
- package/node_modules/@elench/ts-analysis/package.json +18 -2
- package/node_modules/typescript/LICENSE.txt +55 -0
- package/node_modules/typescript/README.md +50 -0
- package/node_modules/typescript/SECURITY.md +41 -0
- package/node_modules/typescript/ThirdPartyNoticeText.txt +193 -0
- package/node_modules/typescript/bin/tsc +2 -0
- package/node_modules/typescript/bin/tsserver +2 -0
- package/node_modules/typescript/lib/_tsc.js +133818 -0
- package/node_modules/typescript/lib/_tsserver.js +659 -0
- package/node_modules/typescript/lib/_typingsInstaller.js +222 -0
- package/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/lib.d.ts +22 -0
- package/node_modules/typescript/lib/lib.decorators.d.ts +384 -0
- package/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
- package/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +41 -0
- package/node_modules/typescript/lib/lib.dom.d.ts +39429 -0
- package/node_modules/typescript/lib/lib.dom.iterable.d.ts +571 -0
- package/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
- package/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
- package/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
- package/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
- package/node_modules/typescript/lib/lib.es2015.iterable.d.ts +605 -0
- package/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
- package/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
- package/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
- package/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
- package/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
- package/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
- package/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
- package/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
- package/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
- package/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +21 -0
- package/node_modules/typescript/lib/lib.es2017.d.ts +26 -0
- package/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
- package/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
- package/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
- package/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
- package/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
- package/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
- package/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
- package/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
- package/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +53 -0
- package/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
- package/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
- package/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
- package/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
- package/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
- package/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
- package/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
- package/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2020.bigint.d.ts +765 -0
- package/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
- package/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
- package/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
- package/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
- package/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
- package/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +99 -0
- package/node_modules/typescript/lib/lib.es2020.string.d.ts +44 -0
- package/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
- package/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
- package/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
- package/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
- package/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
- package/node_modules/typescript/lib/lib.es2021.weakref.d.ts +78 -0
- package/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
- package/node_modules/typescript/lib/lib.es2022.d.ts +25 -0
- package/node_modules/typescript/lib/lib.es2022.error.d.ts +75 -0
- package/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2022.intl.d.ts +145 -0
- package/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
- package/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
- package/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
- package/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
- package/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
- package/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
- package/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
- package/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +65 -0
- package/node_modules/typescript/lib/lib.es2024.collection.d.ts +29 -0
- package/node_modules/typescript/lib/lib.es2024.d.ts +26 -0
- package/node_modules/typescript/lib/lib.es2024.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.es2024.object.d.ts +29 -0
- package/node_modules/typescript/lib/lib.es2024.promise.d.ts +35 -0
- package/node_modules/typescript/lib/lib.es2024.regexp.d.ts +25 -0
- package/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +68 -0
- package/node_modules/typescript/lib/lib.es2024.string.d.ts +29 -0
- package/node_modules/typescript/lib/lib.es5.d.ts +4601 -0
- package/node_modules/typescript/lib/lib.es6.d.ts +23 -0
- package/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
- package/node_modules/typescript/lib/lib.esnext.collection.d.ts +96 -0
- package/node_modules/typescript/lib/lib.esnext.d.ts +29 -0
- package/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
- package/node_modules/typescript/lib/lib.esnext.disposable.d.ts +193 -0
- package/node_modules/typescript/lib/lib.esnext.error.d.ts +24 -0
- package/node_modules/typescript/lib/lib.esnext.float16.d.ts +445 -0
- package/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
- package/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
- package/node_modules/typescript/lib/lib.esnext.iterator.d.ts +148 -0
- package/node_modules/typescript/lib/lib.esnext.promise.d.ts +34 -0
- package/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +25 -0
- package/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
- package/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +41 -0
- package/node_modules/typescript/lib/lib.webworker.d.ts +13150 -0
- package/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
- package/node_modules/typescript/lib/lib.webworker.iterable.d.ts +340 -0
- package/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/tsc.js +8 -0
- package/node_modules/typescript/lib/tsserver.js +8 -0
- package/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
- package/node_modules/typescript/lib/tsserverlibrary.js +21 -0
- package/node_modules/typescript/lib/typesMap.json +497 -0
- package/node_modules/typescript/lib/typescript.d.ts +11437 -0
- package/node_modules/typescript/lib/typescript.js +200276 -0
- package/node_modules/typescript/lib/typingsInstaller.js +8 -0
- package/node_modules/typescript/lib/watchGuard.js +53 -0
- package/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2122 -0
- package/node_modules/typescript/package.json +120 -0
- package/package.json +12 -9
- package/lib/coverage/fs-walk.mjs +0 -64
- package/node_modules/@elench/next-analysis/src/api-routes.mjs +0 -81
- package/node_modules/@elench/next-analysis/src/api-routes.test.mjs +0 -22
- package/node_modules/@elench/next-analysis/src/app-root.mjs +0 -7
- package/node_modules/@elench/next-analysis/src/backend-links.mjs +0 -31
- package/node_modules/@elench/next-analysis/src/index.mjs +0 -21
- package/node_modules/@elench/next-analysis/src/pages.mjs +0 -68
- package/node_modules/@elench/next-analysis/src/project.mjs +0 -94
- package/node_modules/@elench/next-analysis/src/project.test.mjs +0 -35
- package/node_modules/@elench/next-analysis/src/route-tree.mjs +0 -621
- package/node_modules/@elench/next-analysis/src/routes.mjs +0 -41
- package/node_modules/@elench/next-analysis/src/routes.test.mjs +0 -25
- package/node_modules/@elench/next-analysis/src/server-actions.mjs +0 -53
- package/node_modules/@elench/next-analysis/src/server-actions.test.mjs +0 -37
- package/node_modules/@elench/next-analysis/src/shared.mjs +0 -209
- package/node_modules/@elench/next-analysis/src/swc.mjs +0 -388
- package/node_modules/@elench/testkit-bridge/src/index.mjs +0 -583
- package/node_modules/@elench/testkit-bridge/src/index.test.mjs +0 -409
- package/node_modules/@elench/testkit-protocol/src/index.d.ts +0 -231
- package/node_modules/@elench/testkit-protocol/src/index.mjs +0 -265
- package/node_modules/@elench/testkit-protocol/src/index.test.mjs +0 -242
- package/node_modules/@elench/ts-analysis/src/callables.mjs +0 -135
- package/node_modules/@elench/ts-analysis/src/callables.test.mjs +0 -55
- package/node_modules/@elench/ts-analysis/src/exports.mjs +0 -69
- package/node_modules/@elench/ts-analysis/src/exports.test.mjs +0 -50
- package/node_modules/@elench/ts-analysis/src/jsx.mjs +0 -69
- package/node_modules/@elench/ts-analysis/src/jsx.test.mjs +0 -43
- package/node_modules/@elench/ts-analysis/src/project.mjs +0 -100
- package/node_modules/@elench/ts-analysis/src/project.test.mjs +0 -54
- package/node_modules/@elench/ts-analysis/src/requests.mjs +0 -141
- package/node_modules/@elench/ts-analysis/src/requests.test.mjs +0 -35
- package/node_modules/@elench/ts-analysis/src/resolution.mjs +0 -53
- package/node_modules/@elench/ts-analysis/src/shared.mjs +0 -32
- package/node_modules/@elench/ts-analysis/src/syntax.mjs +0 -27
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import fs from "fs";
|
|
2
|
-
import path from "path";
|
|
3
|
-
import { execFile } from "child_process";
|
|
4
|
-
import { promisify } from "util";
|
|
5
1
|
import { findMatchingKnownFailureEntries } from "./index.mjs";
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import {
|
|
3
|
+
applyStaleCacheFallback,
|
|
4
|
+
loadIssueCache,
|
|
5
|
+
mergeIssuesByRepo,
|
|
6
|
+
resolveIssueCache,
|
|
7
|
+
updateIssueCache,
|
|
8
|
+
writeIssueCache,
|
|
9
|
+
} from "./github-cache.mjs";
|
|
10
|
+
import {
|
|
11
|
+
createDefaultGitHubIssueTransport,
|
|
12
|
+
fetchIssuesByRepo,
|
|
13
|
+
parseGitHubRepoSlug,
|
|
14
|
+
} from "./github-transport.mjs";
|
|
15
|
+
export { parseGitHubRepoSlug } from "./github-transport.mjs";
|
|
8
16
|
const DEFAULT_CACHE_TTL_SECONDS = 15 * 60;
|
|
9
17
|
const CACHE_SCHEMA_VERSION = 1;
|
|
10
18
|
const CACHE_PATH = [".testkit", "known-failures", "github-issues-cache.json"];
|
|
@@ -60,7 +68,7 @@ export async function validateKnownFailureIssues({
|
|
|
60
68
|
const issueNumbersByRepo = groupIssueNumbersByRepo(document.entries);
|
|
61
69
|
const repoSlug = gitMetadata?.repoSlug || null;
|
|
62
70
|
const remoteUrl = gitMetadata?.remoteUrl || null;
|
|
63
|
-
const cache = loadIssueCache(productDir);
|
|
71
|
+
const cache = loadIssueCache(productDir, CACHE_PATH, CACHE_SCHEMA_VERSION);
|
|
64
72
|
const cacheResolution = resolveIssueCache(cache, issueNumbersByRepo, normalizedConfig, now);
|
|
65
73
|
const availabilityFindings = [];
|
|
66
74
|
let issuesByRepo = cacheResolution.issuesByRepo;
|
|
@@ -71,8 +79,8 @@ export async function validateKnownFailureIssues({
|
|
|
71
79
|
try {
|
|
72
80
|
const fetchedIssues = await fetchIssuesByRepo(client, cacheResolution.missingByRepo);
|
|
73
81
|
issuesByRepo = mergeIssuesByRepo(issuesByRepo, fetchedIssues);
|
|
74
|
-
updateIssueCache(cache, fetchedIssues, now);
|
|
75
|
-
writeIssueCache(productDir, cache);
|
|
82
|
+
updateIssueCache(cache, fetchedIssues, now, CACHE_SCHEMA_VERSION);
|
|
83
|
+
writeIssueCache(productDir, CACHE_PATH, cache);
|
|
76
84
|
} catch (error) {
|
|
77
85
|
issuesByRepo = applyStaleCacheFallback(
|
|
78
86
|
issuesByRepo,
|
|
@@ -191,167 +199,6 @@ export function buildKnownFailureIssueValidationSummaryLines(result) {
|
|
|
191
199
|
];
|
|
192
200
|
}
|
|
193
201
|
|
|
194
|
-
export function parseGitHubRepoSlug(remoteUrl) {
|
|
195
|
-
const normalized = normalizeOptionalString(remoteUrl);
|
|
196
|
-
if (!normalized) return null;
|
|
197
|
-
|
|
198
|
-
let match = normalized.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?$/i);
|
|
199
|
-
if (match) return `${match[1]}/${match[2]}`;
|
|
200
|
-
|
|
201
|
-
match = normalized.match(/^git@github\.com:([^/]+)\/([^/]+?)(?:\.git)?$/i);
|
|
202
|
-
if (match) return `${match[1]}/${match[2]}`;
|
|
203
|
-
|
|
204
|
-
match = normalized.match(/^ssh:\/\/git@github\.com\/([^/]+)\/([^/]+?)(?:\.git)?$/i);
|
|
205
|
-
if (match) return `${match[1]}/${match[2]}`;
|
|
206
|
-
|
|
207
|
-
return null;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
async function createDefaultGitHubIssueTransport() {
|
|
211
|
-
const token = process.env.GH_TOKEN || process.env.GITHUB_TOKEN || null;
|
|
212
|
-
if (token) {
|
|
213
|
-
return {
|
|
214
|
-
type: "token",
|
|
215
|
-
async fetchRepoIssues(repo, numbers) {
|
|
216
|
-
return fetchRepoIssuesViaToken(repo, numbers, token);
|
|
217
|
-
},
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
try {
|
|
222
|
-
await execFileAsync("gh", ["auth", "status"], {
|
|
223
|
-
encoding: "utf8",
|
|
224
|
-
env: process.env,
|
|
225
|
-
maxBuffer: 1024 * 1024,
|
|
226
|
-
});
|
|
227
|
-
return {
|
|
228
|
-
type: "gh",
|
|
229
|
-
async fetchRepoIssues(repo, numbers) {
|
|
230
|
-
return fetchRepoIssuesViaGh(repo, numbers);
|
|
231
|
-
},
|
|
232
|
-
};
|
|
233
|
-
} catch {
|
|
234
|
-
return null;
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
async function fetchIssuesByRepo(client, issueNumbersByRepo) {
|
|
239
|
-
const issuesByRepo = new Map();
|
|
240
|
-
|
|
241
|
-
for (const [repo, numbers] of issueNumbersByRepo.entries()) {
|
|
242
|
-
const issueMap = new Map();
|
|
243
|
-
const chunks = chunkValues(numbers, 40);
|
|
244
|
-
for (const chunk of chunks) {
|
|
245
|
-
const fetched = await client.fetchRepoIssues(repo, chunk);
|
|
246
|
-
for (const [number, issue] of fetched.entries()) {
|
|
247
|
-
issueMap.set(number, issue);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
issuesByRepo.set(repo, issueMap);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
return issuesByRepo;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
async function fetchRepoIssuesViaToken(repo, numbers, token) {
|
|
257
|
-
const query = buildIssueQuery(repo, numbers);
|
|
258
|
-
const response = await fetch("https://api.github.com/graphql", {
|
|
259
|
-
method: "POST",
|
|
260
|
-
headers: {
|
|
261
|
-
"Content-Type": "application/json",
|
|
262
|
-
Accept: "application/vnd.github+json",
|
|
263
|
-
Authorization: `Bearer ${token}`,
|
|
264
|
-
"X-GitHub-Api-Version": "2022-11-28",
|
|
265
|
-
},
|
|
266
|
-
body: JSON.stringify({ query }),
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
const payload = await response.json().catch(() => null);
|
|
270
|
-
if (!response.ok) {
|
|
271
|
-
throw new Error(
|
|
272
|
-
`GitHub GraphQL request failed with ${response.status}${
|
|
273
|
-
payload?.message ? `: ${payload.message}` : ""
|
|
274
|
-
}`
|
|
275
|
-
);
|
|
276
|
-
}
|
|
277
|
-
if (Array.isArray(payload?.errors) && payload.errors.length > 0) {
|
|
278
|
-
throw new Error(payload.errors.map((error) => error.message).join("; "));
|
|
279
|
-
}
|
|
280
|
-
return normalizeGraphqlIssuesResponse(repo, numbers, payload?.data);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
async function fetchRepoIssuesViaGh(repo, numbers) {
|
|
284
|
-
const query = buildIssueQuery(repo, numbers);
|
|
285
|
-
const { stdout } = await execFileAsync(
|
|
286
|
-
"gh",
|
|
287
|
-
["api", "graphql", "-f", `query=${query}`],
|
|
288
|
-
{
|
|
289
|
-
encoding: "utf8",
|
|
290
|
-
env: process.env,
|
|
291
|
-
maxBuffer: 1024 * 1024,
|
|
292
|
-
}
|
|
293
|
-
);
|
|
294
|
-
const payload = JSON.parse(stdout);
|
|
295
|
-
if (Array.isArray(payload?.errors) && payload.errors.length > 0) {
|
|
296
|
-
throw new Error(payload.errors.map((error) => error.message).join("; "));
|
|
297
|
-
}
|
|
298
|
-
return normalizeGraphqlIssuesResponse(repo, numbers, payload?.data);
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
function buildIssueQuery(repo, numbers) {
|
|
302
|
-
const [owner, name] = repo.split("/");
|
|
303
|
-
return `
|
|
304
|
-
query TestkitKnownFailureIssues {
|
|
305
|
-
repository(owner: ${JSON.stringify(owner)}, name: ${JSON.stringify(name)}) {
|
|
306
|
-
${numbers
|
|
307
|
-
.map(
|
|
308
|
-
(number) => `
|
|
309
|
-
issue_${number}: issue(number: ${number}) {
|
|
310
|
-
number
|
|
311
|
-
title
|
|
312
|
-
state
|
|
313
|
-
url
|
|
314
|
-
}
|
|
315
|
-
`
|
|
316
|
-
)
|
|
317
|
-
.join("\n")}
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
`;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
function normalizeGraphqlIssuesResponse(repo, numbers, data) {
|
|
324
|
-
const map = new Map();
|
|
325
|
-
const repository = data?.repository || null;
|
|
326
|
-
for (const number of numbers) {
|
|
327
|
-
const issue = repository?.[`issue_${number}`] || null;
|
|
328
|
-
if (!issue) {
|
|
329
|
-
map.set(number, {
|
|
330
|
-
repo,
|
|
331
|
-
number,
|
|
332
|
-
exists: false,
|
|
333
|
-
title: null,
|
|
334
|
-
state: null,
|
|
335
|
-
url: null,
|
|
336
|
-
checkedAt: null,
|
|
337
|
-
source: "github",
|
|
338
|
-
});
|
|
339
|
-
continue;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
map.set(number, {
|
|
343
|
-
repo,
|
|
344
|
-
number: issue.number,
|
|
345
|
-
exists: true,
|
|
346
|
-
title: normalizeOptionalString(issue.title),
|
|
347
|
-
state: normalizeOptionalString(issue.state),
|
|
348
|
-
url: normalizeOptionalString(issue.url),
|
|
349
|
-
checkedAt: null,
|
|
350
|
-
source: "github",
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
return map;
|
|
354
|
-
}
|
|
355
202
|
|
|
356
203
|
function collectObservedKnownFailureEntries(document, runArtifact, statusArtifact) {
|
|
357
204
|
const observedTests = collectObservedTests(runArtifact, statusArtifact);
|
|
@@ -583,161 +430,6 @@ function buildIssueValidationSummary(entries, globalFindings) {
|
|
|
583
430
|
};
|
|
584
431
|
}
|
|
585
432
|
|
|
586
|
-
function loadIssueCache(productDir) {
|
|
587
|
-
const filePath = getIssueCachePath(productDir);
|
|
588
|
-
if (!fs.existsSync(filePath)) {
|
|
589
|
-
return {
|
|
590
|
-
schemaVersion: CACHE_SCHEMA_VERSION,
|
|
591
|
-
entries: {},
|
|
592
|
-
};
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
try {
|
|
596
|
-
const parsed = JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
597
|
-
if (parsed?.schemaVersion !== CACHE_SCHEMA_VERSION || typeof parsed.entries !== "object") {
|
|
598
|
-
return {
|
|
599
|
-
schemaVersion: CACHE_SCHEMA_VERSION,
|
|
600
|
-
entries: {},
|
|
601
|
-
};
|
|
602
|
-
}
|
|
603
|
-
return parsed;
|
|
604
|
-
} catch {
|
|
605
|
-
return {
|
|
606
|
-
schemaVersion: CACHE_SCHEMA_VERSION,
|
|
607
|
-
entries: {},
|
|
608
|
-
};
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
function resolveIssueCache(cache, issueNumbersByRepo, config, now) {
|
|
613
|
-
const issuesByRepo = new Map();
|
|
614
|
-
const missingByRepo = new Map();
|
|
615
|
-
const staleByRepo = new Map();
|
|
616
|
-
const ttlMs = config.cacheTtlSeconds * 1000;
|
|
617
|
-
|
|
618
|
-
for (const [repo, numbers] of issueNumbersByRepo.entries()) {
|
|
619
|
-
const cachedIssues = new Map();
|
|
620
|
-
const missing = [];
|
|
621
|
-
const stale = [];
|
|
622
|
-
|
|
623
|
-
for (const number of numbers) {
|
|
624
|
-
const key = buildIssueCacheKey(repo, number);
|
|
625
|
-
const cached = cache.entries[key];
|
|
626
|
-
if (!cached) {
|
|
627
|
-
missing.push(number);
|
|
628
|
-
continue;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
const checkedAt = Date.parse(cached.checkedAt);
|
|
632
|
-
const normalized = {
|
|
633
|
-
repo,
|
|
634
|
-
number,
|
|
635
|
-
exists: Boolean(cached.exists),
|
|
636
|
-
title: normalizeOptionalString(cached.title),
|
|
637
|
-
state: normalizeOptionalString(cached.state),
|
|
638
|
-
url: normalizeOptionalString(cached.url),
|
|
639
|
-
checkedAt: cached.checkedAt || null,
|
|
640
|
-
source: "cache",
|
|
641
|
-
};
|
|
642
|
-
|
|
643
|
-
if (!Number.isFinite(checkedAt) || now - checkedAt > ttlMs) {
|
|
644
|
-
stale.push(number);
|
|
645
|
-
cachedIssues.set(number, normalized);
|
|
646
|
-
continue;
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
cachedIssues.set(number, normalized);
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
issuesByRepo.set(repo, cachedIssues);
|
|
653
|
-
if (missing.length > 0 || stale.length > 0) {
|
|
654
|
-
missingByRepo.set(repo, [...new Set([...missing, ...stale])].sort((a, b) => a - b));
|
|
655
|
-
}
|
|
656
|
-
if (stale.length > 0) {
|
|
657
|
-
staleByRepo.set(repo, stale.sort((a, b) => a - b));
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
|
|
661
|
-
return {
|
|
662
|
-
issuesByRepo,
|
|
663
|
-
missingByRepo,
|
|
664
|
-
staleByRepo,
|
|
665
|
-
};
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
function updateIssueCache(cache, issuesByRepo, now) {
|
|
669
|
-
cache.schemaVersion = CACHE_SCHEMA_VERSION;
|
|
670
|
-
cache.entries = cache.entries || {};
|
|
671
|
-
const checkedAt = new Date(now).toISOString();
|
|
672
|
-
|
|
673
|
-
for (const [repo, issues] of issuesByRepo.entries()) {
|
|
674
|
-
for (const [number, issue] of issues.entries()) {
|
|
675
|
-
issue.checkedAt = checkedAt;
|
|
676
|
-
cache.entries[buildIssueCacheKey(repo, number)] = {
|
|
677
|
-
exists: issue.exists,
|
|
678
|
-
title: issue.title,
|
|
679
|
-
state: issue.state,
|
|
680
|
-
url: issue.url,
|
|
681
|
-
checkedAt,
|
|
682
|
-
};
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
|
|
687
|
-
function writeIssueCache(productDir, cache) {
|
|
688
|
-
const filePath = getIssueCachePath(productDir);
|
|
689
|
-
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
690
|
-
fs.writeFileSync(filePath, `${JSON.stringify(cache, null, 2)}\n`);
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
function getIssueCachePath(productDir) {
|
|
694
|
-
return path.join(productDir, ...CACHE_PATH);
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
function applyStaleCacheFallback(issuesByRepo, staleByRepo, findings) {
|
|
698
|
-
let usedStale = false;
|
|
699
|
-
for (const [repo, numbers] of staleByRepo.entries()) {
|
|
700
|
-
const issues = issuesByRepo.get(repo);
|
|
701
|
-
if (!issues) continue;
|
|
702
|
-
for (const number of numbers) {
|
|
703
|
-
if (issues.has(number)) {
|
|
704
|
-
usedStale = true;
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
if (usedStale) {
|
|
709
|
-
findings.push({
|
|
710
|
-
code: "used_stale_cache",
|
|
711
|
-
severity: "warning",
|
|
712
|
-
message: "Used stale cached GitHub issue metadata because fresh validation failed",
|
|
713
|
-
});
|
|
714
|
-
}
|
|
715
|
-
return issuesByRepo;
|
|
716
|
-
}
|
|
717
|
-
|
|
718
|
-
function mergeIssuesByRepo(left, right) {
|
|
719
|
-
const merged = new Map();
|
|
720
|
-
for (const [repo, issues] of left.entries()) {
|
|
721
|
-
merged.set(repo, new Map(issues.entries()));
|
|
722
|
-
}
|
|
723
|
-
|
|
724
|
-
for (const [repo, issues] of right.entries()) {
|
|
725
|
-
if (!merged.has(repo)) {
|
|
726
|
-
merged.set(repo, new Map());
|
|
727
|
-
}
|
|
728
|
-
const mergedIssues = merged.get(repo);
|
|
729
|
-
for (const [number, issue] of issues.entries()) {
|
|
730
|
-
mergedIssues.set(number, issue);
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
|
|
734
|
-
return merged;
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
function buildIssueCacheKey(repo, number) {
|
|
738
|
-
return `${repo}#${number}`;
|
|
739
|
-
}
|
|
740
|
-
|
|
741
433
|
function normalizeIssueState(value) {
|
|
742
434
|
const normalized = normalizeOptionalString(value);
|
|
743
435
|
if (!normalized) return null;
|
|
@@ -2,7 +2,7 @@ import fs from "fs";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { execa } from "execa";
|
|
4
4
|
import { bundleK6File } from "../bundler/index.mjs";
|
|
5
|
-
import { resolveK6Binary } from "../config/
|
|
5
|
+
import { resolveK6Binary } from "../config/binaries.mjs";
|
|
6
6
|
import {
|
|
7
7
|
buildFileTimeoutEnv,
|
|
8
8
|
formatFileTimeoutBudgetError,
|
|
@@ -16,6 +16,7 @@ import { collectFailureDetailsFromRuntimeArtifacts } from "./failure-details.mjs
|
|
|
16
16
|
import { RUNTIME_ARTIFACT_MARKER } from "../runtime-src/k6/artifacts.js";
|
|
17
17
|
import { readDatabaseUrl } from "./state-io.mjs";
|
|
18
18
|
import { buildTaskExecutionEnv } from "./template.mjs";
|
|
19
|
+
import { registerManagedProcess, unregisterManagedProcess } from "./managed-processes.mjs";
|
|
19
20
|
import { killChildProcess } from "./processes.mjs";
|
|
20
21
|
|
|
21
22
|
export async function runHttpK6Task(targetConfig, task, lifecycle, lease, reporter = null) {
|
|
@@ -105,21 +106,14 @@ export async function runDefaultRuntimeTask(
|
|
|
105
106
|
forceKillAfterDelay: 5_000,
|
|
106
107
|
}
|
|
107
108
|
);
|
|
108
|
-
lifecycle
|
|
109
|
-
killChildProcess(subprocess, "SIGINT");
|
|
110
|
-
});
|
|
111
|
-
if (lifecycle.isStopRequested()) {
|
|
112
|
-
const interruptSubprocess = () => killChildProcess(subprocess, "SIGINT");
|
|
113
|
-
if (subprocess.pid) interruptSubprocess();
|
|
114
|
-
else subprocess.once?.("spawn", interruptSubprocess);
|
|
115
|
-
}
|
|
109
|
+
registerManagedProcess(lifecycle, subprocess, "SIGINT");
|
|
116
110
|
reporter?.taskStarted?.(task, targetConfig);
|
|
117
111
|
let result;
|
|
118
112
|
let timedOut;
|
|
119
113
|
try {
|
|
120
114
|
({ result, timedOut } = await settleSubprocess(subprocess, fileTimeoutSeconds));
|
|
121
115
|
} finally {
|
|
122
|
-
lifecycle
|
|
116
|
+
unregisterManagedProcess(lifecycle, subprocess);
|
|
123
117
|
}
|
|
124
118
|
|
|
125
119
|
const stdout = parseDefaultRuntimeOutput(result.stdout || "");
|
|
@@ -1,85 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
export {
|
|
2
|
+
DATABASE_BINDINGS,
|
|
2
3
|
DEFAULT_FILE_TIMEOUT_SECONDS,
|
|
3
|
-
|
|
4
|
+
buildRuntimeIds,
|
|
5
|
+
normalizeDatabaseBinding,
|
|
6
|
+
normalizeExecutionConfig,
|
|
7
|
+
normalizeRuntimeInstances,
|
|
8
|
+
normalizeRuntimeMaxConcurrentTasks,
|
|
4
9
|
parseFileTimeoutOption,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export function parseWorkersOption(value) {
|
|
12
|
-
return parsePositiveInteger(value, "--workers");
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function parseRuntimeInstancesOption(value, label = "runtime.instances") {
|
|
16
|
-
return parsePositiveInteger(value, label);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function normalizeRuntimeInstances(value, label = "runtime.instances") {
|
|
20
|
-
return normalizePositiveInteger(value, label);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export function parseRuntimeMaxConcurrentTasksOption(
|
|
24
|
-
value,
|
|
25
|
-
label = "runtime.maxConcurrentTasks"
|
|
26
|
-
) {
|
|
27
|
-
return parsePositiveInteger(value, label);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function normalizeRuntimeMaxConcurrentTasks(
|
|
31
|
-
value,
|
|
32
|
-
label = "runtime.maxConcurrentTasks"
|
|
33
|
-
) {
|
|
34
|
-
if (value === undefined || value === null) {
|
|
35
|
-
return Number.POSITIVE_INFINITY;
|
|
36
|
-
}
|
|
37
|
-
return normalizePositiveInteger(value, label);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function normalizeDatabaseBinding(value, label = "database.binding") {
|
|
41
|
-
const normalized = String(value || "").trim();
|
|
42
|
-
if (!DATABASE_BINDINGS.has(normalized)) {
|
|
43
|
-
throw new Error(
|
|
44
|
-
`Invalid ${label} value "${value}". Expected one of: shared, per-runtime.`
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
return normalized;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export function resolveExecutionConfig({ cli = {}, repo = {} } = {}) {
|
|
51
|
-
return normalizeExecutionConfig({
|
|
52
|
-
workers: cli.workers ?? repo.workers ?? 1,
|
|
53
|
-
fileTimeoutSeconds:
|
|
54
|
-
cli.fileTimeoutSeconds ?? repo.fileTimeoutSeconds ?? DEFAULT_FILE_TIMEOUT_SECONDS,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export function normalizeExecutionConfig(input = {}) {
|
|
59
|
-
return {
|
|
60
|
-
workers: normalizePositiveInteger(input.workers ?? 1, "execution.workers"),
|
|
61
|
-
fileTimeoutSeconds: normalizeFileTimeoutSeconds(
|
|
62
|
-
input.fileTimeoutSeconds ?? DEFAULT_FILE_TIMEOUT_SECONDS
|
|
63
|
-
),
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export function buildRuntimeIds(count) {
|
|
68
|
-
return Array.from({ length: count }, (_unused, index) => `runtime-${index + 1}`);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function parsePositiveInteger(value, label) {
|
|
72
|
-
const parsed = Number.parseInt(String(value), 10);
|
|
73
|
-
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
74
|
-
throw new Error(`Invalid ${label} value "${value}". Expected a positive integer.`);
|
|
75
|
-
}
|
|
76
|
-
return parsed;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function normalizePositiveInteger(value, label) {
|
|
80
|
-
const parsed = Number(value);
|
|
81
|
-
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
82
|
-
throw new Error(`${label} must be a positive integer.`);
|
|
83
|
-
}
|
|
84
|
-
return parsed;
|
|
85
|
-
}
|
|
10
|
+
parseRuntimeInstancesOption,
|
|
11
|
+
parseRuntimeMaxConcurrentTasksOption,
|
|
12
|
+
parseWorkersOption,
|
|
13
|
+
resolveExecutionConfig,
|
|
14
|
+
} from "../shared/execution-schema.mjs";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { finalizeServiceResult, summarizeDbBackend } from "./results.mjs";
|
|
2
|
+
import { buildLiveRunArtifact } from "./reporting.mjs";
|
|
3
|
+
import { writeLiveRunArtifact } from "./artifacts.mjs";
|
|
4
|
+
|
|
5
|
+
export function createLiveSnapshotWriter({
|
|
6
|
+
productDir,
|
|
7
|
+
configs,
|
|
8
|
+
trackers,
|
|
9
|
+
startedAt,
|
|
10
|
+
execution,
|
|
11
|
+
workerState,
|
|
12
|
+
selection,
|
|
13
|
+
metadata,
|
|
14
|
+
logRegistry,
|
|
15
|
+
setupRegistry,
|
|
16
|
+
}) {
|
|
17
|
+
return () => {
|
|
18
|
+
const now = Date.now();
|
|
19
|
+
const partialResults = configs.map((config) => finalizeServiceResult(trackers.get(config.name), startedAt, now));
|
|
20
|
+
writeLiveRunArtifact(
|
|
21
|
+
productDir,
|
|
22
|
+
buildLiveRunArtifact({
|
|
23
|
+
productDir,
|
|
24
|
+
results: partialResults,
|
|
25
|
+
startedAt,
|
|
26
|
+
updatedAt: now,
|
|
27
|
+
execution,
|
|
28
|
+
workerCount: workerState.workerCount,
|
|
29
|
+
runtimeInstanceCount: workerState.runtimeInstanceCount,
|
|
30
|
+
runtimeStats: workerState.runtimeStats,
|
|
31
|
+
typeValues: selection.typeValues,
|
|
32
|
+
suiteSelectors: selection.suiteSelectors,
|
|
33
|
+
fileNames: selection.fileNames,
|
|
34
|
+
shard: selection.shard,
|
|
35
|
+
serviceFilter: selection.serviceFilter,
|
|
36
|
+
scenarioSeed: selection.scenarioSeed,
|
|
37
|
+
metadata,
|
|
38
|
+
summarizeDbBackend,
|
|
39
|
+
serviceLogs: logRegistry.listServiceLogs(),
|
|
40
|
+
setupLogs: logRegistry.listSetupLogs(),
|
|
41
|
+
setupOperations: setupRegistry.listOperations(),
|
|
42
|
+
})
|
|
43
|
+
);
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { killChildProcess } from "./processes.mjs";
|
|
2
|
+
|
|
3
|
+
export function registerManagedProcess(lifecycle, subprocess, signal = "SIGINT") {
|
|
4
|
+
lifecycle.registerProcess(subprocess, () => {
|
|
5
|
+
killChildProcess(subprocess, signal);
|
|
6
|
+
});
|
|
7
|
+
if (lifecycle.isStopRequested()) {
|
|
8
|
+
interruptManagedProcess(subprocess, signal);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function unregisterManagedProcess(lifecycle, subprocess) {
|
|
13
|
+
lifecycle.unregisterProcess(subprocess.pid);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function registerManagedService(lifecycle, config, child, cwd, signal = "SIGTERM") {
|
|
17
|
+
lifecycle.registerService(config, child, cwd, () => {
|
|
18
|
+
killChildProcess(child, signal);
|
|
19
|
+
});
|
|
20
|
+
if (lifecycle.isStopRequested()) {
|
|
21
|
+
interruptManagedProcess(child, signal);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function interruptManagedProcess(subprocess, signal) {
|
|
26
|
+
const interruptSubprocess = () => killChildProcess(subprocess, signal);
|
|
27
|
+
if (subprocess.pid) interruptSubprocess();
|
|
28
|
+
else subprocess.once?.("spawn", interruptSubprocess);
|
|
29
|
+
}
|