@elench/testkit 0.1.65 → 0.1.66
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/lib/app/browser-bridge.mjs +66 -0
- package/lib/app/configs.mjs +81 -0
- package/lib/app/configs.test.mjs +34 -0
- package/lib/cli/command-helpers.mjs +2 -10
- package/lib/cli/commands/browser/serve.mjs +3 -62
- package/lib/cli/db.mjs +3 -68
- package/lib/config/binaries.mjs +34 -0
- package/lib/config/database.mjs +9 -6
- package/lib/config/index.mjs +2 -31
- package/lib/config/runtime.mjs +24 -95
- 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/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/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/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/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
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { loadConfigContext, resolveProductDir } from "../config/index.mjs";
|
|
2
|
+
import { discoverTests } from "../discovery/index.mjs";
|
|
3
|
+
import { loadCurrentRunArtifact } from "../cli/viewer.mjs";
|
|
4
|
+
|
|
5
|
+
export async function loadBrowserBridgeContext(options = {}) {
|
|
6
|
+
const productDir = resolveProductDir(process.cwd(), options.dir);
|
|
7
|
+
const [configContext, discovery] = await Promise.all([
|
|
8
|
+
loadConfigContext({
|
|
9
|
+
dir: productDir,
|
|
10
|
+
discoveryOptions: { strict: false },
|
|
11
|
+
}),
|
|
12
|
+
discoverTests({
|
|
13
|
+
dir: productDir,
|
|
14
|
+
diagnostics: "report",
|
|
15
|
+
}),
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
return {
|
|
19
|
+
productDir,
|
|
20
|
+
context: {
|
|
21
|
+
product: {
|
|
22
|
+
name: discovery.product.name,
|
|
23
|
+
directory: discovery.product.directory,
|
|
24
|
+
},
|
|
25
|
+
services: configContext.configs
|
|
26
|
+
.map((config) => {
|
|
27
|
+
const baseUrl = config.testkit.local?.baseUrl || null;
|
|
28
|
+
const browserOrigins = config.testkit.browser?.origins || [];
|
|
29
|
+
if (!baseUrl && browserOrigins.length === 0) return null;
|
|
30
|
+
const serviceEntries = [];
|
|
31
|
+
if (baseUrl && !baseUrl.includes("{port}")) {
|
|
32
|
+
try {
|
|
33
|
+
const parsed = new URL(baseUrl);
|
|
34
|
+
serviceEntries.push({
|
|
35
|
+
name: config.name,
|
|
36
|
+
baseUrl,
|
|
37
|
+
origin: parsed.origin,
|
|
38
|
+
});
|
|
39
|
+
} catch {
|
|
40
|
+
// Ignore invalid local.baseUrl templates here; explicit browser origins still work.
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
for (const origin of browserOrigins) {
|
|
44
|
+
serviceEntries.push({
|
|
45
|
+
name: config.name,
|
|
46
|
+
baseUrl: origin,
|
|
47
|
+
origin,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return serviceEntries;
|
|
51
|
+
})
|
|
52
|
+
.flat()
|
|
53
|
+
.filter(Boolean),
|
|
54
|
+
discovery,
|
|
55
|
+
runArtifact: loadRunArtifactIfPresent(productDir),
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function loadRunArtifactIfPresent(productDir) {
|
|
61
|
+
try {
|
|
62
|
+
return loadCurrentRunArtifact(productDir);
|
|
63
|
+
} catch {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { loadConfigs } from "../config/index.mjs";
|
|
2
|
+
|
|
3
|
+
export async function loadManagedConfigs(options = {}) {
|
|
4
|
+
const allConfigs = await loadConfigs({ dir: options.dir });
|
|
5
|
+
const configs = filterConfigsByService(allConfigs, options.service || null);
|
|
6
|
+
return { allConfigs, configs };
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function filterConfigsByService(allConfigs, serviceName) {
|
|
10
|
+
if (!serviceName) return allConfigs;
|
|
11
|
+
const configs = allConfigs.filter((config) => config.name === serviceName);
|
|
12
|
+
if (configs.length > 0) return configs;
|
|
13
|
+
const available = allConfigs.map((config) => config.name).join(", ");
|
|
14
|
+
throw new Error(`Service "${serviceName}" not found. Available: ${available}`);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function resolveTargetConfig(configs, serviceName = null) {
|
|
18
|
+
if (serviceName) {
|
|
19
|
+
const match = configs.find((config) => config.name === serviceName);
|
|
20
|
+
if (!match) {
|
|
21
|
+
const available = configs.map((config) => config.name).join(", ");
|
|
22
|
+
throw new Error(`Service "${serviceName}" not found. Available: ${available}`);
|
|
23
|
+
}
|
|
24
|
+
return match;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (configs.length === 1) return configs[0];
|
|
28
|
+
const withLocalDb = configs.filter((config) => config.testkit.database?.provider === "local");
|
|
29
|
+
if (withLocalDb.length === 1) return withLocalDb[0];
|
|
30
|
+
|
|
31
|
+
const available = configs.map((config) => config.name).join(", ");
|
|
32
|
+
throw new Error(`Multiple services available. Pass --service. Available: ${available}`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function collectRequiredConfigs(configs, targetName) {
|
|
36
|
+
const byName = new Map(configs.map((config) => [config.name, config]));
|
|
37
|
+
const required = new Set();
|
|
38
|
+
|
|
39
|
+
const visit = (name) => {
|
|
40
|
+
if (required.has(name)) return;
|
|
41
|
+
const config = byName.get(name);
|
|
42
|
+
if (!config) {
|
|
43
|
+
throw new Error(`Missing config for dependency "${name}"`);
|
|
44
|
+
}
|
|
45
|
+
required.add(name);
|
|
46
|
+
for (const depName of config.testkit.dependsOn || []) {
|
|
47
|
+
visit(depName);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
visit(targetName);
|
|
52
|
+
return configs.filter((config) => required.has(config.name));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function topologicallySortConfigs(configs) {
|
|
56
|
+
const byName = new Map(configs.map((config) => [config.name, config]));
|
|
57
|
+
const visited = new Set();
|
|
58
|
+
const visiting = new Set();
|
|
59
|
+
const ordered = [];
|
|
60
|
+
|
|
61
|
+
const visit = (config) => {
|
|
62
|
+
if (visited.has(config.name)) return;
|
|
63
|
+
if (visiting.has(config.name)) {
|
|
64
|
+
throw new Error(`Dependency cycle while resolving configs for "${config.name}"`);
|
|
65
|
+
}
|
|
66
|
+
visiting.add(config.name);
|
|
67
|
+
for (const depName of config.testkit.dependsOn || []) {
|
|
68
|
+
const dependency = byName.get(depName);
|
|
69
|
+
if (dependency) visit(dependency);
|
|
70
|
+
}
|
|
71
|
+
visiting.delete(config.name);
|
|
72
|
+
visited.add(config.name);
|
|
73
|
+
ordered.push(config);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
for (const config of configs) {
|
|
77
|
+
visit(config);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return ordered;
|
|
81
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import {
|
|
3
|
+
collectRequiredConfigs,
|
|
4
|
+
filterConfigsByService,
|
|
5
|
+
resolveTargetConfig,
|
|
6
|
+
topologicallySortConfigs,
|
|
7
|
+
} from "./configs.mjs";
|
|
8
|
+
|
|
9
|
+
function makeConfig(name, dependsOn = [], provider = null) {
|
|
10
|
+
return {
|
|
11
|
+
name,
|
|
12
|
+
testkit: {
|
|
13
|
+
dependsOn,
|
|
14
|
+
database: provider ? { provider } : undefined,
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
describe("app config helpers", () => {
|
|
20
|
+
it("filters and resolves target configs", () => {
|
|
21
|
+
const configs = [makeConfig("api"), makeConfig("frontend", ["api"], "local")];
|
|
22
|
+
|
|
23
|
+
expect(filterConfigsByService(configs, "api")).toEqual([configs[0]]);
|
|
24
|
+
expect(resolveTargetConfig(configs)).toBe(configs[1]);
|
|
25
|
+
expect(() => filterConfigsByService(configs, "missing")).toThrow('Service "missing" not found');
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("collects dependencies and sorts them topologically", () => {
|
|
29
|
+
const configs = [makeConfig("frontend", ["api"]), makeConfig("api"), makeConfig("worker", ["api"])];
|
|
30
|
+
|
|
31
|
+
expect(collectRequiredConfigs(configs, "frontend").map((config) => config.name).sort()).toEqual(["api", "frontend"]);
|
|
32
|
+
expect(topologicallySortConfigs(configs).map((config) => config.name)).toEqual(["api", "frontend", "worker"]);
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import { Flags } from "@oclif/core";
|
|
3
|
-
import {
|
|
3
|
+
import { loadManagedConfigs } from "../app/configs.mjs";
|
|
4
4
|
import {
|
|
5
5
|
parseFileTimeoutOption,
|
|
6
6
|
parseShardOption,
|
|
@@ -73,15 +73,7 @@ export const runFlags = {
|
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
export async function resolveConfigsForCommand(flags) {
|
|
76
|
-
|
|
77
|
-
const configs = flags.service
|
|
78
|
-
? allConfigs.filter((config) => config.name === flags.service)
|
|
79
|
-
: allConfigs;
|
|
80
|
-
if (flags.service && configs.length === 0) {
|
|
81
|
-
const available = allConfigs.map((config) => config.name).join(", ");
|
|
82
|
-
throw new Error(`Service "${flags.service}" not found. Available: ${available}`);
|
|
83
|
-
}
|
|
84
|
-
return { allConfigs, configs };
|
|
76
|
+
return loadManagedConfigs({ dir: flags.dir, service: flags.service });
|
|
85
77
|
}
|
|
86
78
|
|
|
87
79
|
export async function executeRunCommand(command, flags, positionalType = null) {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { Command, Flags } from "@oclif/core";
|
|
2
2
|
import { startBrowserBridgeServer } from "@elench/testkit-bridge";
|
|
3
|
-
import {
|
|
4
|
-
import { discoverTests } from "../../../discovery/index.mjs";
|
|
5
|
-
import { loadCurrentRunArtifact } from "../../viewer.mjs";
|
|
3
|
+
import { loadBrowserBridgeContext } from "../../../app/browser-bridge.mjs";
|
|
6
4
|
|
|
7
5
|
export default class BrowserServeCommand extends Command {
|
|
8
6
|
static summary = "Serve the local browser bridge for the current testkit product";
|
|
@@ -25,59 +23,10 @@ export default class BrowserServeCommand extends Command {
|
|
|
25
23
|
|
|
26
24
|
async run() {
|
|
27
25
|
const { flags } = await this.parse(BrowserServeCommand);
|
|
28
|
-
const productDir =
|
|
26
|
+
const { productDir, context } = await loadBrowserBridgeContext({ dir: flags.dir });
|
|
29
27
|
|
|
30
28
|
const adapter = {
|
|
31
|
-
loadProductContext: async () =>
|
|
32
|
-
const [configContext, discovery] = await Promise.all([
|
|
33
|
-
loadConfigContext({
|
|
34
|
-
dir: productDir,
|
|
35
|
-
discoveryOptions: { strict: false },
|
|
36
|
-
}),
|
|
37
|
-
discoverTests({
|
|
38
|
-
dir: productDir,
|
|
39
|
-
diagnostics: "report",
|
|
40
|
-
}),
|
|
41
|
-
]);
|
|
42
|
-
|
|
43
|
-
return {
|
|
44
|
-
product: {
|
|
45
|
-
name: discovery.product.name,
|
|
46
|
-
directory: discovery.product.directory,
|
|
47
|
-
},
|
|
48
|
-
services: configContext.configs
|
|
49
|
-
.map((config) => {
|
|
50
|
-
const baseUrl = config.testkit.local?.baseUrl || null;
|
|
51
|
-
const browserOrigins = config.testkit.browser?.origins || [];
|
|
52
|
-
if (!baseUrl && browserOrigins.length === 0) return null;
|
|
53
|
-
const serviceEntries = [];
|
|
54
|
-
if (baseUrl && !baseUrl.includes("{port}")) {
|
|
55
|
-
try {
|
|
56
|
-
const parsed = new URL(baseUrl);
|
|
57
|
-
serviceEntries.push({
|
|
58
|
-
name: config.name,
|
|
59
|
-
baseUrl,
|
|
60
|
-
origin: parsed.origin,
|
|
61
|
-
});
|
|
62
|
-
} catch {
|
|
63
|
-
// Ignore invalid local.baseUrl templates here; explicit browser origins still work.
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
for (const origin of browserOrigins) {
|
|
67
|
-
serviceEntries.push({
|
|
68
|
-
name: config.name,
|
|
69
|
-
baseUrl: origin,
|
|
70
|
-
origin,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
return serviceEntries;
|
|
74
|
-
})
|
|
75
|
-
.flat()
|
|
76
|
-
.filter(Boolean),
|
|
77
|
-
discovery,
|
|
78
|
-
runArtifact: loadRunArtifactIfPresent(productDir),
|
|
79
|
-
};
|
|
80
|
-
},
|
|
29
|
+
loadProductContext: async () => context,
|
|
81
30
|
};
|
|
82
31
|
|
|
83
32
|
const serverRef = await startBrowserBridgeServer(adapter, {
|
|
@@ -102,11 +51,3 @@ export default class BrowserServeCommand extends Command {
|
|
|
102
51
|
return payload;
|
|
103
52
|
}
|
|
104
53
|
}
|
|
105
|
-
|
|
106
|
-
function loadRunArtifactIfPresent(productDir) {
|
|
107
|
-
try {
|
|
108
|
-
return loadCurrentRunArtifact(productDir);
|
|
109
|
-
} catch {
|
|
110
|
-
return null;
|
|
111
|
-
}
|
|
112
|
-
}
|
package/lib/cli/db.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import os from "os";
|
|
3
3
|
import path from "path";
|
|
4
|
-
import {
|
|
4
|
+
import { loadManagedConfigs, resolveTargetConfig, collectRequiredConfigs, topologicallySortConfigs } from "../app/configs.mjs";
|
|
5
|
+
import { resolveProductDir } from "../config/index.mjs";
|
|
5
6
|
import { captureDatabaseTemplateSnapshot, prepareDatabaseRuntime } from "../database/index.mjs";
|
|
6
7
|
import { createRunReporter } from "./presentation/run-reporter.mjs";
|
|
7
8
|
import { createRunLogRegistry } from "../runner/logs.mjs";
|
|
@@ -10,7 +11,7 @@ import { resolveRuntimeInstanceConfigs } from "../runner/template.mjs";
|
|
|
10
11
|
|
|
11
12
|
export async function runDatabaseSnapshotCaptureCommand(options = {}) {
|
|
12
13
|
const productDir = resolveProductDir(process.cwd(), options.dir);
|
|
13
|
-
const configs = await
|
|
14
|
+
const { configs } = await loadManagedConfigs({ dir: productDir });
|
|
14
15
|
const target = resolveTargetConfig(configs, options.service);
|
|
15
16
|
const outputPath = normalizeOptionalString(options.output);
|
|
16
17
|
if (!outputPath) {
|
|
@@ -57,74 +58,8 @@ export async function runDatabaseSnapshotCaptureCommand(options = {}) {
|
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
function resolveTargetConfig(configs, serviceName) {
|
|
61
|
-
if (serviceName) {
|
|
62
|
-
const match = configs.find((config) => config.name === serviceName);
|
|
63
|
-
if (!match) {
|
|
64
|
-
const available = configs.map((config) => config.name).join(", ");
|
|
65
|
-
throw new Error(`Service "${serviceName}" not found. Available: ${available}`);
|
|
66
|
-
}
|
|
67
|
-
return match;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (configs.length === 1) return configs[0];
|
|
71
|
-
const withLocalDb = configs.filter((config) => config.testkit.database?.provider === "local");
|
|
72
|
-
if (withLocalDb.length === 1) return withLocalDb[0];
|
|
73
|
-
|
|
74
|
-
const available = configs.map((config) => config.name).join(", ");
|
|
75
|
-
throw new Error(`Multiple services available. Pass --service. Available: ${available}`);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
61
|
function normalizeOptionalString(value) {
|
|
79
62
|
if (typeof value !== "string") return null;
|
|
80
63
|
const normalized = value.trim();
|
|
81
64
|
return normalized.length > 0 ? normalized : null;
|
|
82
65
|
}
|
|
83
|
-
|
|
84
|
-
function collectRequiredConfigs(configs, targetName) {
|
|
85
|
-
const byName = new Map(configs.map((config) => [config.name, config]));
|
|
86
|
-
const required = new Set();
|
|
87
|
-
|
|
88
|
-
const visit = (name) => {
|
|
89
|
-
if (required.has(name)) return;
|
|
90
|
-
const config = byName.get(name);
|
|
91
|
-
if (!config) {
|
|
92
|
-
throw new Error(`Missing config for dependency "${name}"`);
|
|
93
|
-
}
|
|
94
|
-
required.add(name);
|
|
95
|
-
for (const depName of config.testkit.dependsOn || []) {
|
|
96
|
-
visit(depName);
|
|
97
|
-
}
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
visit(targetName);
|
|
101
|
-
return configs.filter((config) => required.has(config.name));
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function topologicallySortConfigs(configs) {
|
|
105
|
-
const byName = new Map(configs.map((config) => [config.name, config]));
|
|
106
|
-
const visited = new Set();
|
|
107
|
-
const visiting = new Set();
|
|
108
|
-
const ordered = [];
|
|
109
|
-
|
|
110
|
-
const visit = (config) => {
|
|
111
|
-
if (visited.has(config.name)) return;
|
|
112
|
-
if (visiting.has(config.name)) {
|
|
113
|
-
throw new Error(`Dependency cycle while resolving snapshot capture for "${config.name}"`);
|
|
114
|
-
}
|
|
115
|
-
visiting.add(config.name);
|
|
116
|
-
for (const depName of config.testkit.dependsOn || []) {
|
|
117
|
-
const dependency = byName.get(depName);
|
|
118
|
-
if (dependency) visit(dependency);
|
|
119
|
-
}
|
|
120
|
-
visiting.delete(config.name);
|
|
121
|
-
visited.add(config.name);
|
|
122
|
-
ordered.push(config);
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
for (const config of configs) {
|
|
126
|
-
visit(config);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
return ordered;
|
|
130
|
-
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
|
|
5
|
+
const TESTKIT_K6_BIN = "TESTKIT_K6_BIN";
|
|
6
|
+
|
|
7
|
+
export function resolveK6Binary() {
|
|
8
|
+
const override = process.env[TESTKIT_K6_BIN]?.trim();
|
|
9
|
+
if (override) {
|
|
10
|
+
const isPathLike =
|
|
11
|
+
path.isAbsolute(override) ||
|
|
12
|
+
override.includes(path.sep) ||
|
|
13
|
+
override.includes(path.posix.sep) ||
|
|
14
|
+
override.includes(path.win32.sep);
|
|
15
|
+
const overridePath = isPathLike ? path.resolve(process.cwd(), override) : override;
|
|
16
|
+
|
|
17
|
+
if (isPathLike && !fs.existsSync(overridePath)) {
|
|
18
|
+
throw new Error(`${TESTKIT_K6_BIN} points to a missing file: ${overridePath}`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return overridePath;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const thisFile = fileURLToPath(import.meta.url);
|
|
25
|
+
const abs = path.resolve(path.dirname(thisFile), "..", "..", "vendor", "k6");
|
|
26
|
+
if (!fs.existsSync(abs)) {
|
|
27
|
+
throw new Error(`Bundled k6 binary not found: ${abs}`);
|
|
28
|
+
}
|
|
29
|
+
return abs;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function resolveDalBinary() {
|
|
33
|
+
return resolveK6Binary();
|
|
34
|
+
}
|
package/lib/config/database.mjs
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { normalizeDatabaseBinding } from "../
|
|
2
|
-
import {
|
|
1
|
+
import { normalizeDatabaseBinding } from "../shared/execution-schema.mjs";
|
|
2
|
+
import {
|
|
3
|
+
normalizeConfiguredInputs,
|
|
4
|
+
normalizeConfiguredSteps,
|
|
5
|
+
} from "../shared/configured-steps.mjs";
|
|
3
6
|
|
|
4
7
|
const DEFAULT_LOCAL_IMAGE = "pgvector/pgvector:pg16";
|
|
5
8
|
const DEFAULT_LOCAL_USER = "testkit";
|
|
@@ -45,9 +48,9 @@ export function normalizeDatabaseTemplateConfig(value, serviceName) {
|
|
|
45
48
|
}
|
|
46
49
|
|
|
47
50
|
return {
|
|
48
|
-
inputs:
|
|
49
|
-
migrate:
|
|
50
|
-
seed:
|
|
51
|
-
verify:
|
|
51
|
+
inputs: normalizeConfiguredInputs(value.inputs, `Service "${serviceName}" database.template`),
|
|
52
|
+
migrate: normalizeConfiguredSteps(value.migrate, `Service "${serviceName}" database.template.migrate`),
|
|
53
|
+
seed: normalizeConfiguredSteps(value.seed, `Service "${serviceName}" database.template.seed`),
|
|
54
|
+
verify: normalizeConfiguredSteps(value.verify, `Service "${serviceName}" database.template.verify`),
|
|
52
55
|
};
|
|
53
56
|
}
|
package/lib/config/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import { fileURLToPath } from "url";
|
|
4
3
|
import { discoverProject } from "./discovery.mjs";
|
|
5
4
|
import { loadTestkitSetup } from "./setup-loader.mjs";
|
|
6
5
|
import { normalizeToolchainRegistry } from "../toolchains/index.mjs";
|
|
@@ -8,6 +7,7 @@ import { mergeDiscoveryConfigs } from "../discovery/path-policy.mjs";
|
|
|
8
7
|
import { normalizeDatabaseConfig } from "./database.mjs";
|
|
9
8
|
import { normalizeRepoDiscoveryConfig, normalizeServiceDiscoveryConfig } from "./discovery-config.mjs";
|
|
10
9
|
import { inferEnvFiles, loadServiceEnv, parseDotenv } from "./env.mjs";
|
|
10
|
+
import { resolveDalBinary, resolveK6Binary } from "./binaries.mjs";
|
|
11
11
|
import { ensureExistingPath, resolveProductDir, resolveServiceCwd } from "./paths.mjs";
|
|
12
12
|
import {
|
|
13
13
|
detectNextApp,
|
|
@@ -22,8 +22,6 @@ import { normalizeServiceRequirements, normalizeSkipConfig } from "./skip-config
|
|
|
22
22
|
import { normalizeTelemetryConfig } from "./telemetry.mjs";
|
|
23
23
|
import { validateConfigCoverage, validateServiceConfig } from "./validation.mjs";
|
|
24
24
|
|
|
25
|
-
const TESTKIT_K6_BIN = "TESTKIT_K6_BIN";
|
|
26
|
-
|
|
27
25
|
export { parseDotenv, resolveProductDir, resolveServiceCwd };
|
|
28
26
|
|
|
29
27
|
export async function loadConfigContext(opts = {}) {
|
|
@@ -92,34 +90,7 @@ export async function loadConfigs(opts = {}) {
|
|
|
92
90
|
return filtered;
|
|
93
91
|
}
|
|
94
92
|
|
|
95
|
-
export
|
|
96
|
-
const override = process.env[TESTKIT_K6_BIN]?.trim();
|
|
97
|
-
if (override) {
|
|
98
|
-
const isPathLike =
|
|
99
|
-
path.isAbsolute(override) ||
|
|
100
|
-
override.includes(path.sep) ||
|
|
101
|
-
override.includes(path.posix.sep) ||
|
|
102
|
-
override.includes(path.win32.sep);
|
|
103
|
-
const overridePath = isPathLike ? path.resolve(process.cwd(), override) : override;
|
|
104
|
-
|
|
105
|
-
if (isPathLike && !fs.existsSync(overridePath)) {
|
|
106
|
-
throw new Error(`${TESTKIT_K6_BIN} points to a missing file: ${overridePath}`);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
return overridePath;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
const thisFile = fileURLToPath(import.meta.url);
|
|
113
|
-
const abs = path.resolve(path.dirname(thisFile), "..", "..", "vendor", "k6");
|
|
114
|
-
if (!fs.existsSync(abs)) {
|
|
115
|
-
throw new Error(`Bundled k6 binary not found: ${abs}`);
|
|
116
|
-
}
|
|
117
|
-
return abs;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
export function resolveDalBinary() {
|
|
121
|
-
return resolveK6Binary();
|
|
122
|
-
}
|
|
93
|
+
export { resolveDalBinary, resolveK6Binary } from "./binaries.mjs";
|
|
123
94
|
|
|
124
95
|
function normalizeServiceConfig({
|
|
125
96
|
name,
|
package/lib/config/runtime.mjs
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
DEFAULT_FILE_TIMEOUT_SECONDS,
|
|
5
|
+
normalizeExecutionConfig,
|
|
6
|
+
normalizeRuntimeMaxConcurrentTasks,
|
|
7
|
+
normalizeRuntimeInstances,
|
|
8
|
+
} from "../shared/execution-schema.mjs";
|
|
9
|
+
import {
|
|
10
|
+
normalizeConfiguredInputs,
|
|
11
|
+
normalizeConfiguredStep,
|
|
12
|
+
normalizeConfiguredStepInputs,
|
|
13
|
+
normalizeConfiguredSteps,
|
|
14
|
+
normalizeOptionalString,
|
|
15
|
+
parseModuleSpecifier,
|
|
16
|
+
} from "../shared/configured-steps.mjs";
|
|
4
17
|
import { normalizeKnownFailureIssueValidationConfig } from "../known-failures/github.mjs";
|
|
5
18
|
import { normalizeRuntimeToolchain } from "../toolchains/index.mjs";
|
|
6
19
|
import { resolveServiceCwd } from "./paths.mjs";
|
|
7
20
|
|
|
8
|
-
export function normalizeOptionalString(value) {
|
|
9
|
-
if (typeof value !== "string") return null;
|
|
10
|
-
const normalized = value.trim();
|
|
11
|
-
return normalized.length > 0 ? normalized : null;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
21
|
export function normalizeReportingConfig(value) {
|
|
15
22
|
if (!value) return null;
|
|
16
23
|
|
|
@@ -107,90 +114,11 @@ export function normalizeRuntimePrepareConfig(value, serviceName) {
|
|
|
107
114
|
}
|
|
108
115
|
|
|
109
116
|
return {
|
|
110
|
-
inputs:
|
|
111
|
-
steps:
|
|
117
|
+
inputs: normalizeConfiguredInputs(value.inputs, `Service "${serviceName}" runtime.prepare`),
|
|
118
|
+
steps: normalizeConfiguredSteps(value.steps, `Service "${serviceName}" runtime.prepare.steps`),
|
|
112
119
|
};
|
|
113
120
|
}
|
|
114
121
|
|
|
115
|
-
export function normalizeTemplateInputs(value, label) {
|
|
116
|
-
if (value == null) return [];
|
|
117
|
-
if (!Array.isArray(value)) {
|
|
118
|
-
throw new Error(`${label}.inputs must be an array`);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return value.map((entry, index) => {
|
|
122
|
-
const normalized = normalizeOptionalString(entry);
|
|
123
|
-
if (!normalized) {
|
|
124
|
-
throw new Error(`${label}.inputs[${index}] must be a non-empty string`);
|
|
125
|
-
}
|
|
126
|
-
return normalized;
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export function normalizeTemplateLifecycleSteps(value, label) {
|
|
131
|
-
if (value == null) return [];
|
|
132
|
-
if (!Array.isArray(value)) {
|
|
133
|
-
throw new Error(`${label} must be an array`);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
return value.map((step, index) => normalizeTemplateLifecycleStep(step, `${label}[${index}]`));
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export function normalizeTemplateLifecycleStep(step, label) {
|
|
140
|
-
if (!step || typeof step !== "object") {
|
|
141
|
-
throw new Error(`${label} must be an object`);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
const kind = normalizeOptionalString(step.kind);
|
|
145
|
-
if (kind === "command") {
|
|
146
|
-
const cmd = normalizeOptionalString(step.cmd);
|
|
147
|
-
if (!cmd) throw new Error(`${label}.cmd must be a non-empty string`);
|
|
148
|
-
return {
|
|
149
|
-
kind,
|
|
150
|
-
cmd,
|
|
151
|
-
cwd: normalizeOptionalString(step.cwd),
|
|
152
|
-
inputs: normalizeTemplateStepInputs(step.inputs, label),
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
if (kind === "sql-file") {
|
|
156
|
-
const filePath = normalizeOptionalString(step.path);
|
|
157
|
-
if (!filePath) throw new Error(`${label}.path must be a non-empty string`);
|
|
158
|
-
return {
|
|
159
|
-
kind,
|
|
160
|
-
path: filePath,
|
|
161
|
-
cwd: normalizeOptionalString(step.cwd),
|
|
162
|
-
inputs: normalizeTemplateStepInputs(step.inputs, label),
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
if (kind === "module") {
|
|
166
|
-
const specifier = normalizeOptionalString(step.specifier);
|
|
167
|
-
if (!specifier) throw new Error(`${label}.specifier must be a non-empty string`);
|
|
168
|
-
return {
|
|
169
|
-
kind,
|
|
170
|
-
specifier,
|
|
171
|
-
cwd: normalizeOptionalString(step.cwd),
|
|
172
|
-
inputs: normalizeTemplateStepInputs(step.inputs, label),
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
throw new Error(`${label}.kind must be one of: command, sql-file, module`);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
export function normalizeTemplateStepInputs(value, label) {
|
|
180
|
-
if (value == null) return [];
|
|
181
|
-
if (!Array.isArray(value)) {
|
|
182
|
-
throw new Error(`${label}.inputs must be an array`);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
return value.map((entry, index) => {
|
|
186
|
-
const normalized = normalizeOptionalString(entry);
|
|
187
|
-
if (!normalized) {
|
|
188
|
-
throw new Error(`${label}.inputs[${index}] must be a non-empty string`);
|
|
189
|
-
}
|
|
190
|
-
return normalized;
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
|
|
194
122
|
export function normalizeBrowserServiceConfig(value, serviceName) {
|
|
195
123
|
if (!value) return undefined;
|
|
196
124
|
if (typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -232,10 +160,11 @@ export function detectNextApp(cwd) {
|
|
|
232
160
|
);
|
|
233
161
|
}
|
|
234
162
|
|
|
235
|
-
export
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
163
|
+
export {
|
|
164
|
+
normalizeConfiguredInputs as normalizeTemplateInputs,
|
|
165
|
+
normalizeConfiguredStep as normalizeTemplateLifecycleStep,
|
|
166
|
+
normalizeConfiguredStepInputs as normalizeTemplateStepInputs,
|
|
167
|
+
normalizeConfiguredSteps as normalizeTemplateLifecycleSteps,
|
|
168
|
+
normalizeOptionalString,
|
|
169
|
+
parseModuleSpecifier,
|
|
170
|
+
} from "../shared/configured-steps.mjs";
|