@gfdelarue/testkit 0.4.5 → 0.6.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/README.md +724 -495
- package/bin/testkit-windows-owner-arm64.exe +0 -0
- package/bin/testkit-windows-owner-x64.exe +0 -0
- package/dist/app/bugs/ci-report.js +2 -2
- package/dist/app/bugs/ci-summary.js +3 -3
- package/dist/app/bugs/draft.js +3 -3
- package/dist/app/bugs/file.js +1 -1
- package/dist/app/bugs/gate.js +1 -1
- package/dist/app/bugs/guide.js +3 -3
- package/dist/app/bugs/issue.js +4 -4
- package/dist/app/bugs/known-failures.js +1 -1
- package/dist/app/bugs/record.js +1 -1
- package/dist/app/bugs/run-reading.js +1 -1
- package/dist/app/bugs/supplied-reproduce.js +1 -0
- package/dist/app/campaigns/campaign.js +1 -1
- package/dist/app/campaigns/index.js +2 -2
- package/dist/app/cleanup/index.js +1 -1
- package/dist/app/db-schema/prepare.js +1 -1
- package/dist/app/destroy/index.js +1 -1
- package/dist/app/discover/index.js +2 -2
- package/dist/app/doctor/index.js +1 -1
- package/dist/app/environments/config-driven.js +1 -1
- package/dist/app/environments/environment-file.js +1 -0
- package/dist/app/environments/file-setup.js +1 -0
- package/dist/app/environments/routing.js +1 -1
- package/dist/app/environments/static-values.js +1 -0
- package/dist/app/environments/supplied-input.js +1 -0
- package/dist/app/environments/supplied.js +1 -1
- package/dist/app/environments/task-databases.js +2 -0
- package/dist/app/inspect/artifacts.js +1 -1
- package/dist/app/inspect/index.js +1 -1
- package/dist/app/lint/index.js +1 -1
- package/dist/app/lint/native.js +1 -1
- package/dist/app/lint/options.js +1 -1
- package/dist/app/lint/rules/engine-imports.js +1 -1
- package/dist/app/lint/rules/syntax.js +1 -1
- package/dist/app/lint/rules/unit.js +1 -1
- package/dist/app/reports/prepare.js +1 -1
- package/dist/app/run/caller-redaction.js +1 -0
- package/dist/app/run/engine-execution-failures.js +1 -1
- package/dist/app/run/engine-execution-reporting.js +1 -1
- package/dist/app/run/engine-execution.js +1 -1
- package/dist/app/run/engine-orchestration.js +1 -1
- package/dist/app/run/environment.js +1 -1
- package/dist/app/run/failure-details.js +1 -1
- package/dist/app/run/live-run.js +1 -1
- package/dist/app/run/orchestrator.js +1 -1
- package/dist/app/run/planning.js +1 -1
- package/dist/app/run/request.js +1 -1
- package/dist/app/run/results.js +1 -1
- package/dist/app/run/run-events.js +1 -1
- package/dist/app/run/run-finalization.js +1 -1
- package/dist/app/run/scheduler/estimates.js +1 -1
- package/dist/app/run/scheduler/identity.js +1 -1
- package/dist/app/run/scheduler/index.js +1 -1
- package/dist/app/run/setup/runtime-node-setup-protocol.js +1 -1
- package/dist/app/run/setup/runtime-node-setup-worker.js +1 -1
- package/dist/app/run/setup/runtime-node-setup.js +2 -2
- package/dist/app/run/task-batches.js +1 -1
- package/dist/app/run/worker-loop.js +1 -1
- package/dist/app/status/model.js +1 -1
- package/dist/app/status/runs.js +1 -1
- package/dist/app/typecheck/index.js +4 -4
- package/dist/cli/command-catalog.js +1 -1
- package/dist/cli/command-flags.js +1 -1
- package/dist/cli/commands/artifacts.js +2 -2
- package/dist/cli/commands/bug/file.js +2 -2
- package/dist/cli/commands/bug/record.js +2 -2
- package/dist/cli/commands/discover.js +1 -1
- package/dist/cli/commands/guard/unsafe-entrypoint.js +1 -1
- package/dist/cli/commands/run.js +2 -2
- package/dist/cli/commands/typecheck.js +1 -1
- package/dist/cli/commands/workspace.js +1 -1
- package/dist/cli/framework/errors.js +1 -1
- package/dist/cli/framework/execute.js +7 -6
- package/dist/cli/framework/parser.js +1 -1
- package/dist/cli/operations/run/operation.js +2 -2
- package/dist/cli/renderers/bug/text.js +1 -1
- package/dist/cli/renderers/discover/report.js +1 -1
- package/dist/cli/renderers/run/events.js +2 -2
- package/dist/cli/renderers/run/formatting.js +1 -1
- package/dist/cli/renderers/run/status.js +1 -1
- package/dist/cli/renderers/run/text-reporter.js +24 -22
- package/dist/cli/terminal/colors.js +1 -1
- package/dist/cli/terminal/layout.js +2 -2
- package/dist/config/authoring/database-fixture-discovery.js +1 -0
- package/dist/config/authoring/http-methods.js +1 -1
- package/dist/config/authoring/index.js +1 -1
- package/dist/config/loader/config-loader.js +1 -1
- package/dist/config/loader/decode-discovery.js +1 -1
- package/dist/config/loader/decode-execution.js +1 -1
- package/dist/config/loader/dependencies.js +1 -1
- package/dist/config/loader/discover-tests.js +1 -1
- package/dist/config/loader/discovery-summary.js +1 -1
- package/dist/config/loader/discovery.js +2 -2
- package/dist/config/loader/env.js +1 -1
- package/dist/config/loader/file-metadata.js +1 -1
- package/dist/config/loader/groups.js +2 -1
- package/dist/config/loader/index.js +1 -1
- package/dist/config/loader/load.js +1 -1
- package/dist/config/loader/managed-configs.js +1 -1
- package/dist/config/loader/owned-discovery.js +1 -0
- package/dist/config/loader/path-policy.js +1 -1
- package/dist/config/loader/runtime-isolation.js +1 -1
- package/dist/config/loader/runtime.js +1 -1
- package/dist/config/loader/skip-config.js +1 -1
- package/dist/config/loader/task-policy.js +1 -0
- package/dist/config/loader/test-selection.js +1 -1
- package/dist/config/loader/validation.js +1 -1
- package/dist/database/admin.js +2 -2
- package/dist/database/bindings.js +1 -0
- package/dist/database/cleanup.js +1 -1
- package/dist/database/configured-steps.js +1 -1
- package/dist/database/docker-metadata.js +3 -3
- package/dist/database/docker.js +3 -3
- package/dist/database/index.js +1 -1
- package/dist/database/local-postgres.js +1 -1
- package/dist/database/naming.js +1 -1
- package/dist/database/postgres/connection-check.js +1 -0
- package/dist/database/postgres/protocol.js +2 -0
- package/dist/database/schema-operations.js +1 -1
- package/dist/database/schema-source.js +3 -3
- package/dist/database/source-schema-env.js +1 -0
- package/dist/database/state-files.js +1 -1
- package/dist/database/state.js +1 -1
- package/dist/database/steps.js +3 -3
- package/dist/domain/file-timeout.js +1 -1
- package/dist/domain/identifiers.js +1 -1
- package/dist/domain/retired-test-types.js +1 -0
- package/dist/domain/runtime-isolation-contract.js +1 -1
- package/dist/domain/suite-selection.js +1 -1
- package/dist/domain/test-types.js +1 -1
- package/dist/engines/adapters/evidence-files.js +1 -1
- package/dist/engines/adapters/execution.js +1 -1
- package/dist/engines/adapters/json-bounds.js +2 -0
- package/dist/engines/adapters/native-report.js +1 -1
- package/dist/engines/api/execution.js +1 -1
- package/dist/engines/api/index.js +1 -1
- package/dist/engines/api/runtime-artifact.js +1 -1
- package/dist/engines/catalog.js +1 -1
- package/dist/engines/contracts/environment-values.js +1 -0
- package/dist/engines/definitions.js +1 -1
- package/dist/engines/environment/handles.js +1 -0
- package/dist/engines/environment/index.js +1 -0
- package/dist/engines/factory.js +1 -1
- package/dist/engines/installations/node-vitest.js +1 -1
- package/dist/engines/installations/package-resolution.js +1 -1
- package/dist/engines/installations/playwright.js +1 -1
- package/dist/engines/managed-module-resolution.js +8 -4
- package/dist/engines/manager.js +1 -1
- package/dist/engines/node-vitest/adapter/adapter.js +1 -1
- package/dist/engines/node-vitest/adapter/driver.js +2 -0
- package/dist/engines/node-vitest/adapter/evidence.js +2 -2
- package/dist/engines/node-vitest/adapter/failure-details.js +4 -2
- package/dist/engines/node-vitest/adapter/reporter.js +1 -1
- package/dist/engines/node-vitest/adapter/workspace.js +17 -195
- package/dist/engines/node-vitest/inventory/index.js +2 -0
- package/dist/engines/node-vitest/inventory/list-files.js +3 -0
- package/dist/engines/node-vitest/runtime/data/index.js +1 -1
- package/dist/engines/node-vitest/runtime/data/report.js +5 -6
- package/dist/engines/node-vitest/runtime/data/scenario.js +2 -2
- package/dist/engines/node-vitest/runtime/runtime-input.js +1 -1
- package/dist/engines/node-vitest/selection.js +1 -0
- package/dist/engines/playwright/adapter/adapter.js +1 -1
- package/dist/engines/playwright/adapter/config.js +3 -3
- package/dist/engines/playwright/adapter/evidence-validation.js +1 -1
- package/dist/engines/playwright/adapter/evidence.js +1 -1
- package/dist/engines/playwright/adapter/reporter.js +1 -1
- package/dist/engines/playwright/runtime/config-file.js +1 -1
- package/dist/engines/playwright/runtime/config.js +1 -1
- package/dist/engines/playwright/runtime/managed-test.js +1 -0
- package/dist/engines/playwright/runtime/runtime-input.js +29 -10
- package/dist/engines/runtime-input-file.js +1 -1
- package/dist/environment/lifecycle-controller.js +1 -1
- package/dist/environment/lifecycle.js +1 -1
- package/dist/environment/ready-environment.js +1 -1
- package/dist/environment/run-environment.js +1 -1
- package/dist/environment/run-stopping.js +1 -1
- package/dist/environment/runtime-contexts.js +1 -1
- package/dist/environment/runtime-manager.js +1 -1
- package/dist/environment/runtime-planning.js +1 -1
- package/dist/environment/runtime-preparation.js +1 -1
- package/dist/environment/services.js +3 -3
- package/dist/environment/template.js +1 -1
- package/dist/evidence/artifact-config.js +1 -1
- package/dist/evidence/artifacts.js +2 -2
- package/dist/evidence/bundles.js +1 -1
- package/dist/evidence/environment-record.js +1 -1
- package/dist/evidence/index.js +1 -1
- package/dist/evidence/maintenance.js +1 -0
- package/dist/evidence/read-run.js +1 -1
- package/dist/evidence/reading.js +1 -1
- package/dist/evidence/redaction.js +4 -0
- package/dist/evidence/reporting.js +1 -1
- package/dist/evidence/run-model.js +1 -0
- package/dist/evidence/storage.js +2 -2
- package/dist/evidence/timing.js +1 -1
- package/dist/kernel/error-serialization.js +1 -1
- package/dist/kernel/known-keys.js +1 -0
- package/dist/kernel/redaction-targets.js +1 -0
- package/dist/kernel/redaction.js +4 -1
- package/dist/kernel/unknown-values.js +1 -1
- package/dist/process/environment.js +1 -1
- package/dist/process/execa-bundle.json +3 -3
- package/dist/process/files/json-file.js +1 -1
- package/dist/process/host/platform.js +1 -1
- package/dist/process/host-process.js +1 -1
- package/dist/process/index.js +1 -1
- package/dist/process/locks.js +4 -4
- package/dist/process/port-listener.js +2 -0
- package/dist/process/process-group.js +1 -1
- package/dist/process/process.js +32 -32
- package/dist/process/readiness.js +1 -1
- package/dist/process/ready-deadline.js +1 -0
- package/dist/process/runs/ownership.js +1 -1
- package/dist/process/runs/stop.js +1 -1
- package/dist/process/service-processes.js +1 -1
- package/dist/process/windows-cli-owner.js +3 -3
- package/dist/process/windows-native.js +1 -1
- package/dist/repo/fingerprint-policy.js +1 -1
- package/dist/repo/managed-git.js +1 -1
- package/dist/repo/physical-tree.js +1 -1
- package/dist/repo/state.js +4 -4
- package/dist/steps/build-config.js +1 -1
- package/dist/steps/configured-step-testkit-modules.js +1 -1
- package/dist/steps/configured-steps.js +1 -1
- package/dist/steps/environment.js +1 -1
- package/dist/steps/index.js +1 -1
- package/dist/toolchains/index.js +3 -3
- package/dist/toolchains/semver.js +1 -1
- package/dist/toolchains/vitest/index.js +1 -1
- package/dist/tracker/redaction.js +1 -2
- package/dist/{config/runtime/build-assets.d.ts → types/config-build-assets.d.ts} +5 -3
- package/dist/{database/steps.d.ts → types/config-database-steps.d.ts} +7 -7
- package/dist/{config/runtime/next-runtime-tsconfig.d.ts → types/config-next-runtime-tsconfig.d.ts} +5 -3
- package/dist/types/config.d.ts +422 -0
- package/dist/types/drizzle.d.ts +13 -0
- package/dist/{config/runtime/env/index.d.ts → types/env.d.ts} +22 -20
- package/dist/types/environment.d.ts +46 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/node-vitest-data.d.ts +191 -0
- package/dist/types/playwright.d.ts +130 -0
- package/dist/types/tooling-vitest.d.ts +13 -0
- package/dist/types/workspace.d.ts +633 -0
- package/docs/bug-records.md +35 -40
- package/docs/engines.md +259 -0
- package/docs/release-notes.md +2116 -0
- package/docs/test-types.md +37 -85
- package/package.json +22 -32
- package/testkit-config-schema.md +391 -260
- package/dist/app/bugs/areas.d.ts +0 -38
- package/dist/app/bugs/assessment.d.ts +0 -9
- package/dist/app/bugs/categories.d.ts +0 -41
- package/dist/app/bugs/ci-report.d.ts +0 -21
- package/dist/app/bugs/ci-summary.d.ts +0 -13
- package/dist/app/bugs/draft.d.ts +0 -70
- package/dist/app/bugs/facts.d.ts +0 -49
- package/dist/app/bugs/file.d.ts +0 -45
- package/dist/app/bugs/gate.d.ts +0 -22
- package/dist/app/bugs/guide.d.ts +0 -20
- package/dist/app/bugs/issue.d.ts +0 -18
- package/dist/app/bugs/known-failures.d.ts +0 -49
- package/dist/app/bugs/record.d.ts +0 -14
- package/dist/app/bugs/run-reading.d.ts +0 -51
- package/dist/app/bugs/store.d.ts +0 -34
- package/dist/app/campaigns/brief.d.ts +0 -7
- package/dist/app/campaigns/campaign.d.ts +0 -14
- package/dist/app/campaigns/index.d.ts +0 -38
- package/dist/app/campaigns/store.d.ts +0 -5
- package/dist/app/campaigns/summary.d.ts +0 -13
- package/dist/app/cleanup/index.d.ts +0 -52
- package/dist/app/db-schema/prepare.d.ts +0 -11
- package/dist/app/db-schema/refresh.d.ts +0 -17
- package/dist/app/db-schema/verify.d.ts +0 -11
- package/dist/app/destroy/index.d.ts +0 -16
- package/dist/app/discover/index.d.ts +0 -8
- package/dist/app/doctor/index.d.ts +0 -17
- package/dist/app/environments/config-driven.d.ts +0 -5
- package/dist/app/environments/routing.d.ts +0 -6
- package/dist/app/environments/supplied.d.ts +0 -3
- package/dist/app/file-selection.d.ts +0 -1
- package/dist/app/inspect/artifacts.d.ts +0 -30
- package/dist/app/inspect/index.d.ts +0 -112
- package/dist/app/lint/index.d.ts +0 -28
- package/dist/app/lint/native.d.ts +0 -10
- package/dist/app/lint/options.d.ts +0 -66
- package/dist/app/lint/policy.d.ts +0 -21
- package/dist/app/lint/rules/data.d.ts +0 -3
- package/dist/app/lint/rules/data.js +0 -1
- package/dist/app/lint/rules/engine-imports.d.ts +0 -3
- package/dist/app/lint/rules/syntax.d.ts +0 -4
- package/dist/app/lint/rules/unit.d.ts +0 -3
- package/dist/app/lint/shared.d.ts +0 -34
- package/dist/app/package-inspection.d.ts +0 -20
- package/dist/app/reports/files.d.ts +0 -13
- package/dist/app/reports/prepare.d.ts +0 -20
- package/dist/app/reports/publish.d.ts +0 -21
- package/dist/app/run/endpoint-readiness.d.ts +0 -43
- package/dist/app/run/endpoint-readiness.js +0 -1
- package/dist/app/run/engine-evidence-persistence.d.ts +0 -39
- package/dist/app/run/engine-execution-cleanup.d.ts +0 -8
- package/dist/app/run/engine-execution-cleanup.js +0 -1
- package/dist/app/run/engine-execution-failures.d.ts +0 -41
- package/dist/app/run/engine-execution-observer.d.ts +0 -21
- package/dist/app/run/engine-execution-reporting.d.ts +0 -17
- package/dist/app/run/engine-execution.d.ts +0 -65
- package/dist/app/run/engine-failure-stack.d.ts +0 -1
- package/dist/app/run/engine-orchestration.d.ts +0 -30
- package/dist/app/run/environment.d.ts +0 -33
- package/dist/app/run/failure-details.d.ts +0 -37
- package/dist/app/run/live-run.d.ts +0 -29
- package/dist/app/run/operation-progress.d.ts +0 -13
- package/dist/app/run/orchestrator.d.ts +0 -75
- package/dist/app/run/planning-types.d.ts +0 -68
- package/dist/app/run/planning.d.ts +0 -14
- package/dist/app/run/request.d.ts +0 -30
- package/dist/app/run/results.d.ts +0 -161
- package/dist/app/run/run-events.d.ts +0 -144
- package/dist/app/run/run-finalization.d.ts +0 -56
- package/dist/app/run/run-guards.d.ts +0 -3
- package/dist/app/run/runtime-failures.d.ts +0 -18
- package/dist/app/run/runtime-fixtures.d.ts +0 -2
- package/dist/app/run/runtime-task-types.d.ts +0 -20
- package/dist/app/run/scheduler/estimates.d.ts +0 -32
- package/dist/app/run/scheduler/identity.d.ts +0 -9
- package/dist/app/run/scheduler/index.d.ts +0 -124
- package/dist/app/run/scheduler/locks.d.ts +0 -6
- package/dist/app/run/scheduler/observations.d.ts +0 -20
- package/dist/app/run/selection.d.ts +0 -9
- package/dist/app/run/setup/runtime-node-setup-errors.d.ts +0 -13
- package/dist/app/run/setup/runtime-node-setup-protocol.d.ts +0 -85
- package/dist/app/run/setup/runtime-node-setup-worker.d.ts +0 -1
- package/dist/app/run/setup/runtime-node-setup.d.ts +0 -48
- package/dist/app/run/task-batches.d.ts +0 -23
- package/dist/app/run/task-leases.d.ts +0 -15
- package/dist/app/run/worker-loop.d.ts +0 -66
- package/dist/app/setup/playwright.d.ts +0 -22
- package/dist/app/status/index.d.ts +0 -9
- package/dist/app/status/model.d.ts +0 -29
- package/dist/app/status/runs.d.ts +0 -99
- package/dist/app/stop/index.d.ts +0 -14
- package/dist/app/tracker/index.d.ts +0 -13
- package/dist/app/tracker/remote.d.ts +0 -13
- package/dist/app/tracker/token.d.ts +0 -7
- package/dist/app/typecheck/index.d.ts +0 -63
- package/dist/cli/command-catalog.d.ts +0 -156
- package/dist/cli/command-flags.d.ts +0 -19
- package/dist/cli/command-registry.d.ts +0 -3
- package/dist/cli/commands/artifacts.d.ts +0 -48
- package/dist/cli/commands/bug/file.d.ts +0 -16
- package/dist/cli/commands/bug/guide.d.ts +0 -5
- package/dist/cli/commands/bug/record.d.ts +0 -9
- package/dist/cli/commands/campaign/finish.d.ts +0 -10
- package/dist/cli/commands/campaign/start.d.ts +0 -7
- package/dist/cli/commands/campaign/status.d.ts +0 -13
- package/dist/cli/commands/ci/report.d.ts +0 -15
- package/dist/cli/commands/cleanup.d.ts +0 -13
- package/dist/cli/commands/db/schema/refresh.d.ts +0 -2
- package/dist/cli/commands/db/schema/verify.d.ts +0 -2
- package/dist/cli/commands/destroy.d.ts +0 -9
- package/dist/cli/commands/discover.d.ts +0 -2
- package/dist/cli/commands/doctor.d.ts +0 -2
- package/dist/cli/commands/guard/unsafe-entrypoint.d.ts +0 -2
- package/dist/cli/commands/lint.d.ts +0 -2
- package/dist/cli/commands/report/prepare.d.ts +0 -12
- package/dist/cli/commands/report/publish.d.ts +0 -13
- package/dist/cli/commands/run/status.d.ts +0 -5
- package/dist/cli/commands/run/stop.d.ts +0 -7
- package/dist/cli/commands/run.d.ts +0 -9
- package/dist/cli/commands/setup/playwright.d.ts +0 -2
- package/dist/cli/commands/status.d.ts +0 -5
- package/dist/cli/commands/stop.d.ts +0 -12
- package/dist/cli/commands/typecheck.d.ts +0 -2
- package/dist/cli/commands/workspace.d.ts +0 -2
- package/dist/cli/entrypoint.d.ts +0 -1
- package/dist/cli/framework/command.d.ts +0 -21
- package/dist/cli/framework/definitions.d.ts +0 -100
- package/dist/cli/framework/errors.d.ts +0 -6
- package/dist/cli/framework/execute.d.ts +0 -14
- package/dist/cli/framework/help.d.ts +0 -11
- package/dist/cli/framework/index.d.ts +0 -3
- package/dist/cli/framework/parser.d.ts +0 -6
- package/dist/cli/index.d.ts +0 -4
- package/dist/cli/json-errors.d.ts +0 -3
- package/dist/cli/operations/db/schema/refresh/operation.d.ts +0 -7
- package/dist/cli/operations/db/schema/verify/operation.d.ts +0 -7
- package/dist/cli/operations/run/operation.d.ts +0 -26
- package/dist/cli/process-signal.d.ts +0 -1
- package/dist/cli/renderers/bug/text.d.ts +0 -8
- package/dist/cli/renderers/campaign/text.d.ts +0 -2
- package/dist/cli/renderers/ci/text.d.ts +0 -2
- package/dist/cli/renderers/cleanup/format.d.ts +0 -14
- package/dist/cli/renderers/db-schema/text.d.ts +0 -4
- package/dist/cli/renderers/destroy/text.d.ts +0 -4
- package/dist/cli/renderers/discover/report.d.ts +0 -7
- package/dist/cli/renderers/discover/text.d.ts +0 -3
- package/dist/cli/renderers/doctor/text.d.ts +0 -2
- package/dist/cli/renderers/lint/text.d.ts +0 -2
- package/dist/cli/renderers/run/events.d.ts +0 -8
- package/dist/cli/renderers/run/failure.d.ts +0 -8
- package/dist/cli/renderers/run/formatting.d.ts +0 -79
- package/dist/cli/renderers/run/status.d.ts +0 -6
- package/dist/cli/renderers/run/text-reporter.d.ts +0 -19
- package/dist/cli/renderers/status/text.d.ts +0 -2
- package/dist/cli/renderers/stop/text.d.ts +0 -7
- package/dist/cli/renderers/typecheck/text.d.ts +0 -2
- package/dist/cli/terminal/colors.d.ts +0 -10
- package/dist/cli/terminal/layout.d.ts +0 -11
- package/dist/cli/version-drift.d.ts +0 -25
- package/dist/config/authoring/build-config-contract.d.ts +0 -27
- package/dist/config/authoring/configured-step-contract.d.ts +0 -18
- package/dist/config/authoring/http-execution-contract.d.ts +0 -70
- package/dist/config/authoring/http-methods.d.ts +0 -18
- package/dist/config/authoring/index.d.ts +0 -372
- package/dist/config/authoring/preset-env.d.ts +0 -19
- package/dist/config/authoring/runtime.d.ts +0 -64
- package/dist/config/authoring/runtime.js +0 -1
- package/dist/config/loader/bugs.d.ts +0 -15
- package/dist/config/loader/config-loader.d.ts +0 -9
- package/dist/config/loader/database-materialization.d.ts +0 -19
- package/dist/config/loader/database-roles.d.ts +0 -2
- package/dist/config/loader/database.d.ts +0 -55
- package/dist/config/loader/decode-discovery.d.ts +0 -5
- package/dist/config/loader/decode-execution.d.ts +0 -7
- package/dist/config/loader/dependencies.d.ts +0 -7
- package/dist/config/loader/discover-tests.d.ts +0 -111
- package/dist/config/loader/discovery-summary.d.ts +0 -29
- package/dist/config/loader/discovery.d.ts +0 -53
- package/dist/config/loader/env.d.ts +0 -4
- package/dist/config/loader/execution-model.d.ts +0 -15
- package/dist/config/loader/file-metadata.d.ts +0 -19
- package/dist/config/loader/groups.d.ts +0 -33
- package/dist/config/loader/index.d.ts +0 -10
- package/dist/config/loader/load.d.ts +0 -89
- package/dist/config/loader/managed-configs.d.ts +0 -23
- package/dist/config/loader/path-policy.d.ts +0 -9
- package/dist/config/loader/paths.d.ts +0 -5
- package/dist/config/loader/runtime-isolation.d.ts +0 -44
- package/dist/config/loader/runtime.d.ts +0 -16
- package/dist/config/loader/skip-config.d.ts +0 -44
- package/dist/config/loader/test-selection.d.ts +0 -15
- package/dist/config/loader/validation.d.ts +0 -15
- package/dist/config/loader/values.d.ts +0 -3
- package/dist/config/loader/values.js +0 -1
- package/dist/database/activity-gate.d.ts +0 -22
- package/dist/database/admin.d.ts +0 -31
- package/dist/database/cleanup.d.ts +0 -36
- package/dist/database/configured-steps.d.ts +0 -27
- package/dist/database/constants.d.ts +0 -11
- package/dist/database/docker-metadata.d.ts +0 -3
- package/dist/database/docker.d.ts +0 -65
- package/dist/database/drizzle/index.d.ts +0 -13
- package/dist/database/fingerprint.d.ts +0 -12
- package/dist/database/index.d.ts +0 -39
- package/dist/database/lifecycle-cleanup.d.ts +0 -8
- package/dist/database/local-postgres.d.ts +0 -71
- package/dist/database/naming.d.ts +0 -17
- package/dist/database/postgres/index.d.ts +0 -71
- package/dist/database/progress.d.ts +0 -6
- package/dist/database/roles.d.ts +0 -19
- package/dist/database/runtime-config.d.ts +0 -16
- package/dist/database/runtime-reservations.d.ts +0 -19
- package/dist/database/schema-operations.d.ts +0 -18
- package/dist/database/schema-source.d.ts +0 -96
- package/dist/database/source-refresh-lock.d.ts +0 -8
- package/dist/database/source-url.d.ts +0 -21
- package/dist/database/state-files.d.ts +0 -13
- package/dist/database/state.d.ts +0 -26
- package/dist/database/template-steps.d.ts +0 -39
- package/dist/domain/file-timeout.d.ts +0 -25
- package/dist/domain/identifiers.d.ts +0 -9
- package/dist/domain/operation-display.d.ts +0 -10
- package/dist/domain/operation-reason.d.ts +0 -5
- package/dist/domain/postgres-route.d.ts +0 -4
- package/dist/domain/runtime-identity.d.ts +0 -1
- package/dist/domain/runtime-isolation-contract.d.ts +0 -5
- package/dist/domain/service-name.d.ts +0 -2
- package/dist/domain/suite-selection.d.ts +0 -20
- package/dist/domain/test-outcomes.d.ts +0 -2
- package/dist/domain/test-types.d.ts +0 -16
- package/dist/engines/adapters/evidence-files.d.ts +0 -32
- package/dist/engines/adapters/evidence-identity.d.ts +0 -12
- package/dist/engines/adapters/execution.d.ts +0 -41
- package/dist/engines/adapters/native-report.d.ts +0 -25
- package/dist/engines/adapters/node-startup-cache.d.ts +0 -8
- package/dist/engines/adapters/workspace.d.ts +0 -4
- package/dist/engines/api/capabilities.d.ts +0 -21
- package/dist/engines/api/capabilities.js +0 -1
- package/dist/engines/api/evidence.d.ts +0 -38
- package/dist/engines/api/execution-observer.d.ts +0 -8
- package/dist/engines/api/execution-scope.d.ts +0 -17
- package/dist/engines/api/execution.d.ts +0 -101
- package/dist/engines/api/index.d.ts +0 -5
- package/dist/engines/api/k6-runtime-input.d.ts +0 -26
- package/dist/engines/api/k6-runtime-input.js +0 -1
- package/dist/engines/api/runtime-artifact.d.ts +0 -19
- package/dist/engines/bundle-cache.d.ts +0 -32
- package/dist/engines/catalog.d.ts +0 -27
- package/dist/engines/contracts/fixture-manifest.d.ts +0 -34
- package/dist/engines/contracts/json-bounds.d.ts +0 -36
- package/dist/engines/contracts/json-bounds.js +0 -2
- package/dist/engines/contracts/k6-repository-configuration.d.ts +0 -12
- package/dist/engines/contracts/k6-repository-configuration.js +0 -1
- package/dist/engines/contracts/test-context.d.ts +0 -15
- package/dist/engines/contracts/test-context.js +0 -1
- package/dist/engines/definitions.d.ts +0 -23
- package/dist/engines/factory.d.ts +0 -6
- package/dist/engines/generated-performance.d.ts +0 -1
- package/dist/engines/installation-catalog.d.ts +0 -27
- package/dist/engines/installation-catalog.js +0 -1
- package/dist/engines/installations/k6.d.ts +0 -98
- package/dist/engines/installations/k6.js +0 -1
- package/dist/engines/installations/node-vitest.d.ts +0 -33
- package/dist/engines/installations/package-requirements.d.ts +0 -28
- package/dist/engines/installations/package-resolution.d.ts +0 -51
- package/dist/engines/installations/playwright-resolution-child.d.ts +0 -1
- package/dist/engines/installations/playwright.d.ts +0 -75
- package/dist/engines/installations/types.d.ts +0 -10
- package/dist/engines/k6/adapter/bundle.d.ts +0 -25
- package/dist/engines/k6/adapter/bundle.js +0 -112
- package/dist/engines/k6/adapter/evidence.d.ts +0 -15
- package/dist/engines/k6/adapter/evidence.js +0 -4
- package/dist/engines/k6/adapter/executor.d.ts +0 -13
- package/dist/engines/k6/adapter/executor.js +0 -1
- package/dist/engines/k6/adapter/index.d.ts +0 -1
- package/dist/engines/k6/adapter/index.js +0 -1
- package/dist/engines/k6/adapter/input.d.ts +0 -21
- package/dist/engines/k6/adapter/input.js +0 -1
- package/dist/engines/k6/adapter/native-summary.d.ts +0 -11
- package/dist/engines/k6/adapter/native-summary.js +0 -1
- package/dist/engines/k6/adapter/repository-configuration.d.ts +0 -2
- package/dist/engines/k6/adapter/repository-configuration.js +0 -1
- package/dist/engines/k6/authoring-type-paths.d.ts +0 -3
- package/dist/engines/k6/authoring-type-paths.js +0 -1
- package/dist/engines/k6/runtime/ambient-types/bundle-manifest.json +0 -146
- package/dist/engines/k6/runtime/ambient-types/k6/LICENSE +0 -21
- package/dist/engines/k6/runtime/ambient-types/k6/browser/index.d.ts +0 -6332
- package/dist/engines/k6/runtime/ambient-types/k6/crypto/index.d.ts +0 -218
- package/dist/engines/k6/runtime/ambient-types/k6/data/index.d.ts +0 -16
- package/dist/engines/k6/runtime/ambient-types/k6/encoding/index.d.ts +0 -46
- package/dist/engines/k6/runtime/ambient-types/k6/execution/index.d.ts +0 -127
- package/dist/engines/k6/runtime/ambient-types/k6/experimental/csv/index.d.ts +0 -96
- package/dist/engines/k6/runtime/ambient-types/k6/experimental/fs/index.d.ts +0 -104
- package/dist/engines/k6/runtime/ambient-types/k6/experimental/redis/index.d.ts +0 -821
- package/dist/engines/k6/runtime/ambient-types/k6/experimental/streams/index.d.ts +0 -198
- package/dist/engines/k6/runtime/ambient-types/k6/global.d.ts +0 -83
- package/dist/engines/k6/runtime/ambient-types/k6/html/index.d.ts +0 -1325
- package/dist/engines/k6/runtime/ambient-types/k6/http/index.d.ts +0 -806
- package/dist/engines/k6/runtime/ambient-types/k6/index.d.ts +0 -126
- package/dist/engines/k6/runtime/ambient-types/k6/metrics/index.d.ts +0 -66
- package/dist/engines/k6/runtime/ambient-types/k6/net/grpc/index.d.ts +0 -247
- package/dist/engines/k6/runtime/ambient-types/k6/options/index.d.ts +0 -459
- package/dist/engines/k6/runtime/ambient-types/k6/package.json +0 -79
- package/dist/engines/k6/runtime/ambient-types/k6/secrets/index.d.ts +0 -36
- package/dist/engines/k6/runtime/ambient-types/k6/timers/index.d.ts +0 -47
- package/dist/engines/k6/runtime/ambient-types/k6/websockets/index.d.ts +0 -324
- package/dist/engines/k6/runtime/ambient-types/k6/ws/index.d.ts +0 -283
- package/dist/engines/k6/runtime/ambient-types/xk6-sql/LICENSE +0 -201
- package/dist/engines/k6/runtime/ambient-types/xk6-sql/index.d.ts +0 -397
- package/dist/engines/k6/runtime/ambient-types/xk6-sql/package.json +0 -15
- package/dist/engines/k6/runtime/artifacts.d.ts +0 -2
- package/dist/engines/k6/runtime/artifacts.js +0 -1
- package/dist/engines/k6/runtime/checks.d.ts +0 -17
- package/dist/engines/k6/runtime/checks.js +0 -1
- package/dist/engines/k6/runtime/dal-fixtures.d.ts +0 -24
- package/dist/engines/k6/runtime/dal-fixtures.js +0 -1
- package/dist/engines/k6/runtime/dal-suite.d.ts +0 -24
- package/dist/engines/k6/runtime/dal-suite.js +0 -1
- package/dist/engines/k6/runtime/dal.d.ts +0 -10
- package/dist/engines/k6/runtime/dal.js +0 -1
- package/dist/engines/k6/runtime/fixtures.d.ts +0 -3
- package/dist/engines/k6/runtime/fixtures.js +0 -1
- package/dist/engines/k6/runtime/http-assertions.d.ts +0 -19
- package/dist/engines/k6/runtime/http-assertions.js +0 -1
- package/dist/engines/k6/runtime/http-checks.d.ts +0 -19
- package/dist/engines/k6/runtime/http-checks.js +0 -1
- package/dist/engines/k6/runtime/http-suite-runtime.d.ts +0 -103
- package/dist/engines/k6/runtime/http-suite-runtime.js +0 -1
- package/dist/engines/k6/runtime/http.d.ts +0 -15
- package/dist/engines/k6/runtime/http.js +0 -1
- package/dist/engines/k6/runtime/index.d.ts +0 -11
- package/dist/engines/k6/runtime/index.js +0 -1
- package/dist/engines/k6/runtime/input.d.ts +0 -3
- package/dist/engines/k6/runtime/input.js +0 -1
- package/dist/engines/k6/runtime/k6-repository-configuration.d.ts +0 -9
- package/dist/engines/k6/runtime/k6-repository-configuration.js +0 -1
- package/dist/engines/k6/runtime/node-setup.d.ts +0 -13
- package/dist/engines/k6/runtime/node-setup.js +0 -1
- package/dist/engines/k6/runtime/runtime-globals.d.ts +0 -10
- package/dist/engines/k6/runtime/runtime.d.ts +0 -54
- package/dist/engines/k6/runtime/runtime.js +0 -1
- package/dist/engines/k6/runtime/shared/assertion-details.d.ts +0 -19
- package/dist/engines/k6/runtime/shared/assertion-details.js +0 -2
- package/dist/engines/k6/runtime/shared/db-normalization.d.ts +0 -19
- package/dist/engines/k6/runtime/shared/db-normalization.js +0 -1
- package/dist/engines/k6/runtime/shared/error-body.d.ts +0 -3
- package/dist/engines/k6/runtime/shared/error-body.js +0 -1
- package/dist/engines/k6/runtime/shared/file-data.d.ts +0 -1
- package/dist/engines/k6/runtime/shared/file-data.js +0 -1
- package/dist/engines/k6/runtime/shared/fixture-engine.d.ts +0 -8
- package/dist/engines/k6/runtime/shared/fixture-engine.js +0 -2
- package/dist/engines/k6/runtime/shared/http-check-plan.d.ts +0 -29
- package/dist/engines/k6/runtime/shared/http-check-plan.js +0 -1
- package/dist/engines/k6/runtime/shared/http-parsing.d.ts +0 -10
- package/dist/engines/k6/runtime/shared/http-parsing.js +0 -3
- package/dist/engines/k6/runtime/shared/ordering.d.ts +0 -2
- package/dist/engines/k6/runtime/shared/ordering.js +0 -1
- package/dist/engines/k6/runtime/shared/properties.d.ts +0 -1
- package/dist/engines/k6/runtime/shared/properties.js +0 -1
- package/dist/engines/k6/runtime/suite.d.ts +0 -4
- package/dist/engines/k6/runtime/suite.js +0 -1
- package/dist/engines/k6/runtime/types.d.ts +0 -244
- package/dist/engines/k6/runtime/types.js +0 -1
- package/dist/engines/k6/runtime/xk6-sql-driver-postgres.d.ts +0 -7
- package/dist/engines/k6/runtime/xk6-sql-driver-postgres.js +0 -1
- package/dist/engines/managed-module-resolution-policy-input.d.ts +0 -8
- package/dist/engines/managed-module-resolution-policy.d.ts +0 -25
- package/dist/engines/managed-module-resolution.d.ts +0 -13
- package/dist/engines/manager.d.ts +0 -25
- package/dist/engines/node-vitest/adapter/adapter.d.ts +0 -16
- package/dist/engines/node-vitest/adapter/consumer-typescript-paths.d.ts +0 -17
- package/dist/engines/node-vitest/adapter/consumer-typescript-paths.js +0 -3
- package/dist/engines/node-vitest/adapter/evidence.d.ts +0 -33
- package/dist/engines/node-vitest/adapter/failure-details.d.ts +0 -3
- package/dist/engines/node-vitest/adapter/index.d.ts +0 -1
- package/dist/engines/node-vitest/adapter/reporter.d.ts +0 -7
- package/dist/engines/node-vitest/adapter/resolution.d.ts +0 -12
- package/dist/engines/node-vitest/adapter/resolution.js +0 -1
- package/dist/engines/node-vitest/adapter/workspace.d.ts +0 -19
- package/dist/engines/node-vitest/runtime/contract/index.d.ts +0 -64
- package/dist/engines/node-vitest/runtime/contract/index.js +0 -1
- package/dist/engines/node-vitest/runtime/data/http.d.ts +0 -4
- package/dist/engines/node-vitest/runtime/data/http.js +0 -1
- package/dist/engines/node-vitest/runtime/data/index.d.ts +0 -8
- package/dist/engines/node-vitest/runtime/data/primitives.d.ts +0 -1
- package/dist/engines/node-vitest/runtime/data/report.d.ts +0 -3
- package/dist/engines/node-vitest/runtime/data/runner.d.ts +0 -4
- package/dist/engines/node-vitest/runtime/data/runner.js +0 -1
- package/dist/engines/node-vitest/runtime/data/scenario.d.ts +0 -11
- package/dist/engines/node-vitest/runtime/data/types.d.ts +0 -384
- package/dist/engines/node-vitest/runtime/runtime-input.d.ts +0 -64
- package/dist/engines/playwright/adapter/adapter.d.ts +0 -18
- package/dist/engines/playwright/adapter/attachments.d.ts +0 -26
- package/dist/engines/playwright/adapter/config.d.ts +0 -45
- package/dist/engines/playwright/adapter/evidence-validation.d.ts +0 -9
- package/dist/engines/playwright/adapter/evidence.d.ts +0 -32
- package/dist/engines/playwright/adapter/failure-details.d.ts +0 -2
- package/dist/engines/playwright/adapter/index.d.ts +0 -3
- package/dist/engines/playwright/adapter/reporter.d.ts +0 -12
- package/dist/engines/playwright/runtime/config-file.d.ts +0 -2
- package/dist/engines/playwright/runtime/config.d.ts +0 -24
- package/dist/engines/playwright/runtime/index.d.ts +0 -4
- package/dist/engines/playwright/runtime/runtime-input.d.ts +0 -36
- package/dist/engines/playwright/runtime/sandbox.d.ts +0 -84
- package/dist/engines/runtime-input-file.d.ts +0 -27
- package/dist/environment/lifecycle-artifacts.d.ts +0 -7
- package/dist/environment/lifecycle-controller.d.ts +0 -60
- package/dist/environment/lifecycle.d.ts +0 -32
- package/dist/environment/maintenance.d.ts +0 -68
- package/dist/environment/planning-types.d.ts +0 -33
- package/dist/environment/ports.d.ts +0 -10
- package/dist/environment/ready-environment.d.ts +0 -16
- package/dist/environment/run-environment.d.ts +0 -39
- package/dist/environment/run-stopping.d.ts +0 -13
- package/dist/environment/runtime-contexts.d.ts +0 -37
- package/dist/environment/runtime-manager.d.ts +0 -87
- package/dist/environment/runtime-planning.d.ts +0 -16
- package/dist/environment/runtime-preparation.d.ts +0 -30
- package/dist/environment/runtime-service.d.ts +0 -12
- package/dist/environment/services.d.ts +0 -56
- package/dist/environment/state.d.ts +0 -15
- package/dist/environment/status-runtime.d.ts +0 -53
- package/dist/environment/template.d.ts +0 -164
- package/dist/evidence/artifact-config.d.ts +0 -14
- package/dist/evidence/artifact-validation.d.ts +0 -4
- package/dist/evidence/artifacts.d.ts +0 -75
- package/dist/evidence/bundles.d.ts +0 -27
- package/dist/evidence/ci-provenance.d.ts +0 -9
- package/dist/evidence/contracts.d.ts +0 -154
- package/dist/evidence/environment-record.d.ts +0 -22
- package/dist/evidence/file-evidence.d.ts +0 -23
- package/dist/evidence/finalization.d.ts +0 -9
- package/dist/evidence/index.d.ts +0 -8
- package/dist/evidence/logs.d.ts +0 -31
- package/dist/evidence/operation-timings.d.ts +0 -60
- package/dist/evidence/read-bundle.d.ts +0 -4
- package/dist/evidence/read-fields.d.ts +0 -21
- package/dist/evidence/read-provenance.d.ts +0 -2
- package/dist/evidence/read-redaction.d.ts +0 -2
- package/dist/evidence/read-retention.d.ts +0 -2
- package/dist/evidence/read-run.d.ts +0 -2
- package/dist/evidence/reading.d.ts +0 -28
- package/dist/evidence/reporting-types.d.ts +0 -349
- package/dist/evidence/reporting.d.ts +0 -3
- package/dist/evidence/secure-file-copy.d.ts +0 -24
- package/dist/evidence/setup-progress.d.ts +0 -63
- package/dist/evidence/step-output.d.ts +0 -16
- package/dist/evidence/storage-inventory.d.ts +0 -27
- package/dist/evidence/storage.d.ts +0 -25
- package/dist/evidence/timing.d.ts +0 -23
- package/dist/file.d.ts +0 -11
- package/dist/index.d.ts +0 -4
- package/dist/kernel/error-serialization.d.ts +0 -40
- package/dist/kernel/redaction.d.ts +0 -2
- package/dist/kernel/unknown-values.d.ts +0 -11
- package/dist/kernel/work-metrics.d.ts +0 -6
- package/dist/process/capture-output.d.ts +0 -7
- package/dist/process/command-shell.d.ts +0 -1
- package/dist/process/environment-overlay.d.ts +0 -17
- package/dist/process/environment.d.ts +0 -33
- package/dist/process/files/contained-path.d.ts +0 -8
- package/dist/process/files/directory-status.d.ts +0 -14
- package/dist/process/files/dotenv.d.ts +0 -2
- package/dist/process/files/file-snapshot.d.ts +0 -34
- package/dist/process/files/json-file.d.ts +0 -11
- package/dist/process/files/paths.d.ts +0 -3
- package/dist/process/files/product-dir.d.ts +0 -1
- package/dist/process/files/temp-dir.d.ts +0 -11
- package/dist/process/host/metadata.d.ts +0 -6
- package/dist/process/host/platform.d.ts +0 -57
- package/dist/process/host-command.d.ts +0 -4
- package/dist/process/host-inspection-command.d.ts +0 -13
- package/dist/process/host-process.d.ts +0 -19
- package/dist/process/index.d.ts +0 -9
- package/dist/process/lifecycle-fence.d.ts +0 -10
- package/dist/process/locks.d.ts +0 -28
- package/dist/process/process-contracts.d.ts +0 -78
- package/dist/process/process-group.d.ts +0 -12
- package/dist/process/process-identity.d.ts +0 -27
- package/dist/process/process-limits.d.ts +0 -6
- package/dist/process/process.d.ts +0 -12
- package/dist/process/readiness.d.ts +0 -43
- package/dist/process/recovery.d.ts +0 -3
- package/dist/process/runs/inspection.d.ts +0 -5
- package/dist/process/runs/manifest.d.ts +0 -86
- package/dist/process/runs/ownership.d.ts +0 -11
- package/dist/process/runs/product-state.d.ts +0 -2
- package/dist/process/runs/schema.d.ts +0 -3
- package/dist/process/runs/stop.d.ts +0 -19
- package/dist/process/runtime-socket.d.ts +0 -4
- package/dist/process/service-processes.d.ts +0 -13
- package/dist/process/shutdown.d.ts +0 -10
- package/dist/process/stoppable-settlement.d.ts +0 -26
- package/dist/process/url-redaction.d.ts +0 -1
- package/dist/process/windows-cli-owner.d.ts +0 -2
- package/dist/process/windows-native.d.ts +0 -12
- package/dist/process/windows-process-identity.d.ts +0 -4
- package/dist/repo/ci-environment.d.ts +0 -7
- package/dist/repo/fingerprint-policy.d.ts +0 -13
- package/dist/repo/git-path.d.ts +0 -2
- package/dist/repo/history.d.ts +0 -17
- package/dist/repo/managed-git.d.ts +0 -10
- package/dist/repo/metadata.d.ts +0 -3
- package/dist/repo/physical-tree.d.ts +0 -37
- package/dist/repo/publish-directory.d.ts +0 -20
- package/dist/repo/remote.d.ts +0 -6
- package/dist/repo/state.d.ts +0 -26
- package/dist/repo/tree-listing.d.ts +0 -10
- package/dist/steps/build-config.d.ts +0 -34
- package/dist/steps/configured-step-testkit-modules.d.ts +0 -19
- package/dist/steps/configured-steps.d.ts +0 -51
- package/dist/steps/environment.d.ts +0 -82
- package/dist/steps/index.d.ts +0 -2
- package/dist/steps/module-runner.d.ts +0 -1
- package/dist/steps/run.d.ts +0 -36
- package/dist/toolchains/archive.d.ts +0 -53
- package/dist/toolchains/esbuild.d.ts +0 -9
- package/dist/toolchains/host-node-support.d.ts +0 -3
- package/dist/toolchains/index.d.ts +0 -114
- package/dist/toolchains/managed-node-releases.d.ts +0 -28
- package/dist/toolchains/node-cache.d.ts +0 -20
- package/dist/toolchains/node-integrity.d.ts +0 -18
- package/dist/toolchains/node-provisioning.d.ts +0 -29
- package/dist/toolchains/semver.d.ts +0 -13
- package/dist/toolchains/shared-operation.d.ts +0 -11
- package/dist/toolchains/timeouts.d.ts +0 -1
- package/dist/toolchains/vitest/index.d.ts +0 -13
- package/dist/tracker/gitea.d.ts +0 -14
- package/dist/tracker/github.d.ts +0 -14
- package/dist/tracker/http.d.ts +0 -33
- package/dist/tracker/index.d.ts +0 -4
- package/dist/tracker/redaction.d.ts +0 -4
- package/dist/tracker/requests.d.ts +0 -17
- package/dist/tracker/responses.d.ts +0 -24
- package/dist/tracker/types.d.ts +0 -51
- package/docs/engine-architecture.md +0 -682
- /package/dist/engines/{k6/runtime/runtime-globals.js → api/profiles.js} +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{recordWork as l}from"../kernel/work-metrics.js";import o from"fs";import s from"path";import{createRequire as
|
|
2
|
-
`))}export async function appendSourceSchemaCacheToHash(e,r,t=null){if(!(r.testkit.database?.sourceSchema||null))return;const a=t?.cachePath||await getSourceSchemaCachePath(r),n=t?.active&&t.cacheKey?t.cacheKey:s.relative(getSourceSchemaRootDir(r),s.dirname(a));if(e.update(`source-schema-key:${n}`),e.update(`source-schema-cache:${s.relative(r.productDir,a)}`),!o.existsSync(a)){e.update(":missing");return}const i=o.statSync(a);e.update(`:${i.size.toString()}:${i.mtimeMs.toString()}`);const h=o.readFileSync(a);l("schema.cacheHashFilesRead"),l("schema.cacheHashBytesRead",h.length),e.update(h)}async function
|
|
3
|
-
`}function Re(e){const r=
|
|
1
|
+
import{recordWork as l}from"../kernel/work-metrics.js";import o from"fs";import s from"path";import{createRequire as z}from"node:module";import{collectRepoState as J,summarizeRepoStateForMetadata as K}from"../repo/state.js";import{findDatabasePlaceholders as V,resolveExecutionEnvValues as X}from"../steps/index.js";import{sourceSchemaEnvNames as F}from"./source-schema-env.js";import{dumpPostgresSchemaToFile as G,captureTemplateSnapshotText as Z,resolvePgDumpClientImage as Q,runTemplateStep as Y,sanitizeSnapshotText as ee}from"./template-steps.js";import{getSourceSchemaRefreshLockPath as re,withSourceSchemaRefreshLock as te}from"./source-refresh-lock.js";import{resolveSourceSchemaDumpUrl as ae}from"./source-url.js";import{makeTempDir as ce,removeTempDir as ne}from"../process/files/temp-dir.js";import{isNullableString as se,isUnknownRecord as f}from"../kernel/unknown-values.js";import{requireContainedTestkitStateDirectory as _,resolveContainedTestkitStateDirectory as D}from"../process/runs/product-state.js";const $=z(import.meta.url);let P;function ie(){if(P)return P;const e=$.resolve("diff/package.json"),t=JSON.parse(o.readFileSync(e,"utf8"))?.exports?.["."]?.import?.default;if(typeof t!="string"||!t.startsWith("./"))throw new Error("The diff package must declare a local ESM import entry");const c=s.dirname(e),a=s.resolve(c,t),n=s.relative(c,a);if(!n||n===".."||n.startsWith(`..${s.sep}`)||s.isAbsolute(n))throw new Error("The diff package ESM import entry must stay within its package directory");return P=$(a)}const M="db",U="source-schemas",b="source-schema.sql",g="source-schema.meta.json",oe="index.json",N=20,y=String;export function getSourceSchemaRootDir(e){return D(e.productDir,M,e.name,U)}export async function getSourceSchemaCachePath(e,r={}){return(await resolveSourceSchemaCacheLocation(e,r)).cachePath}export async function resolveSourceSchemaCacheLocation(e,r={}){const t=r.repoState||await J(e.productDir,{fingerprints:e.testkit?.fingerprints}),c=getSourceSchemaRootDir(e),a=D(e.productDir,M,e.name,U,...t.cacheKey.split("/").map(w));return{rootDir:c,cacheDir:a,cachePath:s.join(a,b),metadataPath:s.join(a,g),indexPath:s.join(c,oe),cacheKey:t.cacheKey,cacheKind:t.kind,repoState:t}}export async function resolveSourceSchemaState(e,r={}){const t=e.testkit.database?.sourceSchema||null;if(!t)return{active:!1};const c=await resolveSourceSchemaCacheLocation(e,r),a=c.cachePath,n=o.existsSync(a);n&&R(a);const i=r.env||process.env,h=F(e);Ee(e,h);const u=X(e,[...h,"CI"],i),m=h.find(W=>{const A=u[W];return typeof A=="string"&&A.trim().length>0})||null,S=m?u[m]:void 0,p=typeof S=="string"?S.trim():null;return t.kind==="env"||!!p||n?{active:!0,cachePath:a,metadataPath:c.metadataPath,indexPath:c.indexPath,rootDir:c.rootDir,cacheDir:c.cacheDir,cacheKey:c.cacheKey,cacheKind:c.cacheKind,repoState:c.repoState,envName:m,sourceUrl:p,sourceSchema:t,cacheExists:n,refreshed:!1,ci:u.CI==="true",unavailableMode:xe(t.unavailable,i)}:{active:!1,cachePath:a}}export async function prepareSourceSchemaCache(e,r={}){r.signal?.throwIfAborted();const t=await resolveSourceSchemaState(e,r);if(!t.active)return t;if(H(t)){if(pe(t))try{const a=await j(e,t,r),n={...t,refreshed:!0,cacheExists:!0,refreshInfo:a};return v(e,n,{refreshed:!0}),n}catch(a){r.signal?.throwIfAborted();const n=he(e,t,a,r);if(n)return n;throw a}return v(e,t),r.setupRegistry?.recordCached({config:e,stage:"source-schema",kind:"database-source-schema",summary:"source schema cache hit"}),t}if(t.cacheExists&&t.unavailableMode==="warn-cache")return v(e,t),r.setupRegistry?.recordCached({config:e,stage:"source-schema",kind:"database-source-schema",summary:"source unavailable; using cached source schema"}),t;const c=F(e).join(" or ");throw new Error(`Source schema database URL is unavailable for service "${e.name}". Set ${c}.`)}function he(e,r,t,c={}){if(r.unavailableMode!=="warn-cache")return null;const a=ue(e,r);if(!a)return null;const n={...r,...a,cacheExists:!0,refreshed:!1,refreshError:Re(t)};return c.setupRegistry?.recordCached({config:e,stage:"source-schema",kind:"database-source-schema",summary:`source unavailable; using cached source schema: ${s.relative(e.productDir,a.cachePath)}`}),n}function ue(e,r){const t=L(e,r,{cachePath:r.cachePath,metadataPath:r.metadataPath,cacheKey:r.cacheKey,cacheKind:r.cacheKind});if(t)return t;const c=O(r.indexPath);c.sort((a,n)=>Date.parse(n.lastUsedAt||n.refreshedAt||"0")-Date.parse(a.lastUsedAt||a.refreshedAt||"0"));for(const a of c){if(!a.cachePath)continue;const n=s.resolve(e.productDir,a.cachePath),i=L(e,r,{cachePath:n,metadataPath:s.join(s.dirname(n),g),cacheKey:a.cacheKey,cacheKind:a.kind||"unknown"});if(i)return i}return null}function L(e,r,t){const c=s.resolve(t.cachePath);if(s.basename(c)!==b)return null;const a=_(e.productDir,s.dirname(c),`Service "${e.name}" source schema cache directory`),n=s.join(a,b),i=s.resolve(r.rootDir);if(n!==i&&!n.startsWith(`${i}${s.sep}`)||!o.existsSync(n))return null;const h=o.lstatSync(n);if(h.isSymbolicLink()||!h.isFile())throw new Error(`Refusing unsafe source schema cache file at ${n}`);return{cachePath:n,metadataPath:s.join(a,g),cacheDir:a,cacheKey:t.cacheKey,cacheKind:t.cacheKind,indexPath:r.indexPath,rootDir:r.rootDir}}export async function forceRefreshSourceSchemaCache(e,r,t={}){const c=await resolveSourceSchemaState(e,t);if(!c.active||!H(c)){const i=r?.active?r.envName:null,h=r?.active&&r.sourceSchema.kind==="env"?r.sourceSchema.env:null,u=i||h||"source schema env";throw new Error(`Cannot refresh source schema for service "${e.name}" because ${u} is unavailable.`)}const a=await j(e,c,t),n={...c,refreshed:!0,cacheExists:!0,refreshInfo:a};return v(e,n,{refreshed:!0}),n}export async function applySourceSchemaCache(e,r,t,c={}){if(!t?.active)return!1;if(!o.existsSync(t.cachePath))throw new Error(`Missing source schema cache for service "${e.name}": ${t.cachePath}`);const a={kind:"sql-file",path:s.relative(e.productDir,t.cachePath).split(s.sep).join("/"),cwd:null,inputs:[]};return l("schema.sourceReplays"),await Y(e,"source-schema",a,0,r,c),!0}export async function verifyLocalSchemaMatchesSource(e,r,t,c={}){if(!t?.active)return{status:"disabled"};if(!t.sourceSchema.verify||c.skipSchemaSourceVerify)return c.setupRegistry?.recordCached({config:e,stage:"source-schema:verify",kind:"database-source-schema",summary:"source schema verification skipped"}),{status:"skipped"};we(e);const a=fe(t.cachePath);l("schema.verificationDumps");const n=await Z(e,r,{image:await c.resolveLocalSnapshotImage?.(),ownedContainer:c.ownedContainer||null,reporter:c.reporter||null,signal:c.signal});return l("schema.comparisons"),l("schema.bytesCompared",Buffer.byteLength(a)+Buffer.byteLength(n)),n===a?{status:"matched"}:{status:"mismatch",diagnostics:await Pe(e,t,a,n)}}export function createSourceSchemaMismatchError(e,r,t){const c=[`Local schema replay does not match source schema for service "${e.name}".`,`Source cache: ${s.relative(e.productDir,r.cachePath)}`];return t?.status==="mismatch"&&c.push(`Diff: ${s.relative(e.productDir,t.diagnostics.diffPath)}`),new Error(c.join(`
|
|
2
|
+
`))}export async function appendSourceSchemaCacheToHash(e,r,t=null){if(!(r.testkit.database?.sourceSchema||null))return;const a=t?.cachePath||await getSourceSchemaCachePath(r),n=t?.active&&t.cacheKey?t.cacheKey:s.relative(getSourceSchemaRootDir(r),s.dirname(a));if(e.update(`source-schema-key:${n}`),e.update(`source-schema-cache:${s.relative(r.productDir,a)}`),!o.existsSync(a)){e.update(":missing");return}const i=o.statSync(a);e.update(`:${i.size.toString()}:${i.mtimeMs.toString()}`);const h=o.readFileSync(a);l("schema.cacheHashFilesRead"),l("schema.cacheHashBytesRead",h.length),e.update(h)}async function j(e,r,t={}){const c=t.setupRegistry,a=c?.start({config:e,stage:"source-schema:refresh",kind:"database-source-schema",summary:`source schema refresh: ${s.relative(e.productDir,r.cachePath)}`});try{const n=await te(re(r.cachePath),async({waited:h,requestedAt:u})=>{const m=de(r,u);if(m)return{reusedExistingRefresh:!0,waitedForLock:h,metadata:m};const S=await me(e,r.sourceUrl,r.cachePath,{reporter:t.reporter||null,logRecord:a?._logRecord||null,env:t.env||process.env,signal:t.signal}),p=le(e,r,S);return ye(r.metadataPath,p),{reusedExistingRefresh:!1,waitedForLock:h,metadata:p}},{signal:t.signal}),i=a&&c?c.finish(a,{status:"passed",summary:`source schema refresh: ${s.relative(e.productDir,r.cachePath)}`}):null;return i&&t.reporter?.setupOperationFinished?.(i),n}catch(n){const i=a?c?.finish(a,{status:"failed",summary:`source schema refresh: ${s.relative(e.productDir,r.cachePath)}`,error:Ce(n)}):null;throw i&&t.reporter?.setupOperationFinished?.(i),n}}async function me(e,r,t,c={}){const a=ae(r);o.mkdirSync(s.dirname(t),{recursive:!0});const n=ce(".source-schema-",{parentDir:s.dirname(t)}),i=s.join(n,s.basename(t));try{const h=await Q(e,a.dumpUrl,{env:c.env||process.env,pgApplicationName:x(e.name),signal:c.signal});return l("schema.sourceDumps"),await G(e,i,a.dumpUrl,{...c,image:h,pgApplicationName:x(e.name)}),o.renameSync(i,t),{resolution:a,pgDump:{args:["--schema-only","--no-owner","--no-privileges"],applicationName:x(e.name),image:h}}}finally{ne(n)}}function le(e,r,t){return{refreshedAt:new Date().toISOString(),serviceName:e.name,envName:r.envName,cacheKey:r.cacheKey,cacheKind:r.cacheKind,cachePath:s.relative(e.productDir,r.cachePath),repo:K(r.repoState),sourceUrl:t.resolution.metadata,pgDump:t.pgDump}}function de(e,r){if(!o.existsSync(e.cachePath))return null;const t=k(e.metadataPath);if(!Fe(t))return null;const c=Date.parse(t.refreshedAt);return!Number.isFinite(c)||c<r?null:t}function x(e){return`testkit:schema-source:${e.replace(/[^a-zA-Z0-9._:-]+/g,"-").slice(0,24)||"service"}`}function fe(e){const r=o.readFileSync(e);return l("schema.cacheFilesRead"),l("schema.cacheBytesRead",r.length),ee(r.toString("utf8"))}function pe(e){if(!e.cacheExists)return!0;if(e.sourceSchema.refresh.mode==="auto")return e.ci;if(e.sourceSchema.refresh.mode==="ttl"){const r=C(e.metadataPath),t=r?Date.parse(r):0;return!Number.isFinite(t)||t<=0?!0:Date.now()-t>=e.sourceSchema.refresh.ttlSeconds*1e3}return!0}function v(e,r,t={}){if(!r?.active)return;const c=new Date().toISOString(),a=O(r.indexPath).filter(h=>h.cacheKey!==r.cacheKey),n=C(r.metadataPath);a.push({cacheKey:r.cacheKey,kind:r.cacheKind,commitSha:r.repoState.commitSha||null,branch:r.repoState.branch||null,detached:r.repoState.detached,dirty:r.repoState.dirty,dirtyFingerprint:r.repoState.dirtyFingerprint||null,contentFingerprint:r.repoState.contentFingerprint||null,remoteUrl:r.repoState.remoteUrl||null,repository:r.repoState.repository,cachePath:s.relative(e.productDir,r.cachePath),refreshedAt:t.refreshed?c:n,lastUsedAt:c});const i=Se(e,r,a);E(r.indexPath,{version:1,entries:i})}function Se(e,r,t){if(t.length<=N)return t;const c=[...t].sort((n,i)=>Date.parse(i.lastUsedAt||"0")-Date.parse(n.lastUsedAt||"0")),a=new Set(c.slice(0,N).map(n=>n.cacheKey));a.add(r.cacheKey);for(const n of t){if(a.has(n.cacheKey))continue;const i=n.cachePath?s.join(e.productDir,n.cachePath):null,h=i?s.resolve(i):null,u=s.resolve(r.rootDir);if(!i||!h||h!==u&&!h.startsWith(`${u}${s.sep}`))continue;const m=_(e.productDir,s.dirname(i),`Service "${e.name}" pruned source schema cache directory`);o.rmSync(m,{recursive:!0,force:!0})}return t.filter(n=>a.has(n.cacheKey))}function ye(e,r){E(e,r)}function E(e,r){o.mkdirSync(s.dirname(e),{recursive:!0}),R(e),o.writeFileSync(e,ke(r))}function k(e){if(!e||!o.existsSync(e))return null;R(e);try{return JSON.parse(o.readFileSync(e,"utf8"))}catch{return null}}function I(e){return D(e.productDir,"results","schema")}function R(e){if(!o.existsSync(e))return;const r=o.lstatSync(e);if(r.isSymbolicLink()||!r.isFile())throw new Error(`Refusing unsafe source schema state file at ${e}`)}function ve(e){return`${w(e.runtimeLabel||e.name)}__${w(e.name)}`}function we(e){const r=I(e);if(!o.existsSync(r))return;const t=w(e.name);for(const c of o.readdirSync(r))De(c,t)&&o.rmSync(s.join(r,c),{force:!0})}function De(e,r){for(const t of["__source-schema.sql","__local-replay-schema.sql","__schema.diff","__schema.meta.json"])if(e.endsWith(t))return e.slice(0,-t.length).endsWith(`__${r}`);return!1}async function Pe(e,r,t,c){const a=I(e);o.mkdirSync(a,{recursive:!0});const n=ve(e),i=s.join(a,`${n}__source-schema.sql`),h=s.join(a,`${n}__local-replay-schema.sql`),u=s.join(a,`${n}__schema.diff`),m=s.join(a,`${n}__schema.meta.json`);return o.writeFileSync(i,t),o.writeFileSync(h,c),o.writeFileSync(u,await ge(i,h)),E(m,be(e,r)),{sourceCachePath:r.cachePath,sourcePath:i,localPath:h,diffPath:u,metaPath:m}}function be(e,r){const t=C(r.metadataPath);return{version:1,createdAt:new Date().toISOString(),serviceName:e.name,runtimeLabel:e.runtimeLabel||e.name,sourceSchema:{envName:r.envName||null,cacheKey:r.cacheKey||null,cacheKind:r.cacheKind||null,cachePath:s.relative(e.productDir,r.cachePath),refreshedAt:t},repo:K(r.repoState)}}function ge(e,r){return new Promise(t=>{t(buildUnifiedDiffText(o.readFileSync(e,"utf8"),o.readFileSync(r,"utf8"),e,r))})}export function buildUnifiedDiffText(e,r,t="source",c="target"){if(e===r)return"";const{createTwoFilesPatch:a}=ie();return a(t,c,y(e),y(r),"","",{context:3})}function xe(e,r){return e==="fail"||e==="warn-cache"?e:r.CI==="true"?"fail":"warn-cache"}function Ee(e,r){const t={...e.testkit.serviceEnv,...e.testkit.local?.env};for(const c of r){const a=t[c];if(typeof a!="string")continue;const n=V(a).find(i=>(i.serviceName??e.name)===e.name);if(n)throw new Error(`Service "${e.name}" env ${c} uses ${n.placeholder}, which is the database the source schema verifies. Point it at another service's database or an external database URL.`)}}function w(e){return e.trim().toLowerCase().replace(/[^a-z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||"schema"}function O(e){const r=k(e);return!f(r)||!Array.isArray(r.entries)?[]:r.entries.filter(Ae)}function C(e){const r=k(e);return f(r)&&typeof r.refreshedAt=="string"?r.refreshedAt:null}function ke(e){return`${y(JSON.stringify(e,null,2))}
|
|
3
|
+
`}function Re(e){const r=T(e,"message");return!!r?r:y(e)}function Ce(e){const r=T(e,"message");return!!r?r:e}function T(e,r){if(!(e===null||typeof e!="object"&&typeof e!="function"))return Reflect.get(e,r)}function H(e){return!!e.sourceUrl}function Ae(e){return!f(e)||typeof e.cacheKey!="string"||e.cacheKey.length===0?!1:d(e.branch)&&d(e.cachePath)&&d(e.commitSha)&&d(e.contentFingerprint)&&B(e.detached)&&B(e.dirty)&&d(e.dirtyFingerprint)&&d(e.kind)&&d(e.lastUsedAt)&&d(e.refreshedAt)&&d(e.remoteUrl)&&Ke(e.repository)}function Ke(e){return e==null||f(e)&&typeof e.host=="string"&&typeof e.owner=="string"&&typeof e.name=="string"}function Fe(e){return f(e)&&typeof e.refreshedAt=="string"&&(e.sourceUrl===void 0||_e(e.sourceUrl))}function _e(e){return f(e)&&typeof e.originalHost=="string"&&q(e.originalClassification)&&typeof e.resolvedHost=="string"&&q(e.resolvedClassification)&&typeof e.rewritten=="boolean"}function q(e){return e==="neon-pooler"||e==="neon-direct"||e==="unsupported-pooler"||e==="unknown-direct"}function d(e){return e===void 0||se(e)}function B(e){return e===void 0||typeof e=="boolean"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function sourceSchemaEnvNames(e){const n=e.testkit.database?.sourceSchema;return n?.kind==="env"?[n.env]:a(e.name)}export function sourceSchemaCredentialEnvNames(e){return[...new Set([...a(e.name),...sourceSchemaEnvNames(e)])]}function a(e){return[`TESTKIT_${e.toUpperCase().replace(/[^A-Z0-9]+/g,"_")}_SCHEMA_SOURCE_DATABASE_URL`,"TESTKIT_SCHEMA_SOURCE_DATABASE_URL"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import m from"fs";import e from"path";import{buildProductIdentity as
|
|
1
|
+
import m from"fs";import e from"path";import{buildProductIdentity as a}from"./docker.js";const p=String;export function writeLocalInfraState(o,t){const n=a(e.resolve(o,"..","..",".."));writeStateValue(e.join(o,"database_backend"),""),writeStateValue(e.join(o,"container_name"),t.containerName),writeStateValue(e.join(o,"container_id"),t.containerId),t.volumeName&&writeStateValue(e.join(o,"volume_name"),t.volumeName),t.volumeMountPath&&writeStateValue(e.join(o,"volume_mount_path"),t.volumeMountPath),writeStateValue(e.join(o,"ownership_product_id"),n.id),writeStateValue(e.join(o,"image"),t.image),writeStateValue(e.join(o,"user"),t.user),writeStateValue(e.join(o,"password"),t.password),writeStateValue(e.join(o,"max_connections"),String(t.maxConnections)),writeStateValue(e.join(o,"host"),t.host),writeStateValue(e.join(o,"port"),String(t.port))}export function writeCacheState(o,t,n,u){writeStateValue(e.join(o,"database_backend"),""),writeStateValue(e.join(o,"template_database_name"),n),writeStateValue(e.join(o,"template_fingerprint"),u),writeStateValue(e.join(o,"container_name"),t.containerName),t.volumeName&&writeStateValue(e.join(o,"volume_name"),t.volumeName),t.volumeMountPath&&writeStateValue(e.join(o,"volume_mount_path"),t.volumeMountPath)}export function beginTemplateCacheRebuild(o,t){m.rmSync(e.join(o,"template_fingerprint"),{force:!0}),writeStateValue(e.join(o,"template_database_name"),t)}export function writeStateValue(o,t){m.writeFileSync(o,p(t??""),{mode:384}),m.chmodSync(o,384)}
|
package/dist/database/state.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import f from"fs";import o from"path";import{resolveContainedTestkitStateDirectory as u}from"../process/runs/product-state.js";const k=new Set(["_bundles","_config","_dbcache","_execution","_graphs","_infra","_locks","_runs","_template-steps","_toolchains","_typecheck","engines","history","lint","results"]);export function getLocalInfraDir(t){return u(t,"_infra","local-postgres")}export function getLocalLocksDir(t){return u(t,"_locks","local-postgres")}export function getLocalServiceCacheDir(t,e){return u(t,"_dbcache",e)}export function listOwnedDatabaseStateDirs(t){const e=u(t),n=[],r=getLocalInfraDir(t);f.existsSync(r)&&n.push({dir:r,kind:"infra"});const d=o.join(e,"_dbcache");for(const i of l(d))n.push({dir:i,kind:"cache"});const a=o.join(e,"_graphs");for(const i of l(a))for(const c of l(o.join(i,"runtimes")))for(const _ of l(o.join(c,"services")))n.push({dir:_,kind:"runtime"});for(const i of p(e)){if(k.has(i.name)||!i.isDirectory())continue;const c=o.join(e,i.name);h(o.join(c,"database_backend"))&&n.push({dir:c,kind:"legacy"})}return n}export function hasRemainingLocalArtifacts(t){return listOwnedDatabaseStateDirs(t).map(({dir:e,kind:n})=>{const r=h(o.join(e,"database_backend"));return n!=="infra"&&(n==="cache"||r)}).some(Boolean)}export function readOwnedStateValues(t,e){const n=new Set;for(const{dir:r}of listOwnedDatabaseStateDirs(t))for(const d of e){const a=readStateValue(o.join(r,d));a&&n.add(a)}return n}function l(t){return p(t).flatMap(e=>{const n=o.join(t,e.name);if(e.isSymbolicLink())throw s(n,"symlink");if(!e.isDirectory()&&!e.isFile())throw s(n,"special node");return e.isDirectory()?[n]:[]})}function p(t){const e=m(t);if(!e)return[];if(!e.isDirectory())throw s(t,"non-directory node");return f.readdirSync(t,{withFileTypes:!0}).sort((n,r)=>n.name.localeCompare(r.name))}function h(t){const e=m(t);if(e&&!e.isFile())throw s(t,"non-file node");return!!e}function m(t){const e=f.lstatSync(t,{throwIfNoEntry:!1});if(e?.isSymbolicLink())throw s(t,"symlink");return e}export function readStateValue(t){return h(t)?f.readFileSync(t,"utf8").trim():null}function s(t,e){return new Error(`Refusing unsafe Testkit database state ${e} at ${t}`)}
|
package/dist/database/steps.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import O from"node:fs";import U from"node:path";import{runDockerPsql as P}from"./postgres/index.js";import{isUnknownRecord as
|
|
1
|
+
import O from"node:fs";import U from"node:path";import{runDockerPsql as P}from"./postgres/index.js";import{isUnknownRecord as S}from"../kernel/unknown-values.js";import{requireObjectRecord as R}from"../evidence/read-fields.js";const w=String;export async function verifySeed(r={}){const e=f(r),t=l(e.table,"verifySeed.args.table"),n=j(e.where),s=z(e.minRows??1,"verifySeed.args.minRows"),o=g(r),u=`select count(*)::int from ${t}${n?` where ${n}`:""}`,i=Number(await q(o,u,r));if(!Number.isInteger(i)||i<s)throw new Error(`Expected at least ${String(s)} row(s) in ${t}, found ${String(i||0)}`)}export async function verifyRows(r={}){const e=f(r),t=Array.isArray(e.checks)?e.checks:[e],n=g(r),s=[];for(const[o,u]of t.entries()){const i=`verifyRows.args.checks[${String(o)}]`,a=S(u)?u:{},m=l(a.table,`${i}.table`),d=j(a.where),c=z(a.minRows??1,`${i}.minRows`),$=a.severity==="warn"?"warn":"error",A=`select count(*)::int from ${m}${d?` where ${d}`:""}`,y=Number(await q(n,A,r));if(!Number.isInteger(y)||y<c){const N=`Expected at least ${String(c)} row(s) in ${m}, found ${String(y||0)}`;$==="warn"?J(r,{code:"database_verify_rows_min_rows",message:N,table:m,where:d||null,expectedMinRows:c,actualRows:Number.isInteger(y)?y:0}):s.push(N)}}if(s.length>0)throw new Error(`Database row verification failed:
|
|
2
2
|
${s.map(o=>`- ${o}`).join(`
|
|
3
|
-
`)}`)}export async function queryScalar(r={}){const e=f(r),t=g(r),n=
|
|
4
|
-
`)),Z(r)&&console.warn(t.message)}function Z(r){const e=r.emitWarningsToStderr;return e==null?!0:!["0","false","no","off"].includes(
|
|
3
|
+
`)}`)}export async function queryScalar(r={}){const e=f(r),t=g(r),n=v(e.statement??e.query,"queryScalar.args.statement");return q(t,n,r)}export async function runSql(r={}){const e=f(r),t=L(e.statements??e.statement,"runSql.args.statements"),n=g(r);for(const s of t){const o=await b(n,s,r);o.stdout&&process.stdout.write(o.stdout),o.stderr&&process.stderr.write(o.stderr)}}export async function seedRows(r={}){const e=f(r),t=l(e.table,"seedRows.args.table"),n=D(e.rows,"seedRows.args.rows"),s=g(r);if(e.truncate===!0&&await b(s,`truncate table ${t}`,r),n.length===0)return;const o=I(e.columns,n),u=o.map(a=>l(a,`seedRows.args.columns.${a}`)),i=n.map(a=>`(${o.map(m=>E(a[m],r)).join(", ")})`);await b(s,`insert into ${t} (${u.join(", ")}) values ${i.join(", ")}`,r)}export async function materializePostgresBinding(r={}){const e=f(r),t=l(e.table,"materializePostgresBinding.args.table"),n=l(e.keyColumn||"slug","materializePostgresBinding.args.keyColumn"),s=T(e.key,"materializePostgresBinding.args.key"),o=R(e.values,"materializePostgresBinding.args.values"),u=g(r),i=Object.keys(o);if(i.length===0)throw new Error("materializePostgresBinding.args.values must contain at least one column");const a=i.map($=>`${l($,`materializePostgresBinding.args.values.${$}`)} = ${E(o[$],r)}`),m=`with updated as (update ${t} set ${a.join(", ")} where ${n} = ${h(s)} returning 1) select count(*)::int from updated`,d=await b(u,m,r,{scalar:!0}),c=Number((d.stdout||"").trim()||"0");if(c!==1)throw new Error(`Expected to materialize 1 ${t} row for ${n}=${String(s)}, updated ${String(c||0)}`)}export async function updateRows(r={}){const e=f(r),t=l(e.table,"updateRows.args.table"),n=B(e.where,"updateRows.args.where"),s=R(e.values??e.set,"updateRows.args.values"),o=g(r),u=e.expectRows==null?null:z(e.expectRows,"updateRows.args.expectRows"),i=Object.keys(s).map(c=>`${l(c,`updateRows.args.values.${c}`)} = ${E(s[c],r)}`);if(i.length===0)throw new Error("updateRows.args.values must contain at least one column");const a=`with updated as (update ${t} set ${i.join(", ")} where ${W(n,r)} returning 1) select count(*)::int from updated`,m=await b(o,a,r,{scalar:!0}),d=Number((m.stdout||"").trim()||"0");if(u!==null&&d!==u)throw new Error(`Expected to update ${String(u)} ${t} row(s), updated ${String(d||0)}`)}function f(r){return S(r.args)?r.args:{}}function g(r){const e=(r.databaseUrl||r.env?.DATABASE_URL||"").trim();if(!e)throw new Error("Database template step requires DATABASE_URL");return e}async function q(r,e,t){return((await b(r,e,t,{scalar:!0})).stdout||"").trim()}async function b(r,e,t,n={}){const s={args:[r,"-v","ON_ERROR_STOP=1","-X",...n.scalar?["-q","-t","-A"]:[],"-c",e],cwd:t.cwd||t.productDir||process.cwd(),env:t.env||process.env,databaseUrl:r,ownedContainer:t.ownedContainer||null},o=await P(s);if(o.exitCode!==0)throw new Error(o.stderr||`psql failed with exit code ${String(o.exitCode)}`);return o}function L(r,e){const t=Array.isArray(r)?r:r==null?[]:[r];if(t.length===0)throw new Error(`${e} must contain at least one SQL statement`);return t.map((n,s)=>v(n,`${e}[${String(s)}]`))}function v(r,e){const t=w(r||"").trim();if(!t||/;\s*\S/.test(t))throw new Error(`${e} must be one SQL statement`);return t}function D(r,e){if(!Array.isArray(r))throw new Error(`${e} must be an array`);return r.map((n,s)=>R(n,`${e}[${String(s)}]`))}function I(r,e){if(r!=null){if(!Array.isArray(r)||r.length===0)throw new Error("seedRows.args.columns must be a non-empty array");return r.map(n=>String(n))}return[...new Set(e.flatMap(t=>Object.keys(t)))].sort((t,n)=>t.localeCompare(n))}function B(r,e){const t=R(r,e);if(Object.keys(t).length===0)throw new Error(`${e} must contain at least one column`);return t}function W(r,e){return Object.entries(r).map(([t,n])=>`${l(t,`where.${t}`)} = ${E(n,e)}`).join(" and ")}function l(r,e){const t=w(r||"").trim();if(!/^[A-Za-z_][A-Za-z0-9_]*(?:\.[A-Za-z_][A-Za-z0-9_]*)?$/.test(t))throw new Error(`${e} must be a SQL identifier or schema-qualified identifier`);return t}function j(r){if(r==null||r==="")return"";const e=w(r).trim();if(!e||/;|--|\/\*/.test(e))throw new Error("verifySeed.args.where must be a single SQL predicate without comments or semicolons");return e}function z(r,e){const t=Number(r);if(!Number.isInteger(t)||t<0)throw new Error(`${e} must be a non-negative integer`);return t}function T(r,e){if(r==null||w(r).length===0)throw new Error(`${e} is required`);return r}function h(r){return r===null?"null":typeof r=="number"&&Number.isFinite(r)?String(r):typeof r=="boolean"?r?"true":"false":`'${w(r).replaceAll("'","''")}'`}function E(r,e){if(!_(r))return h(r);switch(r.kind){case"now":return"now()";case"env":return h(p(e.env||process.env,r.name));case"json":return`${h(JSON.stringify(k(r.value,e)))}::jsonb`;case"postgres-connection-from-env":return`${h(JSON.stringify(C(e.env||process.env,r.prefix)))}::jsonb`;default:throw new Error(`Unsupported database value descriptor "${r.kind}"`)}}function _(r){return S(r)&&typeof r.kind=="string"}function k(r,e){if(Array.isArray(r))return r.map(n=>k(n,e));if(!S(r))return r;if(_(r)){if(r.kind==="env")return p(e.env||process.env,r.name);if(r.kind==="postgres-connection-from-env")return C(e.env||process.env,r.prefix)}return Object.fromEntries(Object.entries(r).map(([t,n])=>[t,k(n,e)]))}function C(r,e){const t=w(e||"").trim();if(!t)throw new Error("postgresConnectionFromEnv requires a non-empty prefix");return{host:p(r,`${t}_HOST`),port:F(r,`${t}_PORT`),database:p(r,`${t}_NAME`),username:p(r,`${t}_USER`),password:p(r,`${t}_PASSWORD`),ssl:Q(r[`${t}_SSL`])}}function p(r,e){const t=String(e),n=r?.[t];if(n==null||n.trim().length===0)throw new Error(`${t} environment variable is required`);return n.trim()}function F(r,e){const t=Number.parseInt(p(r,e),10);if(!Number.isInteger(t)||t<=0)throw new Error(`${e} must be a positive integer`);return t}function Q(r){return r?["1","true","yes","on"].includes(r.trim().toLowerCase()):!1}function J(r,e){const t={severity:"warn",source:"database.verifyRows",serviceName:r.serviceName||null,runtimeId:r.runtimeId||null,timestamp:new Date().toISOString(),...e};typeof r.recordWarning=="function"&&r.recordWarning(t);const n=r.warningFile;n&&(O.mkdirSync(U.dirname(n),{recursive:!0}),O.appendFileSync(n,JSON.stringify(t)+`
|
|
4
|
+
`)),Z(r)&&console.warn(t.message)}function Z(r){const e=r.emitWarningsToStderr;return e==null?!0:!["0","false","no","off"].includes(w(e).trim().toLowerCase())}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const DEFAULT_FILE_TIMEOUT_SECONDS=60,FILE_TIMEOUT_INTERVAL_SECONDS=.25,FILE_TIMEOUT_COOPERATIVE_ERROR_RESERVE_MAX_MS=2e3,FILE_TIMEOUT_COOPERATIVE_ERROR_RESERVE_MIN_MS=250,FILE_TIMEOUT_COOPERATIVE_ERROR_RESERVE_RATIO=.2,
|
|
1
|
+
import{isNonNullObject as i}from"../kernel/unknown-values.js";export const DEFAULT_FILE_TIMEOUT_SECONDS=60,FILE_TIMEOUT_INTERVAL_SECONDS=.25,FILE_TIMEOUT_COOPERATIVE_ERROR_RESERVE_MAX_MS=2e3,FILE_TIMEOUT_COOPERATIVE_ERROR_RESERVE_MIN_MS=250,FILE_TIMEOUT_COOPERATIVE_ERROR_RESERVE_RATIO=.2,INTERNAL_FILE_TIMEOUT_SECONDS_ENV="TESTKIT_INTERNAL_FILE_TIMEOUT_SECONDS",INTERNAL_FILE_DEADLINE_MS_ENV="TESTKIT_INTERNAL_FILE_DEADLINE_MS";export function parseFileTimeoutOption(e){return o(e,"--file-timeout-seconds")}export function normalizeFileTimeoutSeconds(e,t="execution.fileTimeoutSeconds"){return normalizePositiveInteger(e,t)}export function normalizeWaitIntervalSeconds(e){if(e==null)return FILE_TIMEOUT_INTERVAL_SECONDS;const t=Number(e);if(!Number.isFinite(t)||t<=0)throw new Error("waitFor intervalSeconds must be a positive number.");return t}export function readFileTimeoutBudget(e){if(!i(e))throw new Error("Runtime file timeout budget is missing.");return{fileTimeoutSeconds:normalizeFileTimeoutSeconds(e[INTERNAL_FILE_TIMEOUT_SECONDS_ENV],INTERNAL_FILE_TIMEOUT_SECONDS_ENV),deadlineMs:n(e[INTERNAL_FILE_DEADLINE_MS_ENV],INTERNAL_FILE_DEADLINE_MS_ENV)}}export function remainingFileTimeoutMs(e,t=Date.now()){return Math.max(0,e.deadlineMs-t)}export function remainingFileTimeoutSeconds(e,t=Date.now()){return remainingFileTimeoutMs(e,t)/1e3}export function remainingCooperativeFileTimeoutMs(e,t=Date.now()){return Math.max(0,remainingFileTimeoutMs(e,t)-cooperativeFileTimeoutErrorReserveMs(e.fileTimeoutSeconds))}export function cooperativeFileTimeoutErrorReserveMs(e){return Math.min(FILE_TIMEOUT_COOPERATIVE_ERROR_RESERVE_MAX_MS,Math.max(FILE_TIMEOUT_COOPERATIVE_ERROR_RESERVE_MIN_MS,Math.floor(e*1e3*FILE_TIMEOUT_COOPERATIVE_ERROR_RESERVE_RATIO)))}export function formatWaitForTimeoutError(e,t){return`Timed out waiting for ${String(e||"condition").trim()||"condition"} before the ${String(t)}s test file timeout`}function o(e,t){const r=Number.parseInt(String(e),10);if(!Number.isInteger(r)||r<=0)throw new Error(`Invalid ${t} value "${String(e)}". Expected a positive integer.`);return r}export function normalizePositiveInteger(e,t){const r=Number(e);if(!Number.isInteger(r)||r<=0)throw new Error(`${t} must be a positive integer.`);return r}function n(e,t){const r=Number(e);if(!Number.isInteger(r)||r<=0)throw new Error(`${t} must be a positive integer timestamp.`);return r}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ENGINE_IDS=Object.freeze(["
|
|
1
|
+
export const ENGINE_IDS=Object.freeze(["node-vitest","playwright"]),PUBLIC_TEST_TYPES=Object.freeze(["ui"]),RUNNER_PROFILE_IDS=Object.freeze(["node-vitest","playwright-ui"]);const n=new Set(ENGINE_IDS),r=new Set(PUBLIC_TEST_TYPES),o=new Set(RUNNER_PROFILE_IDS);export function isEngineId(t){return typeof t=="string"&&n.has(t)}export function isTypedTestFile(t){return PUBLIC_TEST_TYPES.some(e=>t.endsWith(`.${e}.testkit.ts`))}export function isPublicTestType(t){return typeof t=="string"&&r.has(t)}export function isRunnerProfileId(t){return typeof t=="string"&&o.has(t)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const RELEASE_NOTES_FILE="node_modules/@gfdelarue/testkit/docs/release-notes.md",RETIRED_TEST_TYPES=Object.freeze([{testType:"contract",release:"0.6.0",migration:"Remove the contract test type"},{testType:"data",release:"0.6.0",migration:"Remove the data test type"}]);export function rejectRetiredTestType(e,n,t=RETIRED_TEST_TYPES){const r=t.find(o=>o.testType===e);if(r!==void 0)throw new Error(`${n}: Testkit ${r.release} removed the ${r.testType} test type. ${migrationText(r.migration)}.`)}export function rejectRetiredTestFile(e,n=RETIRED_TEST_TYPES){const t=/\.([^./]+)\.testkit\.ts$/u.exec(e)?.[1];t!==void 0&&rejectRetiredTestType(t,e,n)}export function migrationText(e){return`Migrate with "${e}" in ${RELEASE_NOTES_FILE}`}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const DEFAULT_RUNTIME_ISOLATION_POLICY="shared",RUNTIME_ISOLATION_POLICIES=Object.freeze(["shared","resetBefore"
|
|
1
|
+
export const DEFAULT_RUNTIME_ISOLATION_POLICY="shared",RUNTIME_ISOLATION_POLICIES=Object.freeze(["shared","resetBefore"]);const s=new Set(RUNTIME_ISOLATION_POLICIES),r={resetAfter:'is "resetAfter", which was removed. Set "resetBefore" on the file that needs a clean database instead.',exclusive:'is "exclusive", which was removed. Use "shared" and have each test create and filter by its own rows, or "resetBefore" for a test that changes a whole table.'};export function isRuntimeIsolationPolicy(e){return typeof e=="string"&&s.has(e)}export function normalizeRuntimeIsolationPolicy(e,t){if(isRuntimeIsolationPolicy(e))return e;throw typeof e=="string"&&Object.hasOwn(r,e)?new Error(`${t} ${r[e]}`):new Error(`${t} must be one of ${RUNTIME_ISOLATION_POLICIES.map(o=>JSON.stringify(o)).join(", ")}`)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{RUN_TYPE_ORDER as
|
|
1
|
+
import{RUN_TYPE_ORDER as f,RUN_TYPES as y,isPublicTestType as T,publicTestTypeListText as l}from"./test-types.js";import"./identifiers.js";import{RETIRED_TEST_TYPES as a,rejectRetiredTestType as d}from"./retired-test-types.js";const m=String;export function normalizeTypeValues(e=[],n=a){const t=[];for(const p of e)if(p!=null)for(const i of m(p).split(",")){const o=i.trim();if(!o)continue;const c=o;if(d(c,`Type "${o}"`,n),!y.has(c))throw new Error(`Unknown type "${o}". Expected one of: ${l({includeAll:!0})}.`);t.push(c)}if(t.length===0)return["all"];const r=[...new Set(t)];if(r.includes("all")&&r.length>1)throw new Error('"--type all" cannot be combined with other types.');return r.sort((p,i)=>f.indexOf(p)-f.indexOf(i))}export function isAllTypeSelection(e=[]){return e.length===0||e.length===1&&e[0]==="all"}export function parseSuiteSelectors(e=[],n=a){const t=[];for(const r of e)if(r!=null)for(const p of m(r).split(",")){const i=p.trim();if(!i)continue;const o=i.indexOf(":");if(o<0){t.push({kind:"plain",name:i,raw:i});continue}const c=i.slice(0,o),u=i.slice(o+1).trim(),s=c.trim();if(d(s,`Suite selector "${i}"`,n),!T(s))throw new Error(`Unknown suite selector type "${c}". Expected one of: ${l()}.`);if(!u)throw new Error(`Invalid suite selector "${i}". Expected "<type>:<suite-name>".`);t.push({kind:"typed",testType:s,name:u,raw:`${s}:${u}`})}return t}export function suiteKey(e){return`${e.testType??""}:${e.name}`}export function matchesSelectedTypes(e,n){return isAllTypeSelection(n)||n.includes(e??"plain")}export function matchesSuiteSelectors(e,n,t=[]){return!t||t.length===0?!0:t.some(r=>(r.kind==="plain"||r.testType===e)&&r.name===n)}export function parseTypeOption(e,n=null){const t=[];if(n&&t.push(n),Array.isArray(e)){const r=e;t.push(...r)}else e&&t.push(e);return normalizeTypeValues(t)}export function parseSuiteOption(e){const n=Array.isArray(e)?e:e?[e]:[];return parseSuiteSelectors(n)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PUBLIC_TEST_TYPES as e,isPublicTestType as
|
|
1
|
+
import{PUBLIC_TEST_TYPES as e,isPublicTestType as i}from"./identifiers.js";export const TEST_TYPE_ORDER=e;const T=[...e,"plain","all"];export const RUN_TYPE_ORDER=T,RUN_TYPES=new Set(RUN_TYPE_ORDER);const s={ui:"UI"},o=String;export function isPublicTestType(t){return i(n(t))}export function isRunType(t){return RUN_TYPES.has(n(t))}export function formatPublicTestType(t){const r=n(t);return isPublicTestType(r)?s[r]:o(t||"")}export function publicTestTypeList({includeAll:t=!1}={}){return t?[...T]:[...e]}export function publicTestTypeListText(t={}){return publicTestTypeList(t).join(", ")}function n(t){return o(t||"").trim()}export function formatTestTypeLabel(t){return formatPublicTestType(t)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{requireNativeEvidenceJson as N}from"./native-report.js";import E from"node:crypto";import{constants as O}from"node:fs";import d from"node:fs/promises";import F from"node:path";import{readOnlyNoFollowOpenFlags as R,sameFileSnapshot as U,samePathAndHandleFileSnapshot as C}from"../../process/files/file-snapshot.js";const z=64*1024;export const evidenceFileAccess={lstat:async t=>d.lstat(t,{bigint:!0}),openReadOnly:async t=>d.open(t,R(process.platform,O)),platform:process.platform,readChunk:async(t,n)=>(await t.read(n,0,n.byteLength,null)).bytesRead,statHandle:async t=>t.stat({bigint:!0})};export function stableEvidenceFromBuffer(t){return{contents:t,sha256:E.createHash("sha256").update(t).digest("hex"),sizeBytes:t.byteLength}}export async function readStableJsonFile(t,n,e,r){let i;try{i=await readStableEvidenceFile(t,n,e,r)}catch(o){if(
|
|
1
|
+
import{requireNativeEvidenceJson as N}from"./native-report.js";import E from"node:crypto";import{constants as O}from"node:fs";import d from"node:fs/promises";import F from"node:path";import{readOnlyNoFollowOpenFlags as R,sameFileSnapshot as U,samePathAndHandleFileSnapshot as C}from"../../process/files/file-snapshot.js";const z=64*1024;export const evidenceFileAccess={lstat:async t=>d.lstat(t,{bigint:!0}),openReadOnly:async t=>d.open(t,R(process.platform,O)),platform:process.platform,readChunk:async(t,n)=>(await t.read(n,0,n.byteLength,null)).bytesRead,statHandle:async t=>t.stat({bigint:!0})};export function stableEvidenceFromBuffer(t){return{contents:t,sha256:E.createHash("sha256").update(t).digest("hex"),sizeBytes:t.byteLength}}export async function readStableJsonFile(t,n,e,r){let i;try{i=await readStableEvidenceFile(t,n,e,r)}catch(o){if(isMissingFileError(o))return{file:null,value:null};throw o}let a;try{a=JSON.parse(i.contents.toString("utf8"))}catch(o){throw new Error(`${e} is not valid JSON`,{cause:o})}return N(a,e),{file:i,value:a}}export async function readStableEvidenceFile(t,n,e,r,i){const a=i??await r.lstat(t);u(a,n,e);const o=await r.openReadOnly(t);try{const w=await r.statHandle(o);u(w,n,e),m(a,w,e,r.platform);const p=[],l=E.createHash("sha256");let h=0;const s=Buffer.allocUnsafe(z);for(;;){const f=await r.readChunk(o,s);if(I(f,s.byteLength,e),f===0)break;if(h+=f,h>n)throw new Error(`${e} exceeds its ${n.toString()} byte limit`);const g=Buffer.from(s.subarray(0,f));p.push(g),l.update(g)}const c=await r.statHandle(o),y=await r.lstat(t);if(u(c,n,e),u(y,n,e),S(w,c,e),S(a,y,e),m(y,c,e,r.platform),BigInt(h)!==w.size)throw new Error(`${e} changed while it was read`);return{contents:Buffer.concat(p,h),sha256:l.digest("hex"),sizeBytes:h}}finally{await o.close()}}export async function writeOwnedEvidenceFile(t,n,e){const r=F.join(t,n),i=F.join(t,`.${n}.${E.randomUUID()}.tmp`);let a=null;try{return a=await d.open(i,"wx",384),await a.writeFile(e),await a.sync(),await a.close(),a=null,await d.rename(i,r),process.platform!=="win32"&&await d.chmod(r,384),r}catch(o){throw a!==null&&await a.close().catch(()=>{}),await d.rm(i,{force:!0}).catch(()=>{}),o}}export async function snapshotStableEvidenceFile(t,n,e,r,i,a,o){const w=await r.lstat(t);u(w,n,e),S(i,w,e);const p=await r.openReadOnly(t),l=F.join(a,o),h=F.join(a,`.${o}.${E.randomUUID()}.tmp`);let s=null;try{const c=await r.statHandle(p);u(c,n,e),m(w,c,e,r.platform),s=await d.open(h,"wx",384);const y=E.createHash("sha256");let f=0;const g=Buffer.allocUnsafe(z);for(;;){const $=await r.readChunk(p,g);if(I($,g.byteLength,e),$===0)break;if(f+=$,f>n)throw new Error(`${e} exceeds its ${n.toString()} byte limit`);const k=g.subarray(0,$);await s.write(k),y.update(k)}const v=await r.statHandle(p),H=await r.lstat(t);if(u(v,n,e),u(H,n,e),S(c,v,e),S(w,H,e),m(H,v,e,r.platform),BigInt(f)!==c.size)throw new Error(`${e} changed while it was read`);return await s.sync(),await s.close(),s=null,await d.rename(h,l),process.platform!=="win32"&&await d.chmod(l,384),{filePath:l,identity:{sha256:y.digest("hex"),sizeBytes:f}}}catch(c){throw s!==null&&await s.close().catch(()=>{}),await d.rm(h,{force:!0}).catch(()=>{}),c}finally{await p.close()}}export function evidenceArtifact(t,n,e,r,i,a){return{contentType:e,kind:r,metadata:{sha256:n.sha256,sizeBytes:n.sizeBytes},name:i,path:t,summary:a}}function I(t,n,e){if(!Number.isSafeInteger(t)||t<0||t>n)throw new Error(`${e} returned an invalid read length`)}function u(t,n,e){if(!t.isFile()||t.isSymbolicLink())throw new Error(`${e} must be a regular non-symbolic-link file`);if(t.size<0n||t.size>BigInt(n))throw new Error(`${e} exceeds its ${n.toString()} byte limit`)}function S(t,n,e){if(!U(t,n))throw new Error(`${e} changed while it was read`)}function m(t,n,e,r){if(!C(t,n,r))throw new Error(`${e} changed while it was read`)}export function isMissingFileError(t){return t instanceof Error&&"code"in t&&t.code==="ENOENT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isEngineTaskDeadlineExceededReason as d}from"../api/index.js";import"../../domain/test-outcomes.js";import{toError as l}from"../../kernel/error-serialization.js";export async function executeEngineTasks(e,t,n,i,
|
|
1
|
+
import{isEngineTaskDeadlineExceededReason as d}from"../api/index.js";import"../../domain/test-outcomes.js";import{toError as l}from"../../kernel/error-serialization.js";export async function executeEngineTasks(e,t,n,i,a){const r=[];for(const o of t){e.observer?.taskStarted(o.task);const s=Date.now(),c=taskBeforeStartOutcome(o.task,e.signal,s,n);c!==null?r.push(c):o.preparationFailure!==null?r.push(terminalOutcome(o.task.id,"failed",s,emptyEvidence(),o.preparationFailure)):r.push(await i(o,s))}return engineExecutionResult(e,r,a)}export function engineExecutionResult(e,t,n,i=[]){for(const a of t)e.observer?.evidenceRecorded(a.taskId,a.evidence),e.observer?.taskFinished(a);return{evidence:{artifacts:t.flatMap(a=>a.evidence.artifacts),logs:t.flatMap(a=>a.evidence.logs),metrics:t.flatMap(a=>a.evidence.metrics),native:n},invocationId:e.invocationId,outcomes:t,...i.length===0?{}:{runErrors:i}}}export function taskBeforeStartOutcome(e,t,n,i){return e.deadlineMs<=n||d(t.reason)?terminalOutcome(e.id,"failed",n,emptyEvidence(),taskTimeoutFailure(e.timeoutMs,i)):t.aborted?terminalOutcome(e.id,"cancelled",n,emptyEvidence(),{code:`${i.codePrefix}_CANCELLED`,message:`${i.label} task was cancelled before its process started`}):null}export function taskTimeoutFailure(e,t){return{code:`${t.codePrefix}_TASK_TIMEOUT`,details:{timeoutMs:e},message:`${t.label} task exceeded its ${e.toString()}ms timeout`}}export function managedProcessFailure(e,t,n=null){return e.terminationError===null?null:{classification:"infra",code:`${t.codePrefix}_PROCESS_TERMINATION_INCOMPLETE`,details:{cancelled:e.cancelled,...n===null?{}:{evidenceCollectionFailure:errorDetails(n)},outputLimitExceeded:e.outputLimitExceeded,timedOut:e.timedOut},message:`${t.label} managed-process termination was incomplete: ${e.terminationError.message}`,...e.terminationError.stack===void 0?{}:{stack:e.terminationError.stack}}}export function classifyManagedProcessResult(e,t,n,i){const a=o=>({failure:o,status:"failed"}),r=managedProcessFailure(e,i);return r!==null?a(r):e.timedOut||n?a(taskTimeoutFailure(t,i)):e.cancelled?{failure:{code:`${i.codePrefix}_CANCELLED`,message:`${i.label} task was cancelled`},status:"cancelled"}:e.outputLimitExceeded?a({code:`${i.codePrefix}_OUTPUT_LIMIT`,message:`${i.label} task exceeded the bounded stdout/stderr capture limit`}):e.error!==null?a({...failureFromError(e.error,`${i.codePrefix}_PROCESS_START_FAILED`),classification:"infra"}):null}export function processExitDetails(e){return{...e.exitCode===null?{}:{exitCode:e.exitCode},...e.exitSignal===null?{}:{exitSignal:e.exitSignal}}}export function processExitFailure(e,t,n=null,i=t.label){return{failure:{code:`${t.codePrefix}_PROCESS_FAILED`,details:processExitDetails(e),message:n??(e.exitCode===null?`${i} process terminated by ${e.exitSignal??"an unknown signal"}`:`${i} process exited with code ${e.exitCode.toString()}`)},status:"failed"}}export function firstOutputLine(e){const t=e.split(/\r?\n/u).map(n=>n.trim()).find(Boolean);return t===void 0?null:t.slice(0,4e3)}export function terminalOutcome(e,t,n,i,a){const r=Date.now();return{durationMs:Math.max(0,r-n),evidence:i,failure:a,finishedAtMs:r,startedAtMs:n,status:t,taskId:e}}export function processOutputEvidence(e){return{artifacts:[],logs:[...e.stdout.length===0?[]:[{stream:"stdout",text:e.stdout}],...e.stderr.length===0?[]:[{stream:"stderr",text:e.stderr}]],metrics:[]}}export function emptyEvidence(){return{artifacts:[],logs:[],metrics:[]}}export function failureFromError(e,t){const n=l(e);return{code:t,message:n.message,...n.stack===void 0?{}:{stack:n.stack}}}export function errorDetails(e){return{message:e.message,name:e.name,...e.stack===void 0?{}:{stack:e.stack}}}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export const RUNTIME_INPUT_JSON_BOUNDS=Object.freeze({maxCollectionEntries:1e4,maxDepth:32,maxNodes:5e4,maxStringBytes:4194304});export function requireBoundedJsonValue(o,n,t){let r=0;const i=(e,s)=>{if(r+=1,r>t.maxNodes)throw new Error(`${n} exceeds the ${t.maxNodes.toString()} node limit`);if(s>t.maxDepth)throw new Error(`${n} exceeds the ${t.maxDepth.toString()} level depth limit`);if(typeof e=="string"){if(Buffer.byteLength(e,"utf8")>t.maxStringBytes)throw new Error(`${n} contains a string larger than ${t.maxStringBytes.toString()} bytes`);return}if(typeof e=="number"){if(!Number.isFinite(e))throw new Error(`${n} contains a non-finite number`);return}if(e===null||typeof e=="boolean")return;if(typeof e!="object")throw new Error(`${n} contains a non-JSON value`);const a=Array.isArray(e)?e:Object.values(e);if(a.length>t.maxCollectionEntries)throw new Error(`${n} contains a collection larger than ${t.maxCollectionEntries.toString()} entries`);for(const c of a)i(c,s+1)};i(o,0)}export function serializeBoundedJson(o,n,t){requireBoundedJsonValue(o,n,t);const r=JSON.stringify(o);if(typeof r!="string")throw new Error(`${n} is not JSON-serializable`);return`${r}
|
|
2
|
+
`}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import n from"node:fs/promises";import a from"node:path";import{fileURLToPath as p}from"node:url";import{requireBoundedJsonValue as
|
|
1
|
+
import n from"node:fs/promises";import a from"node:path";import{fileURLToPath as p}from"node:url";import{requireBoundedJsonValue as f,serializeBoundedJson as w}from"./json-bounds.js";export const NATIVE_REPORT_JSON_BOUNDS=Object.freeze({maxCollectionEntries:1e5,maxDepth:64,maxNodes:1e5,maxStringBytes:1024*1024});export async function writeNativeReport(e,t,r){const o=await n.realpath(e.workspaceDirectory),c=await n.realpath(a.dirname(e.reportFile));if(o!==a.resolve(e.workspaceDirectory)||c!==o)throw new Error("Native report must stay in its invocation workspace");const s=w({schemaVersion:1,...e.identity,result:t},"Testkit native report",NATIVE_REPORT_JSON_BOUNDS);if(Buffer.byteLength(s,"utf8")>r)throw new Error(`Testkit native report exceeds ${r.toString()} bytes`);const i=await n.open(e.reportFile,"wx",384);try{await i.writeFile(s,"utf8"),await i.sync()}finally{await i.close()}}export function readNativeReport(e,t){if(typeof e!="object"||e===null||Array.isArray(e))throw new Error("Testkit native report must contain an object");const r=e;if(r.schemaVersion!==1)throw new Error("Unsupported Testkit native report schemaVersion");for(const o of["engineId","invocationId","taskId","sourceFile"])if(r[o]!==t[o])throw new Error(`Testkit native report ${o} does not match its invocation`);return{schemaVersion:1,...t,result:r.result}}export function nativeReporterFile(e){const t=p(new URL("../../../",import.meta.url));return a.join(t,"dist","engines",e,"adapter","reporter.js")}export function requireNativeEvidenceJson(e,t){f(e,t,NATIVE_REPORT_JSON_BOUNDS)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createValidatingObserverSession as u}from"./execution-observer.js";export const ENGINE_TASK_DEADLINE_EXCEEDED_CODE="TESTKIT_ENGINE_TASK_DEADLINE_EXCEEDED";export class EngineTaskDeadlineExceededError extends Error{code=ENGINE_TASK_DEADLINE_EXCEEDED_CODE;deadlineMs;constructor(n){super(`Engine task deadline ${n.toString()} was exceeded`),this.name="EngineTaskDeadlineExceededError",this.deadlineMs=n}}export const
|
|
1
|
+
import{createValidatingObserverSession as u}from"./execution-observer.js";export const ENGINE_TASK_DEADLINE_EXCEEDED_CODE="TESTKIT_ENGINE_TASK_DEADLINE_EXCEEDED";export class EngineTaskDeadlineExceededError extends Error{code=ENGINE_TASK_DEADLINE_EXCEEDED_CODE;deadlineMs;constructor(n){super(`Engine task deadline ${n.toString()} was exceeded`),this.name="EngineTaskDeadlineExceededError",this.deadlineMs=n}}export const ENGINE_CLEANUP_TIMEOUT_MS=3e4;export function isEngineTaskDeadlineExceededReason(e){return typeof e=="object"&&e!==null&&Reflect.get(e,"code")===ENGINE_TASK_DEADLINE_EXCEEDED_CODE&&typeof Reflect.get(e,"deadlineMs")=="number"&&Number.isSafeInteger(Reflect.get(e,"deadlineMs"))&&Number(Reflect.get(e,"deadlineMs"))>0}export function resolveEngineTaskInputs(e,n){const r=e.target.inputs,t=n.inputs;return Object.freeze({...t.configuration!==void 0?{configuration:t.configuration}:r.configuration!==void 0?{configuration:r.configuration}:{},environment:Object.freeze({...r.environment,...t.environment}),fixtures:Object.freeze({...r.fixtures,...t.fixtures}),...t.setupData!==void 0?{setupData:t.setupData}:r.setupData!==void 0?{setupData:r.setupData}:{},supportModules:Object.freeze({...r.supportModules,...t.supportModules})})}export function beginEngineExecution(e){const n=u(e),r=Object.freeze({...e,...n===null?{}:{observer:n.observer}});let t=null,o=!1,i=!1;return Object.freeze({request:r,acceptResult(s){if(o)throw new Error("Engine execution boundary is already closed");if(t!==null)throw new Error("Engine execution boundary already accepted a result");return n?.assertValid(),t=s,t},close(){o||(n?.close(),o=!0)},commit(){if(!o)throw new Error("Engine execution boundary must be closed before it is committed");if(i)throw new Error("Engine execution boundary is already committed");if(t===null)throw new Error("Engine execution boundary cannot commit without an accepted result");n?.assertValid(),n?.commit(),i=!0}})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./
|
|
1
|
+
export*from"./profiles.js";export*from"./evidence.js";export*from"./execution.js";export{EngineInvocationCleanupDeadlineExceededError,createEngineInvocationScope}from"./execution-scope.js";export{normalizeEngineJsonValue}from"./runtime-artifact.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const MAX_ENGINE_RUNTIME_ARTIFACT_DEPTH=64,MAX_ENGINE_RUNTIME_ARTIFACT_NODES=1e5;export function normalizeEngineJsonValue(r,o="Engine JSON value"){return _(r,o,"$",0,new Set,{nodes:0})}function _(r,o,t,E,n,e){if(e.nodes+=1,e.nodes>1e5)throw new Error(`${o} exceeds 100000 JSON nodes`);if(E>64)throw new Error(`${o} exceeds depth 64 at ${t}`);if(r===null||typeof r=="string"||typeof r=="boolean")return r;if(typeof r=="number"){if(!Number.isFinite(r))throw new Error(`${o} ${t} must be finite`);return r}if(typeof r!="object")throw new Error(`${o} ${t} is not a JSON value`);if(n.has(r))throw new Error(`${o} contains a cycle at ${t}`);n.add(r);try{if(Array.isArray(r))return Object.freeze(r.map((i,N)=>_(i,o,`${t}[${N.toString()}]`,E+1,n,e)));const f=Object.getPrototypeOf(r);if(f!==Object.prototype&&f!==null)throw new Error(`${o} ${t} must be a plain JSON object`);const T={};for(const[i,N]of Object.entries(r))T[i]=_(N,o,`${t}.${i}`,E+1,n,e);return Object.freeze(T)}finally{n.delete(r)}}
|
package/dist/engines/catalog.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{NODE_VITEST_PACKAGE_REQUIREMENTS as u,NODE_VITEST_PRIVATE_PACKAGE_PREFIXES as l}from"./installations/package-requirements.js";import{PLAYWRIGHT_PACKAGE_FAMILY_REQUIREMENTS as p}from"./installations/package-requirements.js";import{BUILT_IN_RUNNER_PROFILES as i,identityProfile as s}from"./definitions.js";export{isEngineProfileIdentity}from"./definitions.js";export{listPlainVitestFiles}from"./node-vitest/inventory/index.js";export{resolveVitestSelection}from"./node-vitest/selection.js";export function profilesForTestType(e){return Object.freeze(i.filter(t=>t.supportedTestTypes.includes(e)))}export{i as BUILT_IN_RUNNER_PROFILES};export function resolveEngineProfile(e,t){const n=s({engineId:t,testType:e});if(!n)throw new Error(`Unsupported engine/test-type pair: ${t}/${e}`);return n}export function resolveExecutionProfile(e){const t=s(e);if(t===void 0||t.id!==e.profileId)throw new Error(`Execution identity ${e.testType??"untyped"}/${e.engineId}/${e.profileId} conflicts with catalog profile ${t?.id??"none"}`);return t}const f=Object.freeze([...u.map(({packageName:e})=>Object.freeze({engineId:"node-vitest",name:e})),...p.map(({packageName:e})=>Object.freeze({engineId:"playwright",name:e}))]);export function expectedEngineAuthoringModule(e){switch(e){case"node-vitest":return null;case"playwright-ui":return"@gfdelarue/testkit/playwright"}}export function allowsEngineAuthoringImport(e,t){return t===e||t==="@gfdelarue/testkit/environment"||!(t.startsWith("@gfdelarue/testkit/")||t.startsWith("@gfdelarue/testkit-engine-"))}export function invalidEngineAuthoringImport(e,t,n,r=expectedEngineAuthoringModule(t.profileId)){const o=r===null?"":`; use "${r}" for this suite`;return new Error(`Invalid Testkit authoring in "${e}": ${t.engineId}/${t.profileId} may not import "${n}"${o}`)}export function requireMatchingEngineImport(e,t,n){if(l.some(o=>n.startsWith(o)))throw new Error(`Invalid Testkit authoring in "${e}": ${t.engineId} suites may not import private Vitest implementation package "${n}"`);const r=managedPublicPackageOwner(n);if(r!==null&&r.engineId!==t.engineId)throw new Error(`Invalid Testkit authoring in "${e}": ${t.engineId} suites may not import ${r.engineId} package "${n}"`)}export function managedPublicPackageOwner(e){for(const t of f)if(e===t.name||e.startsWith(`${t.name}/`))return t;return null}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isUnknownRecord as o}from"../../kernel/unknown-values.js";const u="TESTKIT_ENVIRONMENT_VALUE_MISSING",f=16,l=256,m=2048,E=16384,p=8,g={database:"database URL",endpoint:"URL",handle:"handle"},h=/^EnvironmentValueMissingError: This Testkit run provides no (?:(database|endpoint|handle) named ("(?:[^"\\\n]|\\.)*")|default (URL|database URL))\./gmu;export class EnvironmentValueMissingError extends Error{code=u;available;kind;valueName;constructor(e,n,r){super(M(e,n,r)),this.name="EnvironmentValueMissingError",this.available=Object.freeze([...r??[]]),this.kind=e,this.valueName=n}}export function requireEnvironmentValue(t,e,n){if(typeof n!="string"||n.length===0)throw new TypeError(`The ${e} name must be a non-empty string`);if(t===null)throw new EnvironmentValueMissingError(e,n,null);const r=e==="endpoint"?t.endpoints:t.databases;if(!Object.hasOwn(r,n))throw new EnvironmentValueMissingError(e,n,Object.keys(r).sort());return r[n]}export function readEnvironmentValueMissing(t){let e=t;for(let n=0;n<p&&o(e);n+=1){if(e.code===u&&e.name==="EnvironmentValueMissingError")return d(e);e=e.cause}return null}export function readEnvironmentValueMissingText(t){return[...t.matchAll(h)].flatMap(e=>{const[,n,r]=e,i=e.at(3);if(i!==void 0)return[{kind:i==="URL"?"endpoint":"database",valueName:null}];if(n!=="database"&&n!=="endpoint"&&n!=="handle")return[];const s=parseJson(r);return typeof s=="string"&&s.length>0?[{kind:n,valueName:s}]:[]})}export function boundEnvironmentValueMissingText(t){return t.slice(0,E)}function c(t){const e=new Set,n=[];for(const{kind:r,valueName:i}of t){const s=i===null?null:i.slice(0,l),a=JSON.stringify([r,s]);if(!e.has(a)&&(e.add(a),n.push({kind:r,valueName:s}),n.length===f))break}return n}export function environmentValueMissingFailure(t,e){return{classification:"infra",code:u,details:{missing:c(t).map(({kind:n,valueName:r})=>({kind:n,valueName:r}))},message:e.slice(0,m)}}export function parseEnvironmentValueMissingFailure(t,e){if(t===void 0)return null;const n=readEnvironmentValueMissingFailure(t);if(n===null||!o(t)||typeof t.message!="string")throw new Error(`${e} must name the missing values`);return environmentValueMissingFailure(n,t.message)}export function readEnvironmentValueMissingFailure(t){if(!o(t)||t.code!==u||t.classification!=="infra"||!o(t.details))return null;const e=t.details.missing;if(!Array.isArray(e)||e.length===0)return null;const n=e.map(d);return n.some(r=>r===null)?null:c(n.filter(r=>r!==null))}function d(t){if(!o(t))return null;const{kind:e,valueName:n}=t;return e!=="database"&&e!=="endpoint"&&e!=="handle"?null:n===null?{kind:e,valueName:n}:typeof n!="string"||n.length===0?null:{kind:e,valueName:n.slice(0,l)}}export function parseEnvironmentValueRecord(t,e){if(!o(t))throw new Error(`${e} must be an object`);const n={};for(const[r,i]of Object.entries(t)){if(r.length===0||typeof i!="string"||i.length===0||i.includes("\0"))throw new Error(`${e} must map names to non-empty strings`);Object.defineProperty(n,r,{enumerable:!0,value:i})}return Object.freeze(n)}function M(t,e,n){const r=e===null?`default ${g[t]}`:`${t} named ${JSON.stringify(e)}`;if(n===null)return`No ${r} is available, because this process is not running in a Testkit run`;const i=n.length===0?`It provides no ${t}s.`:`It provides ${n.join(", ")}.`;return`This Testkit run provides no ${r}. ${i}`}export function parseJson(t){try{return JSON.parse(t)}catch{return null}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const BUILT_IN_ENGINE_DEFINITIONS=Object.freeze({
|
|
1
|
+
export const BUILT_IN_ENGINE_DEFINITIONS=Object.freeze({"node-vitest":Object.freeze({id:"node-vitest",profiles:Object.freeze([r({taskBatching:"selection",engineId:"node-vitest",id:"node-vitest",supportedTestTypes:[]})]),async resolveInstallation(e){return(await import("./installations/node-vitest.js")).resolveNodeVitestInstallation(e)},async loadExecutor(){return(await import("./node-vitest/adapter/index.js")).executeNodeVitestEngine}}),playwright:Object.freeze({id:"playwright",profiles:Object.freeze([r({taskBatching:"compatible",engineId:"playwright",id:"playwright-ui",supportedTestTypes:["ui"]})]),async resolveInstallation(e){return(await import("./installations/playwright.js")).resolvePlaywrightInstallation(e)},async loadExecutor(){return(await import("./playwright/adapter/index.js")).executePlaywrightEngine}})}),BUILT_IN_RUNNER_PROFILES=Object.freeze(Object.values(BUILT_IN_ENGINE_DEFINITIONS).flatMap(e=>e.profiles));export function isEngineProfileIdentity(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;const t=e;return typeof t.profileId=="string"&&identityProfile(t)?.id===t.profileId}export function identityProfile(e){return BUILT_IN_RUNNER_PROFILES.find(t=>t.engineId===e.engineId&&(e.testType===void 0?t.supportedTestTypes.length===0:t.supportedTestTypes.some(i=>i===e.testType)))}function r(e){return Object.freeze(e.supportedTestTypes),Object.freeze(e)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import w from"node:http";import E from"node:https";import{isIP as f}from"node:net";import{isUnknownRecord as o}from"../../kernel/unknown-values.js";import{EnvironmentValueMissingError as p,parseJson as b}from"../contracts/environment-values.js";export const HANDLE_OPERATION_TIMEOUT_MS=1e4,HANDLE_RESPONSE_MAX_BYTES=32*1024*1024;const l="ambiguous",g=/^https?:\/\/(\[[^\]]*\]|[^\s/?#@:[\]]+)(?::(\d{1,5}))?(?:\/\S*)?$/u,m=/^[A-Za-z0-9._~\u00a1-\uffff-]+$/u;export class EnvironmentHandleError extends Error{code="TESTKIT_ENVIRONMENT_HANDLE_FAILED";handleName;reason;constructor(r,e,n,s){super(n,s),this.name="EnvironmentHandleError",this.handleName=r,this.reason=e}}export class EnvironmentHandleAmbiguousError extends EnvironmentHandleError{count;constructor(r,e){super(r,"ambiguous",`${e.toString()} captures share the handle name ${JSON.stringify(r)}. Give each capture a distinct id in its setup module.`),this.name="EnvironmentHandleAmbiguousError",this.count=e}}export function ambiguousHandleDescriptor(t){return{count:t,kind:l}}export function requireEnvironmentHandle(t,r){if(typeof r!="string"||r.length===0)throw new TypeError("The handle name must be a non-empty string");if(t===null)throw new p("handle",r,null);if(!Object.hasOwn(t,r))throw new p("handle",r,Object.keys(t).sort());const e=t[r];if(e.kind===l)throw new EnvironmentHandleAmbiguousError(r,typeof e.count=="number"?e.count:2);if(e.kind!=="http-capture")throw new EnvironmentHandleError(r,"unsupported",`Handle ${JSON.stringify(r)} has kind ${JSON.stringify(e.kind)}, which this Testkit cannot use`);return O(r,H(r,e))}export function parseEnvironmentHandleRecord(t,r){if(!o(t))throw new Error(`${r} must be an object`);const e={};for(const[n,s]of Object.entries(t)){if(n.length===0||!o(s)||typeof s.kind!="string"||!s.kind)throw new Error(`${r} must map names to handle descriptors with a kind`);Object.defineProperty(e,n,{enumerable:!0,value:s})}return Object.freeze(e)}function H(t,r){const{requestsUrl:e,resetUrl:n,url:s}=r;if(!u(s)||!u(e)||!u(n))throw new EnvironmentHandleError(t,"invalid",`Handle ${JSON.stringify(t)} is not a valid http-capture descriptor: url, requestsUrl and resetUrl must be HTTP URLs`);return{requestsUrl:e,resetUrl:n,url:s}}function O(t,r){return Object.freeze({kind:"http-capture",url:r.url,async requests(){const e=await h(t,"GET",r.requestsUrl),n=b(e);if(!o(n)||!Array.isArray(n.requests)||!n.requests.every(N))throw new EnvironmentHandleError(t,"invalid",`Handle ${JSON.stringify(t)} returned malformed requests`);return n.requests},async reset(){await h(t,"DELETE",r.resetUrl)}})}async function h(t,r,e){let n;try{n=await T(r,e)}catch(s){throw new EnvironmentHandleError(t,"unavailable",y(t),{cause:s})}if(n.status===404||n.status===405)throw new EnvironmentHandleError(t,"refused",`Handle ${JSON.stringify(t)} was refused: its capture does not offer this operation to this reference`);if(n.status<200||n.status>=300)throw new EnvironmentHandleError(t,"unavailable",y(t));return n.body}function T(t,r){return new Promise((e,n)=>{const s=(r.startsWith("https:")?E:w).request(r,{method:t,signal:AbortSignal.timeout(HANDLE_OPERATION_TIMEOUT_MS)});s.on("error",n),s.once("response",i=>{const a=[];let c=0;i.on("data",d=>{if(c+=d.length,c>HANDLE_RESPONSE_MAX_BYTES){s.destroy(new Error("The handle operation response is too large"));return}a.push(d)}),i.on("error",n),i.once("end",()=>{e({body:Buffer.concat(a).toString("utf8"),status:i.statusCode??0})})}),s.end()})}function y(t){return`Handle ${JSON.stringify(t)} is unavailable: its capture did not answer, and closes when the environment that prepared it is released`}function N(t){return o(t)&&typeof t.bodyBytes=="number"&&typeof t.bodyText=="string"&&typeof t.bodyTruncated=="boolean"&&o(t.headers)&&(t.method===null||typeof t.method=="string")&&(t.path===null||typeof t.path=="string")&&typeof t.receivedAt=="string"}function u(t){if(typeof t!="string"||t.length>2048)return!1;const r=g.exec(t);if(r===null||!URL.canParse(t))return!1;const e=r.at(2);return(e===void 0||Number(e)<=65535)&&S(r[1])}function S(t){if(t.startsWith("["))return f(t.slice(1,-1))===6;if(!m.test(t))return!1;const r=t.endsWith(".")?t.slice(0,-1):t;return!/^(?:\d+|0x[0-9a-f]*)$/iu.test(r.split(".").at(-1)??"")||f(r)===4}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{requireEnvironmentHandle as i}from"./handles.js";import{requireEnvironmentValue as r}from"../contracts/environment-values.js";import{readNodeVitestRuntimeInput as a}from"../node-vitest/runtime/runtime-input.js";import{readPlaywrightContext as o}from"../playwright/runtime/runtime-input.js";export{EnvironmentHandleAmbiguousError,EnvironmentHandleError}from"./handles.js";export{EnvironmentValueMissingError}from"../contracts/environment-values.js";let e;export function endpoint(n){return r(t(),"endpoint",n)}export function database(n){return r(t(),"database",n)}export function handle(n){return i(t()?.handles??null,n)}export function setupData(){const n=o()??a();if(n===null)throw new Error("setupData() reads a Testkit run's setup data, and there is none outside a run");return n.setupData===void 0?{}:n.setupData}function t(){if(e!==void 0)return e;const n=o()??a();return n===null?null:(e={databases:n.databases,endpoints:n.endpoints,handles:n.handles},e)}
|
package/dist/engines/factory.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from"node:fs";import i from"node:path";import{EngineManager as s}from"./manager.js";export function createEngineManager(r){return new s(c(r))}function c(r){if(!i.isAbsolute(r))throw new Error("Testkit product directory must be absolute");const t=i.resolve(r);let e;try{e=o.statSync(t)}catch(n){throw new Error(`Testkit product directory does not exist: ${t}`,{cause:n})}if(!e.isDirectory())throw new Error(`Testkit product directory is not a directory: ${t}`);return o.realpathSync.native(t)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{NODE_VITEST_PACKAGE_REQUIREMENTS as
|
|
1
|
+
import{NODE_VITEST_PACKAGE_REQUIREMENTS as d}from"./package-requirements.js";import{RootPackageResolver as c}from"./package-resolution.js";export function resolveNodeVitestInstallation(e,t=new c){e.signal.throwIfAborted();const o=(n,i)=>t.resolveImportFromRoot({dependencyGroup:"dependencies",packageName:n,publicEntrypoint:i});for(const{packageName:n,publicEntrypoints:i}of d)o(n,i[0]);const{entrypoint:r,root:a,version:s}=o("vitest","vitest");return Object.freeze({authoringEntrypoints:Object.freeze({data:t.resolveRootPublicEntrypoint("@gfdelarue/testkit/node-vitest/data"),environment:t.resolveRootPublicEntrypoint("@gfdelarue/testkit/environment"),root:t.resolveRootPublicEntrypoint("@gfdelarue/testkit"),rootPackageJson:t.packageJsonPath}),engineId:"node-vitest",vitest:Object.freeze({entrypoint:o("vitest","vitest/node").entrypoint,index:r,name:"vitest",root:a,version:s})})}export function managedVitestAliases({authoringEntrypoints:e,vitest:t}){return{"@gfdelarue/testkit":e.root,"@gfdelarue/testkit/environment":e.environment,"@gfdelarue/testkit/node-vitest/data":e.data,"@gfdelarue/testkit/package.json":e.rootPackageJson,vitest:t.index}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import d from"node:fs";import{createRequire as g}from"node:module";import l from"node:path";import{fileURLToPath as $,pathToFileURL as b}from"node:url";import{isPathWithin as u}from"../../process/files/paths.js";export const TESTKIT_PACKAGE_NAME="@gfdelarue/testkit";const k=$(new URL("../../../package.json",import.meta.url)),S=/^(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u;export class RootPackageDeclarationError extends Error{code="TESTKIT_ROOT_PACKAGE_DECLARATION_INVALID";constructor(t,e){super(t,e),this.name="RootPackageDeclarationError"}}export class MissingDirectPackageError extends Error{code="TESTKIT_DIRECT_PACKAGE_MISSING";packageName;version;constructor(t,e,n,r,i){super(`Testkit direct dependency ${t}@${e} could not resolve its public entrypoint ${JSON.stringify(n)} from ${TESTKIT_PACKAGE_NAME}. Run a clean npm install from the consumer lockfile${r?" without omitting optional dependencies":""}.`,i),this.name="MissingDirectPackageError",this.packageName=t,this.version=e}}export class BrokenPackageInstallationError extends Error{code="TESTKIT_PACKAGE_INSTALLATION_BROKEN";packageName;version;constructor(t,e,n,r){super(`Testkit dependency ${t}@${e} is installed but broken: ${n}. Run a clean npm install from the consumer lockfile.`,r),this.name="BrokenPackageInstallationError",this.packageName=t,this.version=e}}export class RootPackageResolver{packageJsonPath;packageRoot;manifest;requireFromRoot;resolveRootImport;constructor(t={}){const e=l.resolve(t.packageJsonPath??k);this.packageJsonPath=p(e,`${TESTKIT_PACKAGE_NAME} package manifest`,(n,r)=>new RootPackageDeclarationError(n,m(r))),this.packageRoot=l.dirname(this.packageJsonPath),this.manifest=T(this.packageJsonPath),this.requireFromRoot=g(this.packageJsonPath),this.resolveRootImport=t.resolveImportFromRoot??D}resolveImportFromRoot(t){const e=this.declaredVersion(t);return h({label:TESTKIT_PACKAGE_NAME,manifestRequire:this.requireFromRoot,resolveEntrypoint:n=>F(this.resolveRootImport(n)),rootSelection:!0},t,e)}resolveRequireFromRoot(t){const e=this.declaredVersion(t);return h({label:TESTKIT_PACKAGE_NAME,manifestRequire:this.requireFromRoot,resolveEntrypoint:this.requireFromRoot.resolve,rootSelection:!0},t,e)}resolveRequireFromPackage(t,e){const n=this.declaredVersion(e),r=v(t),i=g(r.manifestPath);return h({label:`${r.name}@${r.version}`,manifestRequire:i,resolveEntrypoint:i.resolve,rootSelection:!1},e,n)}resolveRequirePublicEntrypoint(t,e){const n=v(t);R(n.name,e);let r;try{r=g(n.manifestPath).resolve(e)}catch(i){throw s(n.name,n.version,`public entrypoint ${JSON.stringify(e)} could not be resolved`,i)}return _(r,n.root,n.name,n.version,e)}resolveRootPublicEntrypoint(t){R(TESTKIT_PACKAGE_NAME,t);let e;try{e=this.requireFromRoot.resolve(t)}catch(r){throw new RootPackageDeclarationError(`${TESTKIT_PACKAGE_NAME} public entrypoint ${JSON.stringify(t)} could not be resolved from its package anchor`,{cause:r})}const n=p(e,`${TESTKIT_PACKAGE_NAME} public entrypoint ${JSON.stringify(t)}`,(r,i)=>new RootPackageDeclarationError(r,m(i)));if(!u(this.packageRoot,n))throw new RootPackageDeclarationError(`${TESTKIT_PACKAGE_NAME} public entrypoint ${JSON.stringify(t)} resolves outside its package root`);return n}resolveRootPackageFile(t){const e=`${TESTKIT_PACKAGE_NAME} package file ${JSON.stringify(t)}`,n=p(l.resolve(this.packageRoot,t),e,(r,i)=>new RootPackageDeclarationError(r,m(i)));if(!u(this.packageRoot,n))throw new RootPackageDeclarationError(`${e} resolves outside its package root`);return n}brokenInstallation(t,e,n){const r=v(t);return s(r.name,r.version,e,n)}declaredVersion(t){R(t.packageName,t.publicEntrypoint);const e=this.manifest[t.dependencyGroup]?.[t.packageName];if(typeof e!="string"||!S.test(e))throw new RootPackageDeclarationError(`${TESTKIT_PACKAGE_NAME} ${t.dependencyGroup}.${t.packageName} must be an exact version; received ${JSON.stringify(e)}`);return e}}export async function importResolvedPackageEntrypoint(o){const t=P(o);try{return await import(b(t.entrypoint).href)}catch(e){throw s(t.name,t.version,`importing its resolved public entrypoint ${JSON.stringify(t.entrypoint)} failed`,e)}}function h(o,t,e){let n;try{n=o.resolveEntrypoint(t.publicEntrypoint)}catch(a){throw o.rootSelection&&I(a,t.packageName,t.publicEntrypoint)?new MissingDirectPackageError(t.packageName,e,t.publicEntrypoint,t.dependencyGroup==="optionalDependencies",{cause:a}):s(t.packageName,e,o.rootSelection?`its public entrypoint ${JSON.stringify(t.publicEntrypoint)} could not be resolved from the root package anchor`:`its public entrypoint ${JSON.stringify(t.publicEntrypoint)} could not be resolved from the selected ${o.label} package chain`,a)}let r;try{r=p(n,`${t.packageName} public entrypoint ${JSON.stringify(t.publicEntrypoint)}`,(a,y)=>s(t.packageName,e,a,y))}catch(a){throw a instanceof BrokenPackageInstallationError?a:s(t.packageName,e,`its public entrypoint ${JSON.stringify(t.publicEntrypoint)} is invalid`,a)}const i=N(o.manifestRequire,r,t.packageName,e),c=l.dirname(i);if(!u(c,r))throw s(t.packageName,e,`public entrypoint ${JSON.stringify(t.publicEntrypoint)} resolves outside its owning package root`);const f=J(i,t.packageName,e);return Object.freeze({entrypoint:r,manifestPath:i,name:f.name,root:c,version:f.version})}function N(o,t,e,n){try{const i=p(o.resolve(`${e}/package.json`),`${e} package manifest`,(f,a)=>s(e,n,f,a)),c=l.dirname(i);if(!u(c,t))throw s(e,n,"the selected public entrypoint resolves outside the exported package manifest root");return i}catch(i){if(i instanceof BrokenPackageInstallationError)throw i;if(!U(i,e))throw s(e,n,"exported package manifest resolution failed",i)}let r=l.dirname(t);for(;r!==l.parse(r).root;){const i=l.join(r,"package.json");if(A(i,e,n)){const c=p(i,`${e} package manifest`,(a,y)=>s(e,n,a,y)),f=w(c,e,n);if(f.name!==e)throw s(e,n,`manifest discovery reached incompatible package boundary ${JSON.stringify(f.name)} before ${JSON.stringify(e)}`);return c}r=l.dirname(r)}throw s(e,n,"no owning package manifest was found for the selected public entrypoint")}function T(o){const t=O(o,`${TESTKIT_PACKAGE_NAME} package manifest`,(e,n)=>new RootPackageDeclarationError(e,m(n)));if(t.name!==TESTKIT_PACKAGE_NAME)throw new RootPackageDeclarationError(`Root package manifest must name ${JSON.stringify(TESTKIT_PACKAGE_NAME)}; received ${JSON.stringify(t.name)}`);if(typeof t.version!="string")throw new RootPackageDeclarationError(`Root package manifest version must be a string; received ${JSON.stringify(t.version)}`);return E(t,"dependencies"),E(t,"optionalDependencies"),t}function J(o,t,e){const n=w(o,t,e);if(n.name!==t||n.version!==e)throw s(t,e,`manifest must be exactly ${t}@${e}; received ${n.name}@${n.version}`);return n}function w(o,t,e){const n=O(o,`${t} package manifest`,(r,i)=>s(t,e,r,i));if(typeof n.name!="string"||typeof n.version!="string")throw s(t,e,`manifest name and version must be strings; received ${String(n.name)}@${String(n.version)}`);return{name:n.name,version:n.version}}function O(o,t,e){let n;try{n=JSON.parse(d.readFileSync(o,"utf8"))}catch(r){throw e(`${t} could not be read as JSON`,r)}if(typeof n!="object"||n===null||Array.isArray(n))throw e(`${t} must contain a JSON object`);return n}function E(o,t){const e=o[t];if(e!==void 0&&(typeof e!="object"||e===null||Array.isArray(e)))throw new RootPackageDeclarationError(`Root package manifest ${t} must be a JSON object`)}function v(o){if(typeof o.name!="string"||typeof o.version!="string"||typeof o.root!="string"||typeof o.manifestPath!="string"||typeof o.entrypoint!="string")throw new TypeError("Resolved package must contain string identity paths");return o}function P(o){if(typeof o.name!="string"||typeof o.version!="string"||typeof o.entrypoint!="string")throw new TypeError("Resolved package entrypoint must contain string identity fields");return o}function R(o,t){if(o.length===0||t!==o&&!t.startsWith(`${o}/`))throw new RootPackageDeclarationError(`Public entrypoint ${JSON.stringify(t)} must belong to package ${JSON.stringify(o)}`)}function _(o,t,e,n,r){const i=p(o,`${e} public entrypoint ${JSON.stringify(r)}`,(c,f)=>s(e,n,c,f));if(!u(t,i))throw s(e,n,`public entrypoint ${JSON.stringify(r)} resolves outside its owning package root`);return i}function p(o,t,e){let n,r;try{n=d.realpathSync(o),r=d.statSync(n)}catch(i){throw e(`${t} could not be resolved as a real file`,i)}if(!r.isFile())throw e(`${t} must be a regular file`);return n}function A(o,t,e){try{return d.lstatSync(o),!0}catch(n){if(M(n))return!1;throw s(t,e,"owning package manifest discovery failed",n)}}function I(o,t,e){if(typeof o!="object"||o===null)return!1;const n=o;return(n.code==="MODULE_NOT_FOUND"||n.code==="ERR_MODULE_NOT_FOUND")&&typeof n.message=="string"&&(n.message.startsWith(`Cannot find module '${e}'`)||n.message.startsWith(`Cannot find package '${t}'`))}function F(o){let t;try{t=new URL(o)}catch(e){throw new TypeError(`Root import resolution must return an absolute URL; received ${JSON.stringify(o)}`,{cause:e})}if(t.protocol!=="file:")throw new TypeError(`Root package entrypoint must resolve to a file URL; received ${JSON.stringify(o)}`);return $(t)}function D(o){return import.meta.resolve(o)}function M(o){if(typeof o!="object"||o===null)return!1;const t=o.code;return t==="ENOENT"||t==="ENOTDIR"}function U(o,t){if(typeof o!="object"||o===null)return!1;const e=o;return e.code==="ERR_PACKAGE_PATH_NOT_EXPORTED"?!0:(e.code==="MODULE_NOT_FOUND"||e.code==="ERR_MODULE_NOT_FOUND")&&typeof e.message=="string"&&(e.message.startsWith(`Cannot find module '${t}/package.json'`)||e.message.startsWith(`Cannot find package '${t}'`))}function s(o,t,e,n){return new BrokenPackageInstallationError(o,t,e,m(n))}function m(o){return o===void 0?void 0:{cause:o}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PLAYWRIGHT_PACKAGE_FAMILY_REQUIREMENTS as R}from"./package-requirements.js";export{PLAYWRIGHT_PACKAGE_FAMILY_REQUIREMENTS}from"./package-requirements.js";import
|
|
1
|
+
import{PLAYWRIGHT_PACKAGE_FAMILY_REQUIREMENTS as R}from"./package-requirements.js";export{PLAYWRIGHT_PACKAGE_FAMILY_REQUIREMENTS}from"./package-requirements.js";import f from"node:fs";import y from"node:os";import l from"node:path";import{fileURLToPath as h}from"node:url";import{runManagedProcess as x}from"../../process/index.js";import{currentLinuxLibc as T,currentPlatformTarget as _,platformTargetKey as g,SUPPORTED_PLATFORM_TARGETS as I}from"../../process/host/platform.js";import{RootPackageResolver as b}from"./package-resolution.js";import{isUnknownRecord as c}from"../../kernel/unknown-values.js";const O=64*1024,S=6e4,E="PLAYWRIGHT_BROWSERS_PATH",A=new Set(["npm_config_playwright_browsers_path","npm_package_config_playwright_browsers_path"]);export class PlaywrightInstallationError extends Error{code="TESTKIT_PLAYWRIGHT_INSTALLATION_INVALID";constructor(r,t){super(`Playwright installation is invalid: ${r}. Run testkit setup playwright --force.`,t),this.name="PlaywrightInstallationError"}}export class UnsupportedPlaywrightPlatformError extends Error{code="TESTKIT_PLAYWRIGHT_PLATFORM_UNSUPPORTED";constructor(r,t){super(`Playwright does not support ${g(r)}${r.platform==="linux"?` with ${t??"unknown"} libc`:""}`),this.name="UnsupportedPlaywrightPlatformError"}}export function resolvePlaywrightPackageFamily(e=new b){const[r,t,o]=R,i=e.resolveRequireFromRoot(d(r)),n=e.resolveImportFromRoot(d(r));L(e,i,n);const a=e.resolveRequireFromPackage(i,d(t)),s=e.resolveRequireFromPackage(a,d(o)),u=e.resolveRequirePublicEntrypoint(i,r.publicEntrypoints[1]);return Object.freeze({cli:u,playwright:m(a,"playwright"),playwrightCore:m(s,"playwright-core"),playwrightTest:m(n,"@playwright/test")})}function L(e,r,t){if(!(r.name===t.name&&r.version===t.version&&r.root===t.root))throw e.brokenInstallation(r,"the import and require public entrypoints select different physical package roots",void 0)}export function resolvePlaywrightRegistry(e){const r=e.platform==="win32"?l.win32:l.posix;if(!r.isAbsolute(e.productRoot))throw new TypeError("Playwright product root must be absolute");const t=e.configuredValue;if(t==="0")return Object.freeze({canonicalValue:"0",mode:"hermetic"});if(t!==void 0&&t.length>0){const o=r.isAbsolute(t);return Object.freeze({canonicalValue:o?r.normalize(t):r.resolve(e.productRoot,t),mode:o?"configured-absolute":"configured-relative"})}return Object.freeze({canonicalValue:r.resolve(e.productRoot,r.join(C(e.platform,e.ambientEnvironment,e.homeDirectory??y.homedir(),r),"ms-playwright")),mode:"default"})}export function playwrightRegistryEnvironment(e,r){const t={};for(const[o,i]of Object.entries(e))typeof i=="string"&&!A.has(o.toLowerCase())&&o.toUpperCase()!==E&&(t[o]=i);return t[E]=r.canonicalValue,Object.freeze(t)}export async function resolvePlaywrightInstallation(e,r={}){e.signal.throwIfAborted();const t={linuxLibc:T(),target:_()};requireSupportedPlaywrightHost(t);const o=new b,i=r.ambientEnvironment??process.env,n=resolvePlaywrightPackageFamily(o),a=resolvePlaywrightRegistry({ambientEnvironment:i,configuredValue:r.configuredRegistry??i.PLAYWRIGHT_BROWSERS_PATH,homeDirectory:y.homedir(),platform:t.target.platform,productRoot:e.productRoot}),s=await v(e,{family:n,registry:a},i),u=o.resolveRootPublicEntrypoint("@gfdelarue/testkit/playwright");return Object.freeze({authoringEntrypoints:Object.freeze({authoring:u,environment:o.resolveRootPublicEntrypoint("@gfdelarue/testkit/environment"),managedTest:l.join(l.dirname(u),"managed-test.js"),root:o.resolveRootPublicEntrypoint("@gfdelarue/testkit"),rootPackageJson:o.resolveRootPublicEntrypoint("@gfdelarue/testkit/package.json")}),browserExecutable:requireBrowserExecutable(s.browserExecutable,t.target),engineId:"playwright",family:n,registry:a})}async function v(e,r,t){const o=Buffer.from(JSON.stringify(r),"utf8").toString("base64url"),i=await x({args:[j(),o],cwd:e.productRoot,displayLabel:"Playwright installation resolver",env:playwrightRegistryEnvironment(t,r.registry),executable:process.execPath,signal:e.signal,timeoutMs:S}),n=N(i);throwIfPlaywrightProcessAborted(e.signal,i,n),requireBoundedPlaywrightChildOutput(i.stdout);let a;try{a=parsePlaywrightChildOutput(i.stdout)}catch(s){throw n!==null?new PlaywrightInstallationError(`isolated resolver failed: ${n.message}`,{cause:n}):s}if(n!==null)throw new PlaywrightInstallationError(`isolated resolver failed: ${n.message}`,{cause:n});if(!a.ok){if(i.exitCode!==1||i.exitSignal!==null){const s=P(i);throw new PlaywrightInstallationError(`isolated resolver failed: ${s.message}`,{cause:s})}throw new PlaywrightInstallationError(`isolated resolver failed: ${a.error.message}`,{cause:M(a.error)})}if(i.exitCode!==0||i.exitSignal!==null){const s=P(i);throw new PlaywrightInstallationError(`isolated resolver failed: ${s.message}`,{cause:s})}return requireMatchingPlaywrightChildRequest(a,r),a}export function throwIfPlaywrightProcessAborted(e,r,t){if(e.aborted){if(!k(r)||t===null){e.throwIfAborted();return}throw t===e.reason?t:new AggregateError([e.reason,t],"Playwright process was cancelled and process cleanup also failed",{cause:e.reason})}}function k(e){return e.terminationError!==null||e.error!==null||e.timedOut||e.outputLimitExceeded}export function requireBoundedPlaywrightChildOutput(e){if(Buffer.byteLength(e,"utf8")>O)throw new PlaywrightInstallationError("isolated resolver returned oversized output")}export function parsePlaywrightChildOutput(e){let r;try{r=JSON.parse(e)}catch(t){throw new PlaywrightInstallationError("isolated resolver did not return bounded JSON",{cause:t})}if(!c(r)||typeof r.ok!="boolean")throw new PlaywrightInstallationError("isolated resolver returned an invalid response");if(!r.ok){if(!c(r.error)||typeof r.error.name!="string"||typeof r.error.message!="string"||r.error.code!==void 0&&typeof r.error.code!="string")throw new PlaywrightInstallationError("isolated resolver returned an invalid error");return{error:{...r.error.code===void 0?{}:{code:r.error.code},message:r.error.message,name:r.error.name},ok:!1}}if(typeof r.browserExecutable!="string"||!$(r.family)||!U(r.registry))throw new PlaywrightInstallationError("isolated resolver returned an invalid installation");return{browserExecutable:r.browserExecutable,family:r.family,ok:!0,registry:r.registry}}export function requireMatchingPlaywrightChildRequest(e,r){if(JSON.stringify(e.family)!==JSON.stringify(r.family))throw new PlaywrightInstallationError("isolated resolver selected a different physical package family");if(e.registry.canonicalValue!==r.registry.canonicalValue||e.registry.mode!==r.registry.mode)throw new PlaywrightInstallationError("isolated resolver selected a different browser registry")}export function requireBrowserExecutable(e,r){if(!l.isAbsolute(e))throw new PlaywrightInstallationError(`public chromium.executablePath() returned a non-absolute path ${JSON.stringify(e)}`);let t;try{t=f.statSync(e)}catch(o){throw new PlaywrightInstallationError(`public chromium.executablePath() returned missing path ${JSON.stringify(e)}`,{cause:o})}if(!t.isFile())throw new PlaywrightInstallationError(`public chromium.executablePath() must identify a regular file; received ${JSON.stringify(e)}`);if(r.platform!=="win32")try{f.accessSync(e,f.constants.X_OK)}catch(o){throw new PlaywrightInstallationError(`public chromium.executablePath() is not executable: ${JSON.stringify(e)}`,{cause:o})}return e}export function requireSupportedPlaywrightHost(e){const r=g(e.target);if(!I.some(t=>g(t)===r)||e.target.platform==="linux"&&e.linuxLibc!=="glibc")throw new UnsupportedPlaywrightPlatformError(e.target,e.linuxLibc)}function C(e,r,t,o){return e==="linux"?r.XDG_CACHE_HOME||o.join(p(t),".cache"):e==="darwin"?o.join(p(t),"Library","Caches"):r.LOCALAPPDATA||o.join(p(t),"AppData","Local")}function p(e){if(e.length===0)throw new TypeError("Playwright default registry requires a home directory");return e}function d(e){return{dependencyGroup:"dependencies",packageName:e.packageName,publicEntrypoint:e.publicEntrypoints[0]}}function m(e,r){if(e.name!==r)throw new TypeError(`Playwright package family expected ${r}, received ${e.name}`);return Object.freeze({entrypoint:e.entrypoint,name:r,root:e.root,version:e.version})}function j(){const e=h(new URL("./playwright-resolution-child.js",import.meta.url));return f.existsSync(e)?e:h(new URL("../../../dist/engines/installations/playwright-resolution-child.js",import.meta.url))}function N(e){return e.terminationError!==null?e.terminationError:e.error!==null?e.error:e.timedOut?new Error("isolated resolver timed out"):e.cancelled?new Error("isolated resolver was cancelled"):e.outputLimitExceeded?new Error("isolated resolver output exceeded the bound"):null}function P(e){return new Error(`isolated resolver exited with ${e.exitCode===null?String(e.exitSignal):e.exitCode.toString()}`)}function M(e){const r=new Error(e.message);return r.name=e.name,e.code!==void 0&&Object.defineProperty(r,"code",{enumerable:!0,value:e.code}),r}function $(e){return c(e)&&typeof e.cli=="string"&&w(e.playwrightTest,"@playwright/test")&&w(e.playwright,"playwright")&&w(e.playwrightCore,"playwright-core")}function w(e,r){return c(e)&&e.name===r&&typeof e.version=="string"&&typeof e.root=="string"&&typeof e.entrypoint=="string"}function U(e){return c(e)&&typeof e.canonicalValue=="string"&&(e.mode==="configured-absolute"||e.mode==="configured-relative"||e.mode==="default"||e.mode==="hermetic")}
|