@gfdelarue/testkit 0.4.5 → 0.5.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 +666 -463
- 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 +2 -2
- 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/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/data.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/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/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/http-methods.js +1 -1
- package/dist/config/loader/config-loader.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 +1 -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/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 +2 -2
- 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 +26 -188
- 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/contract/index.js +1 -1
- package/dist/engines/node-vitest/runtime/data/http.js +1 -1
- 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/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-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/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/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 +501 -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 +40 -0
- package/dist/types/index.d.ts +21 -0
- package/dist/types/node-vitest-contract.d.ts +75 -0
- package/dist/types/node-vitest-data.d.ts +407 -0
- package/dist/types/playwright.d.ts +130 -0
- package/dist/types/tooling-vitest.d.ts +13 -0
- package/dist/types/workspace.d.ts +617 -0
- package/docs/bug-records.md +37 -37
- package/docs/engines.md +213 -0
- package/docs/test-types.md +35 -33
- package/package.json +22 -29
- package/testkit-config-schema.md +378 -184
- 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/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/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/data/http.d.ts +0 -4
- 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/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,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
`,"utf8"));return{...await A(n,"application/json","testkit.failure-details","vitest-failure-details",[...e.length===0?[]:[
|
|
1
|
+
import y from"node:fs/promises";import w from"node:path";import{evidenceFileAccess as _,readStableEvidenceFile as O,writeOwnedEvidenceFile as $}from"../../adapters/evidence-files.js";import{NODE_VITEST_DATA_FAILURE_DETAILS_ARTIFACT_KIND as W,nodeVitestDataScenarioFile as X}from"../runtime/runtime-input.js";import{dataFlowArtifacts as Y}from"../runtime/data/report.js";import{readVitestReportCases as z,sharedVitestTitles as U,vitestErrorDetails as K,vitestReportErrors as x,vitestTestFailureDetails as q}from"./failure-details.js";import{parseEnvironmentValueMissingFailure as G}from"../../contracts/environment-values.js";import{readNativeReport as D,requireNativeEvidenceJson as H}from"../../adapters/native-report.js";import{isUnknownRecord as g}from"../../../kernel/unknown-values.js";import{toError as N}from"../../../kernel/error-serialization.js";import{isPathWithin as Q}from"../../../process/files/paths.js";import{firstOutputLine as Z}from"../../adapters/execution.js";import{nodeVitestReportOptions as tt}from"./reporter.js";const et=16*1024*1024,k=1024;export const NODE_VITEST_DATA_ARTIFACT_MAX_BYTES=16*1024*1024,NODE_VITEST_DATA_EVIDENCE_MAX_BYTES=64*1024*1024;const rt=".testkit-owned-evidence";export async function collectNodeVitestEvidence(t,e=_){await y.mkdir(t.artifactDirectory,{recursive:!0});const r=await y.realpath(t.artifactDirectory),s=w.join(r,rt);await y.mkdir(s,{mode:448,recursive:!1});const n=[],a=[];t.stdout.length>0&&(a.push({stream:"stdout",text:t.stdout}),n.push(await I(r,"stdout.log","node-vitest-stdout",t.stdout))),t.stderr.length>0&&(a.push({stream:"stderr",text:t.stderr}),n.push(await I(r,"stderr.log","node-vitest-stderr",t.stderr)));const o=await nt(t,s,e);n.push(...o.artifacts);const u=await ot(t,r,s,o.cases,e);return n.push(...u.artifacts),{dataEvidenceError:u.error,environmentFailure:o.environmentFailure,evidence:{artifacts:n,logs:a,metrics:[],...o.summary===null?{}:{native:{vitest:o.summary}}},reportError:o.error,reportErrorCount:o.errorCount,reportFailureMessage:o.failureMessage,reportSummary:o.summary}}async function nt({identity:t,reportFile:e,rootDirectory:r,unhandledErrors:s=[]},n,a){try{const o=await R(e,a);if(!o.exists||o.contents===null)throw new Error("Vitest did not produce its Testkit native report");const u=D(o.value,t).result;if(!g(u)||!g(u.summary))throw new Error("Vitest native report must contain result and summary objects");const f=ut(u.summary),c=z(u.cases,f),l=q(u.failures,r,U(c));if(f.numFailedTests!==l.length)throw new Error("Vitest native report failure count does not match its summary");const h=x(u.errors);if(f.success&&h.length>0)throw new Error("Vitest native report success conflicts with runtime errors");const V=[...h,...s],E=G(u.environmentFailure,"Vitest native report environment failure"),i=await $(n,"testkit-vitest-report.json",E===null?o.contents:Buffer.from(st(o.value))),m=await A(i,"application/json","engine.testkit-vitest-report","testkit-vitest-report","Testkit native Vitest report"),T=await it(n,l,K(V)),p=[m,...T===null?[]:[T]];if(u.pending!==void 0){const v=new Error("Vitest did not finish the file in every project that selects it");return{artifacts:p,cases:c,environmentFailure:null,error:v,errorCount:0,failureMessage:null,summary:null}}return{artifacts:p,cases:c,environmentFailure:E,error:null,errorCount:V.length,failureMessage:typeof l[0]?.message=="string"?l[0].message:V.find(v=>v.message.trim().length>0)?.message??null,summary:f}}catch(o){return{artifacts:[],cases:[],environmentFailure:null,error:N(o),errorCount:0,failureMessage:null,summary:null}}}function st(t){if(!g(t)||!g(t.result))throw new Error("Vitest native report must contain result and summary objects");const e=Object.fromEntries(Object.entries(t.result).filter(([r])=>r!=="environmentFailure"));return JSON.stringify({...t,result:e})}async function it(t,e,r){if(e.length+r.length===0)return null;const s={failures:[...e,...r],phase:"exec"},n=await $(t,"vitest-failure-details.json",Buffer.from(`${JSON.stringify(s,null,2)}
|
|
2
|
+
`,"utf8"));return{...await A(n,"application/json","testkit.failure-details","vitest-failure-details",[...e.length===0?[]:[j(e.length,"failed Vitest test")],...r.length===0?[]:[`${j(r.length,"Vitest error")} outside a test`]].join(" and ")),data:s}}function j(t,e){return`${t.toString()} ${e}${t===1?"":"s"}`}async function ot({dataDirectory:t,identity:e},r,s,n,a){const o=w.dirname(X(t,"")),u=[];try{const c=(await y.readdir(o).catch(i=>{if(M(i)&&i.code==="ENOENT")return[];throw i})).filter(i=>i.endsWith(".json")).sort();if(c.length>k)throw new Error(`Data evidence exceeds its ${k.toString()} test limit`);let l=0;const h=[];for(const i of c){const m=`Data scenario ${i}`,T=await ct(r,w.join(o,i),m),{contents:p}=await O(T,NODE_VITEST_DATA_ARTIFACT_MAX_BYTES,m,a);if(l+=p.byteLength,l>NODE_VITEST_DATA_EVIDENCE_MAX_BYTES)throw new Error(`Data evidence exceeds its ${NODE_VITEST_DATA_EVIDENCE_MAX_BYTES.toString()} byte aggregate limit`);h.push({contents:p,label:m,name:i})}const E=h.flatMap(({contents:i,label:m,name:T})=>{const p=F(b(i,m),m),v=d(p.attempt,`${m}.attempt`),J=d(p.repeat,`${m}.repeat`),B=at(p.scenario,`${m}.scenario`),S=n.find(({id:L})=>L===decodeURIComponent(T.slice(0,-5)));return S!==void 0&&S.state!=="skipped"&&S.attempts===v&&S.repeat===J?[{index:n.indexOf(S),scenario:B}]:[]}).sort((i,m)=>i.index-m.index).map(({scenario:i})=>i);for(const i of E.length===0?[]:Y(E,e.sourceFile,e.taskId)){const m=i.contentType==="text/markdown"?".md":".json",T=await $(s,`${i.name}${m}`,Buffer.from(i.contents,"utf8"));u.push({...await A(T,i.contentType,i.kind,i.name,i.summary),...i.kind===W?{data:F(JSON.parse(i.contents),i.name)}:{}})}}catch(f){return{artifacts:u,error:N(f)}}return{artifacts:u,error:null}}function at(t,e){const r=F(t,e);if(P(r.name,`${e}.name`),P(F(r.location,`${e}.location`).path,`${e}.location.path`),r.status!=="failed"&&r.status!=="passed")throw new Error(`${e}.status must be failed or passed`);const n=["budgetFailures","budgets","events","evidence","findings","metrics","sequences"].find(a=>!Array.isArray(r[a]));if(n!==void 0)throw new Error(`${e}.${n} must be an array`);return r}async function I(t,e,r,s){const n=w.join(t,e);return await y.writeFile(n,s,"utf8"),A(n,"text/plain; charset=utf-8","engine.output",r,Z(s)??"captured output")}async function A(t,e,r,s,n){const a=await y.stat(t);if(!a.isFile())throw new Error(`${s} artifact is not a regular file`);return{contentType:e,kind:r,metadata:{sizeBytes:a.size},name:s,path:t,summary:n}}async function R(t,e){let r;try{({contents:r}=await O(t,et,t,e))}catch(n){if(M(n)&&n.code==="ENOENT")return{contents:null,exists:!1,value:null};throw n}const s=b(r,t);return{contents:r,exists:!0,value:s}}function b(t,e){const r=JSON.parse(t.toString("utf8"));return H(r,e),r}function ut(t){const e={numFailedTests:d(t.numFailedTests,"Vitest native report.summary.numFailedTests"),numPassedTests:d(t.numPassedTests,"Vitest native report.summary.numPassedTests"),numPendingTests:d(t.numPendingTests,"Vitest native report.summary.numPendingTests"),numTodoTests:d(t.numTodoTests,"Vitest native report.summary.numTodoTests"),numTotalTests:d(t.numTotalTests,"Vitest native report.summary.numTotalTests"),numFailedTestSuites:d(t.numFailedTestSuites,"Vitest native report.summary.numFailedTestSuites"),numPassedTestSuites:d(t.numPassedTestSuites,"Vitest native report.summary.numPassedTestSuites"),numPendingTestSuites:d(t.numPendingTestSuites,"Vitest native report.summary.numPendingTestSuites"),numTotalTestSuites:d(t.numTotalTestSuites,"Vitest native report.summary.numTotalTestSuites"),success:mt(t.success,"Vitest native report.summary.success")};if(e.numTotalTests!==e.numFailedTests+e.numPassedTests+e.numPendingTests+e.numTodoTests||e.numTotalTestSuites!==e.numFailedTestSuites+e.numPassedTestSuites+e.numPendingTestSuites||e.success&&(e.numFailedTests>0||e.numFailedTestSuites>0||e.numTotalTestSuites===0))throw new Error("Vitest native report summary contains inconsistent counts or success");return e}async function ct(t,e,r){const s=w.isAbsolute(e)?e:w.resolve(t,e),n=await y.lstat(s);if(!n.isFile()||n.isSymbolicLink())throw new Error(`${r} must be a regular non-symbolic-link file`);const a=await y.realpath(s);if(!Q(t,a))throw new Error(`${r} must stay within the task artifact directory`);return a}function F(t,e){if(!g(t))throw new Error(`${e} must contain an object`);const r={};for(const[s,n]of Object.entries(t))r[s]=C(n,`${e}.${s}`);return r}function C(t,e){if(t===null||typeof t=="boolean"||typeof t=="string")return t;if(typeof t=="number"){if(!Number.isFinite(t))throw new Error(`${e} must be finite`);return t}return Array.isArray(t)?t.map((r,s)=>C(r,`${e}[${s.toString()}]`)):F(t,e)}function P(t,e){if(typeof t!="string"||t.trim().length===0)throw new Error(`${e} must be a non-empty string`);return t}function d(t,e){if(typeof t!="number"||!Number.isSafeInteger(t)||t<0)throw new Error(`${e} must be a non-negative safe integer`);return t}function mt(t,e){if(typeof t!="boolean")throw new Error(`${e} must be boolean`);return t}function M(t){return t instanceof Error}export async function readNodeVitestRunReport(t,e,r=_){try{const{identity:s}=tt(t,{reportFile:e,sourceFile:".",taskId:"run"}),{result:n}=D((await R(e,r)).value,s);if(!g(n)||!Number.isSafeInteger(n.exitCode)||!Array.isArray(n.unhandledErrors))throw new Error("Vitest run report must contain an exit code and unhandled errors");const a=n.unhandledErrors,o=n.failure===void 0?[]:[n.failure];x([...a,...o],"Vitest run report errors");const u=c=>g(c)&&[c.testPath,c.type].every(l=>l===void 0||typeof l=="string"),f=n.afterTests===void 0?[]:n.afterTests;if(!Array.isArray(f)||!f.every(c=>typeof c=="string")||!a.every(u)||!o.every(c=>g(c)&&["close","config","run"].includes(c.phase)))throw new Error("Vitest run report errors are malformed");return n}catch(s){return N(s)}}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
`);return{classification:"product",count:1,key:o
|
|
1
|
+
import l from"node:path";export function vitestTestFailureDetails(t,e,s=new Set){if(!Array.isArray(t))throw new Error("Vitest native report failures must be an array");const i=new Set;return t.map(n=>{if(typeof n!="object"||n===null||Array.isArray(n))throw new Error("Vitest native report failure must contain an object");const r=n,c=p(r.id,"id");if(i.has(c))throw new Error("Vitest native report contains a duplicate test identity");i.add(c);const o=p(r.title,"title"),a=v(r.project),f=p(r.file,"file"),m=k(e,f),d=V(r.line),w=V(r.column),h=vitestReportErrors(r.errors,"Vitest native report failure errors");vitestReportErrors(r.previousAttemptErrors,"Vitest native report failure previous attempt errors");const g=h.at(0),y=[g?.stack??"",...h.slice(1).map(u=>u.stack??u.message)].map(u=>u.trim()).filter(Boolean).join(`
|
|
2
|
+
`);if(r.classification!==void 0&&r.classification!=="infra")throw new Error("Vitest native report failure classification must be infra when present");return{classification:r.classification??"product",count:1,key:a===""?o:`${a}: ${o}`,kind:"vitest-test",location:{path:m,...a===""?{}:{project:a},...d===null?{}:{line:d},...w===null?{}:{column:w}},message:g?.message.trim()||`Vitest assertion failed: ${o}`,...s.has(E(a,f,o))?{sharedTitle:!0}:{},...y.length===0?{}:{stack:y},title:o}})}function E(t,e,s){return`${t}
|
|
3
|
+
${e}
|
|
4
|
+
${s}`}function v(t){if(t!==void 0&&typeof t!="string")throw new Error("Vitest native report project must be text");return t??""}const b=new Set(["failed","passed","pending","skipped"]);export function vitestReportErrors(t,e="Vitest native report errors"){if(!Array.isArray(t))throw new Error(`${e} must be an array`);return t.map(s=>{if(typeof s!="object"||s===null||Array.isArray(s))throw new Error(`${e} must contain objects`);const i=s;if(typeof i.message!="string")throw new Error(`${e} must each have a string message`);if(i.stack!==void 0&&typeof i.stack!="string")throw new Error(`${e} must each have a string stack when present`);return{message:i.message,...i.stack===void 0?{}:{stack:i.stack}}})}export function readVitestReportCases(t,e){if(!Array.isArray(t))throw new Error("Vitest native report cases must be an array");const s=new Set,i=t.map(n=>{if(typeof n!="object"||n===null||Array.isArray(n))throw new Error("Vitest native report case must contain an object");const r=n,c=p(r.id,"case id");if(s.has(c))throw new Error("Vitest native report contains a duplicate case identity");s.add(c);const o=p(r.title,"case title"),a=p(r.file,"case file");if(!b.has(r.state))throw new Error("Vitest native report case state is invalid");if(typeof r.attempts!="number"||!Number.isSafeInteger(r.attempts)||r.attempts<0)throw new Error("Vitest native report case attempts must be a non-negative integer");if(typeof r.repeat!="number"||!Number.isSafeInteger(r.repeat)||r.repeat<0)throw new Error("Vitest native report case repeat must be a non-negative integer");const{attempts:f,repeat:m}=r;return{attempts:f,file:a,id:c,project:v(r.project),repeat:m,state:r.state,title:o}});if(i.length!==e.numTotalTests||i.filter(n=>n.state==="failed").length!==e.numFailedTests||i.filter(n=>n.state==="passed").length!==e.numPassedTests)throw new Error("Vitest native report cases do not match its summary");return i}export function sharedVitestTitles(t){const e=new Set,s=new Set;for(const i of t){const n=E(i.project,i.file,i.title);e.has(n)&&s.add(n),e.add(n)}return s}export function vitestErrorDetails(t){const e="Vitest error outside a test";return t.map((s,i)=>{const n=s.stack?.trim()??"";return{count:1,key:`error ${String(i+1)}`,kind:"vitest-error",message:s.message.trim()||e,...n.length===0?{}:{stack:n},title:e}})}function k(t,e){if(!l.isAbsolute(e))return e;const s=l.relative(t,e);return s.length===0||s.startsWith("..")||l.isAbsolute(s)?e:s.split(l.sep).join("/")}function V(t){if(t===null)return null;if(typeof t!="number"||!Number.isSafeInteger(t)||t<0)throw new Error("Vitest native report failure coordinate must be a non-negative integer or null");return t}function p(t,e){if(typeof t!="string"||t.trim().length===0)throw new Error(`Vitest native report failure ${e} must be a non-empty string`);return t}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{writeNativeReport as
|
|
1
|
+
import M from"node:fs/promises";import c from"node:path";import{writeNativeReport as y}from"../../adapters/native-report.js";import{boundEnvironmentValueMissingText as S,environmentValueMissingFailure as F,readEnvironmentValueMissing as f}from"../../contracts/environment-values.js";export const ATTEMPT_ERROR_STARTS_META_KEY="testkitAttemptErrorStarts";export function nodeVitestReportOptions(t,{reportFile:n,sourceFile:s,taskId:i}){return{identity:{engineId:"node-vitest",invocationId:t,sourceFile:s,taskId:i},reportFile:n,workspaceDirectory:c.dirname(n)}}export class TestkitVitestReporter{invocationId;modules;finished=new Map;written=new Map;constructor(n,s){this.invocationId=n,this.modules=s}async onTestModuleEnd(n){const s=this.modules.find(({file:e,project:r})=>c.resolve(e)===c.resolve(n.moduleId)&&r===n.project.name);if(s===void 0)return;const i=[...this.finished.get(s.taskId)??[],n];this.finished.set(s.taskId,i);const a=this.modules.filter(({taskId:e})=>e===s.taskId).length-i.length,l=i.flatMap(e=>[e,...e.children.allSuites()]),o=i.flatMap(e=>[...e.children.allTests()]),u=o.filter(e=>e.result().state==="failed"),d=l.filter(e=>e.state()==="failed").length,g=l.filter(e=>e.state()==="pending"||e.state()==="queued"||e.type==="suite"&&e.options.mode==="todo").length,h=l.flatMap(e=>e.errors().filter(r=>!A(e,r))),T=h.map(reportedError),m=[...o.flatMap(e=>e.result().errors??[]),...h].flatMap(e=>{const r=f(e);return r===null?[]:[{message:e.message,missing:r}]}),k={...a===0?{}:{pending:a},summary:{numFailedTestSuites:d,numFailedTests:u.length,numPassedTestSuites:l.length-d-g,numPassedTests:o.filter(e=>e.result().state==="passed").length,numPendingTestSuites:g,numPendingTests:o.filter(e=>e.options.mode!=="todo"&&(e.result().state==="pending"||e.result().state==="skipped")).length,numTodoTests:o.filter(e=>e.options.mode==="todo").length,numTotalTestSuites:l.length,numTotalTests:o.length,success:d===0&&u.length===0&&T.length===0},...m.length===0?{}:{environmentFailure:F(m.map(({missing:e})=>e),m[0].message)},cases:o.map(e=>({attempts:R(e),file:e.module.moduleId,id:e.id,project:e.project.name,repeat:e.diagnostic()?.repeatCount??0,state:e.result().state,title:I(e)})),failures:u.map(e=>({...e.result().errors?.some(r=>f(r)!==null)?{classification:"infra"}:{},id:e.id,project:e.project.name,title:I(e),file:e.module.moduleId,line:e.location?.line??null,column:e.location?.column??null,errors:v(e).final.map(reportedError),previousAttemptErrors:v(e).earlier.map(reportedError)})),errors:T},p={...s,reportFile:`${s.reportFile}.next`},E=(this.written.get(s.taskId)??Promise.resolve()).then(async()=>{await M.rm(p.reportFile,{force:!0}),await y(nodeVitestReportOptions(this.invocationId,p),k,16*1024*1024),await M.rename(p.reportFile,s.reportFile)});this.written.set(s.taskId,E),await E}}function A(t,n){return t.type==="module"&&n.message===`No test suite found in file ${t.moduleId}`}function v(t){const n=t.result().errors??[],s=t.meta()[ATTEMPT_ERROR_STARTS_META_KEY],i=Array.isArray(s)?s.at(-1):void 0,a=typeof i=="number"&&i<n.length?i:0;return{earlier:n.slice(0,a),final:n.slice(a)}}function R(t){const n=t.diagnostic();return n===void 0?0:n.retryCount+1}export function reportedError(t){return{message:w(t,t.name?`${t.name}: ${t.message}`:t.message),...t.stack?{stack:w(t,t.stack)}:{}}}function w(t,n){return f(t)===null?n:S(n)}function I(t){const n=[];let s=t.parent;for(;s.type==="suite";)n.unshift(s.name),s=s.parent;return[...n,t.name].join(" ")}
|
|
@@ -1,202 +1,40 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
await installNodeVitestRuntimeInput(${JSON.stringify(e)});
|
|
5
|
-
const configRuntimeSymbol = Symbol.for(${JSON.stringify(p)});
|
|
6
|
-
if (Object.hasOwn(globalThis, configRuntimeSymbol))
|
|
7
|
-
throw new Error("Managed Node/Vitest config runtime is already installed");
|
|
8
|
-
// Only the Vitest parent requests config policy. Fork workers still validate
|
|
9
|
-
// their own input, but do not load the unused TypeScript alias-policy graph.
|
|
10
|
-
let loadedConfigRuntime;
|
|
11
|
-
const load = Object.freeze(() => {
|
|
12
|
-
loadedConfigRuntime ??= (async () => {
|
|
13
|
-
const consumerResolutionRuntime = await import(${JSON.stringify(n)});
|
|
14
|
-
const configRuntimeFunctions = [
|
|
15
|
-
consumerResolutionRuntime.assertNodeVitestConsumerResolution,
|
|
16
|
-
consumerResolutionRuntime.createConsumerTypeScriptPathsPlugin,
|
|
17
|
-
consumerResolutionRuntime.isNodeVitestManagedDependencyImporter,
|
|
18
|
-
];
|
|
19
|
-
for (const value of configRuntimeFunctions) {
|
|
20
|
-
if (typeof value !== "function")
|
|
21
|
-
throw new Error("Managed Node/Vitest config runtime is invalid");
|
|
22
|
-
Object.freeze(value);
|
|
23
|
-
}
|
|
24
|
-
return Object.freeze({
|
|
25
|
-
assertNodeVitestConsumerResolution: configRuntimeFunctions[0],
|
|
26
|
-
createConsumerTypeScriptPathsPlugin: configRuntimeFunctions[1],
|
|
27
|
-
isNodeVitestManagedDependencyImporter: configRuntimeFunctions[2],
|
|
28
|
-
managedTypeScriptFile: consumerResolutionRuntime.managedTypeScriptFile,
|
|
29
|
-
version: 1,
|
|
30
|
-
});
|
|
31
|
-
})();
|
|
32
|
-
return loadedConfigRuntime;
|
|
33
|
-
});
|
|
34
|
-
const configRuntime = Object.freeze({ load, version: 1 });
|
|
35
|
-
Object.defineProperty(
|
|
36
|
-
globalThis,
|
|
37
|
-
configRuntimeSymbol,
|
|
38
|
-
{
|
|
39
|
-
configurable: false,
|
|
40
|
-
enumerable: false,
|
|
41
|
-
value: configRuntime,
|
|
42
|
-
writable: false,
|
|
43
|
-
},
|
|
44
|
-
);
|
|
45
|
-
`}function I(e,t){const n=`
|
|
1
|
+
import s from"node:fs/promises";import e from"node:path";import{fileURLToPath as m,pathToFileURL as i}from"node:url";import{NODE_VITEST_RUNTIME_INPUT_SYMBOL as g}from"../runtime/runtime-input.js";import{ATTEMPT_ERROR_STARTS_META_KEY as p}from"./reporter.js";const r=m(new URL("../../../../dist/engines/node-vitest/",import.meta.url));export const NODE_VITEST_DRIVER_FILE=e.join(r,"adapter/driver.js"),NODE_VITEST_DATA_RUNNER_FILE=e.join(r,"runtime/data/runner.js");const u=e.join(r,"runtime/runtime-input.js");export async function writeNodeVitestWorkspace(t){await s.mkdir(e.dirname(t.setupFile),{recursive:!0}),await Promise.all([s.writeFile(t.setupFile,T(t.configFile,t.runtimeInput.expectedProfileId,t.modules),"utf8"),s.writeFile(t.inputBootstrapFile,`const { installNodeVitestRuntimeInput } = await import(${JSON.stringify(i(u).href)});
|
|
2
|
+
await installNodeVitestRuntimeInput(${JSON.stringify(t.runtimeInput)});
|
|
3
|
+
`,"utf8")])}function T(t,a,o){const n=d=>JSON.stringify(i(d).href),f=`
|
|
46
4
|
const installedRuntimeInput = globalThis[
|
|
47
|
-
Symbol.for(${JSON.stringify(
|
|
5
|
+
Symbol.for(${JSON.stringify(g)})
|
|
48
6
|
];
|
|
49
7
|
if (installedRuntimeInput === undefined)
|
|
50
8
|
throw new Error("Node/Vitest runtime input is not installed");
|
|
51
|
-
const baseUrl = installedRuntimeInput.
|
|
9
|
+
const baseUrl = installedRuntimeInput.baseUrl;
|
|
52
10
|
if (typeof baseUrl === "string") process.env.BASE_URL = baseUrl;
|
|
53
11
|
else delete process.env.BASE_URL;
|
|
54
|
-
|
|
55
|
-
${
|
|
12
|
+
const { beforeEach, expect } = await import(${n(o.vitest)});
|
|
13
|
+
const { nodeVitestDataScenarioFile, selectNodeVitestRuntimeTask } = await import(${JSON.stringify(i(u).href)});
|
|
14
|
+
const { rmSync } = await import("node:fs");
|
|
15
|
+
const task = selectNodeVitestRuntimeTask(expect.getState().testPath);
|
|
16
|
+
process.env.TESTKIT_TEST_FILE = task.context.task.file;
|
|
17
|
+
process.env.TESTKIT_TEST_ID = task.taskId;
|
|
18
|
+
process.env.TESTKIT_DATA_ARTIFACT_DIR = task.dataDirectory;
|
|
19
|
+
`,l=`
|
|
20
|
+
beforeEach(({ task: test }) => {
|
|
21
|
+
rmSync(nodeVitestDataScenarioFile(task.dataDirectory, test.id), { force: true });
|
|
22
|
+
const starts = test.meta[${JSON.stringify(p)}] ?? [];
|
|
23
|
+
test.meta[${JSON.stringify(p)}] = [...starts, test.result?.errors?.length ?? 0];
|
|
24
|
+
});
|
|
25
|
+
`;if(a==="node-vitest")return`${f}${l}`;const c=a==="node-vitest-data"?`
|
|
26
|
+
${R(t)}
|
|
56
27
|
registerRepoConfig(testkitRepositoryConfiguration);
|
|
57
28
|
const { __testkitRegisterNodeVitestRepositoryConfiguration } =
|
|
58
|
-
await import("@gfdelarue/testkit/node-vitest/data");
|
|
29
|
+
await import(${n(o["@gfdelarue/testkit/node-vitest/data"])});
|
|
59
30
|
__testkitRegisterNodeVitestRepositoryConfiguration(
|
|
60
31
|
testkitRepositoryConfiguration,
|
|
61
32
|
);`:"registerRepoConfig(null);";return`
|
|
62
|
-
${
|
|
63
|
-
const { registerRepoConfig } = await import("@gfdelarue/testkit/config");
|
|
64
|
-
${
|
|
65
|
-
`}function
|
|
33
|
+
${f}${l}
|
|
34
|
+
const { registerRepoConfig } = await import(${n(o["@gfdelarue/testkit/config"])});
|
|
35
|
+
${c}
|
|
36
|
+
`}function R(t){return t===null?"const testkitRepositoryConfiguration = null;":`const testkitConfigModule = await import(${JSON.stringify(i(t).href)});
|
|
66
37
|
const testkitRepositoryConfiguration =
|
|
67
38
|
testkitConfigModule.default ??
|
|
68
39
|
testkitConfigModule.config ??
|
|
69
|
-
testkitConfigModule;`}
|
|
70
|
-
Symbol.for(${JSON.stringify(c)})
|
|
71
|
-
];
|
|
72
|
-
if (installedRuntimeInput?.invocationId !== ${JSON.stringify(e.runtimeInput.expectedInvocationId)}
|
|
73
|
-
|| installedRuntimeInput.profileId !== ${JSON.stringify(e.runtimeInput.expectedProfileId)}
|
|
74
|
-
|| installedRuntimeInput.taskId !== ${JSON.stringify(e.runtimeInput.expectedTaskId)})
|
|
75
|
-
throw new Error("Managed Node/Vitest input bootstrap was not installed in the Vitest parent");`,s=`const configRuntimeSupplier = globalThis[
|
|
76
|
-
Symbol.for(${JSON.stringify(p)})
|
|
77
|
-
];
|
|
78
|
-
if (
|
|
79
|
-
typeof configRuntimeSupplier !== "object" ||
|
|
80
|
-
configRuntimeSupplier === null ||
|
|
81
|
-
!Object.isFrozen(configRuntimeSupplier) ||
|
|
82
|
-
Reflect.ownKeys(configRuntimeSupplier).length !== 2 ||
|
|
83
|
-
configRuntimeSupplier.version !== 1 ||
|
|
84
|
-
typeof configRuntimeSupplier.load !== "function" ||
|
|
85
|
-
!Object.isFrozen(configRuntimeSupplier.load)
|
|
86
|
-
)
|
|
87
|
-
throw new Error("Managed Node/Vitest config runtime supplier is invalid");
|
|
88
|
-
const configRuntime = await configRuntimeSupplier.load();
|
|
89
|
-
const configRuntimeKeys = [
|
|
90
|
-
"assertNodeVitestConsumerResolution",
|
|
91
|
-
"createConsumerTypeScriptPathsPlugin",
|
|
92
|
-
"isNodeVitestManagedDependencyImporter",
|
|
93
|
-
"managedTypeScriptFile",
|
|
94
|
-
"version",
|
|
95
|
-
];
|
|
96
|
-
if (
|
|
97
|
-
typeof configRuntime !== "object" ||
|
|
98
|
-
configRuntime === null ||
|
|
99
|
-
!Object.isFrozen(configRuntime) ||
|
|
100
|
-
Reflect.ownKeys(configRuntime).length !== configRuntimeKeys.length ||
|
|
101
|
-
!configRuntimeKeys.every((key) => Object.hasOwn(configRuntime, key)) ||
|
|
102
|
-
configRuntime.version !== 1 ||
|
|
103
|
-
typeof configRuntime.managedTypeScriptFile !== "string" ||
|
|
104
|
-
!configRuntimeKeys.slice(0, 3).every(
|
|
105
|
-
(key) =>
|
|
106
|
-
typeof configRuntime[key] === "function" &&
|
|
107
|
-
Object.isFrozen(configRuntime[key]),
|
|
108
|
-
)
|
|
109
|
-
)
|
|
110
|
-
throw new Error("Managed Node/Vitest config runtime is invalid");
|
|
111
|
-
const {
|
|
112
|
-
assertNodeVitestConsumerResolution,
|
|
113
|
-
createConsumerTypeScriptPathsPlugin,
|
|
114
|
-
isNodeVitestManagedDependencyImporter,
|
|
115
|
-
managedTypeScriptFile,
|
|
116
|
-
} = configRuntime;
|
|
117
|
-
if (managedTypeScriptFile !== ${JSON.stringify(e.entrypoints.packages.typescript.entrypoint)})
|
|
118
|
-
throw new Error("Managed Node/Vitest TypeScript plugin resolved outside its selected installation");`,d=e.tsconfigFile===null?"":`createConsumerTypeScriptPathsPlugin(${JSON.stringify(e.tsconfigFile)}, consumerResolutionPolicy),`;return`
|
|
119
|
-
${n}
|
|
120
|
-
${s}
|
|
121
|
-
const managedAliases = Object.freeze(${JSON.stringify(t.aliases)});
|
|
122
|
-
const managedPackageNames = Object.freeze(${JSON.stringify(R.map(({packageName:r})=>r))});
|
|
123
|
-
const managedDependencyRoots = Object.freeze(${JSON.stringify(t.dependencyRoots)});
|
|
124
|
-
const consumerResolutionPolicy = Object.freeze({
|
|
125
|
-
aliases: managedAliases,
|
|
126
|
-
dependencyRoots: managedDependencyRoots,
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
function exactSpecifierPattern(specifier) {
|
|
130
|
-
return new RegExp("^" + specifier.replace(/[.*+?^\${}()|[\\]\\\\]/g, "\\\\$&") + "$");
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export default {
|
|
134
|
-
plugins: [
|
|
135
|
-
{
|
|
136
|
-
enforce: "pre",
|
|
137
|
-
name: "testkit-node-vitest-managed-direct-packages",
|
|
138
|
-
async resolveId(specifier, importer, options) {
|
|
139
|
-
|
|
140
|
-
const managedImporter = isNodeVitestManagedDependencyImporter(
|
|
141
|
-
importer,
|
|
142
|
-
managedDependencyRoots,
|
|
143
|
-
);
|
|
144
|
-
if (specifier.startsWith("@vitest/") && !managedImporter)
|
|
145
|
-
throw new Error("Node/Vitest consumers may not import private Vitest package " + specifier.split("/", 2).join("/"));
|
|
146
|
-
const managedAlias = managedAliases[specifier];
|
|
147
|
-
if (managedAlias !== undefined) return assertNodeVitestConsumerResolution(
|
|
148
|
-
specifier, managedAlias, importer, consumerResolutionPolicy,
|
|
149
|
-
);
|
|
150
|
-
if (managedPackageNames.some(
|
|
151
|
-
(packageName) => specifier === packageName || specifier.startsWith(packageName + "/"),
|
|
152
|
-
))
|
|
153
|
-
throw new Error("Managed Node/Vitest package does not support runtime subpath " + specifier);
|
|
154
|
-
const resolved = await this.resolve(specifier, importer, {
|
|
155
|
-
...options,
|
|
156
|
-
skipSelf: true,
|
|
157
|
-
});
|
|
158
|
-
if (resolved === null) return null;
|
|
159
|
-
const id = assertNodeVitestConsumerResolution(
|
|
160
|
-
specifier,
|
|
161
|
-
resolved.id,
|
|
162
|
-
importer,
|
|
163
|
-
consumerResolutionPolicy,
|
|
164
|
-
);
|
|
165
|
-
return id === resolved.id ? resolved : { ...resolved, id };
|
|
166
|
-
},
|
|
167
|
-
},
|
|
168
|
-
${d}
|
|
169
|
-
],
|
|
170
|
-
root: ${JSON.stringify(e.rootDirectory)},
|
|
171
|
-
cacheDir: ${JSON.stringify(i.join(i.dirname(e.vitestConfigFile),"cache"))},
|
|
172
|
-
resolve: {
|
|
173
|
-
alias: Object.entries(managedAliases).map(([specifier, replacement]) => ({
|
|
174
|
-
find: exactSpecifierPattern(specifier),
|
|
175
|
-
replacement,
|
|
176
|
-
})),
|
|
177
|
-
},
|
|
178
|
-
test: {
|
|
179
|
-
${e.runtimeInput.expectedProfileId==="node-vitest-data"?`runner: ${JSON.stringify(f)},`:""}
|
|
180
|
-
// The installed SDK is compiled JavaScript. Use its native module instance
|
|
181
|
-
// for setup and consumer imports instead of transforming a second instance.
|
|
182
|
-
server: { deps: { external: ${JSON.stringify([e.entrypoints.config,...e.runtimeInput.expectedProfileId==="node-vitest-data"?[f,e.entrypoints.data]:[]].map(r=>r.replaceAll(i.sep,"/")))}.map(exactSpecifierPattern) } },
|
|
183
|
-
reporters: [[${JSON.stringify(S("node-vitest"))}, ${JSON.stringify(e.report)}]],
|
|
184
|
-
allowOnly: false,
|
|
185
|
-
disableConsoleIntercept: true,
|
|
186
|
-
environment: "node",
|
|
187
|
-
fileParallelism: false,
|
|
188
|
-
hookTimeout: ${e.timeoutMs.toString()},
|
|
189
|
-
include: [${JSON.stringify(toVitestIncludePattern(e.sourceFile))}],
|
|
190
|
-
isolate: true,
|
|
191
|
-
maxWorkers: 1,
|
|
192
|
-
minWorkers: 1,
|
|
193
|
-
passWithNoTests: false,
|
|
194
|
-
pool: "forks",
|
|
195
|
-
setupFiles: [${JSON.stringify(e.setupFile)}],
|
|
196
|
-
teardownTimeout: ${e.timeoutMs.toString()},
|
|
197
|
-
testTimeout: ${e.timeoutMs.toString()},
|
|
198
|
-
update: "none",
|
|
199
|
-
watch: false,
|
|
200
|
-
},
|
|
201
|
-
};
|
|
202
|
-
`}const h=new Set(["!","(",")","*","+","?","@","[","\\","]","{","}"]);export function toVitestIncludePattern(e){return Array.from(e.replaceAll(i.sep,"/"),t=>h.has(t)?`\\${t}`:t).join("")}
|
|
40
|
+
testkitConfigModule;`}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import T from"node:path";import{fileURLToPath as m}from"node:url";import{isTypedTestFile as g}from"../../../domain/identifiers.js";import{isUnknownRecord as O}from"../../../kernel/unknown-values.js";import{managedHostProcessInfrastructureError as E,runManagedHostProcess as h}from"../../../process/index.js";import{NODE_VITEST_INVENTORY_MARKER as u,resolveRepositoryVitest as d}from"../selection.js";const R=m(new URL("../../../../dist/engines/node-vitest/inventory/list-files.js",import.meta.url)),j=6e4,I=m(new URL("../../../../",import.meta.url));export async function listPlainVitestFiles(n,e){const o=e.runner==="managed",s=o?d(I):d(n,e.runner==="auto");if(s===null)return[];const a=o?!1:e.config,l=`Vitest ${s.version} at ${s.root} listing test files${a?` for ${a}`:""}`,r=await h({args:[R,JSON.stringify({config:a,project:e.project,root:n,vitest:s})],cwd:n,displayLabel:l,env:o?Object.fromEntries(Object.entries(e.host).filter(([t])=>t!=="NODE_OPTIONS")):e.host,executable:process.execPath,timeoutMs:j}),c=E(l,r);if(c)throw c;const p=(r.exitCode===0?r.stdout.split(/\r?\n/u):[]).filter(t=>t.startsWith(u)).at(-1),f=p===void 0?null:JSON.parse(p.slice(u.length));if(!Array.isArray(f)||!f.every(t=>O(t)&&typeof t.file=="string"&&typeof t.project=="string")){const t=o||e.config!==null||e.project!==null?"":`
|
|
2
|
+
Fix the error above, or pass --vitest-runner managed.`;throw new Error(`${l} failed with exit code ${String(r.exitCode)}: ${r.stderr.trim()}${t}`)}return f.map(({file:t,project:i})=>({file:t.split(T.sep).join("/"),project:i})).filter(({file:t})=>!g(t)).sort((t,i)=>t.file.localeCompare(i.file)||t.project.localeCompare(i.project))}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import c from"node:fs";import a from"node:path";import{importResolvedPackageEntrypoint as p}from"../../installations/package-resolution.js";import{NODE_VITEST_INVENTORY_MARKER as f}from"../selection.js";const t=JSON.parse(process.argv[2]??"");process.env.TEST="true",process.env.VITEST="true",process.env.NODE_ENV??="test";const{createVitest:l}=await p(t.vitest),o=await l("test",{config:t.config??void 0,watch:!1});try{const s=o.projects.map(({name:e})=>JSON.stringify(e));if(t.project!==null&&!s.includes(JSON.stringify(t.project)))throw new Error(`Vitest has no project named ${JSON.stringify(t.project)}; its projects are ${s.join(", ")}`);const i=c.realpathSync(t.root),r=(await o.globTestSpecifications()).filter(({project:e})=>t.project===null||e.name===t.project).map(({moduleId:e,project:n})=>({file:a.relative(i,e),project:n.name}));process.stdout.write(`
|
|
2
|
+
${f}${JSON.stringify(r)}
|
|
3
|
+
`)}finally{await o.close()}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHttpMethods as x}from"../../../../config/authoring/http-methods.js";import b from"node:fs";import{parseRuntimeFixtureManifestEntries as g,resolveRuntimeFixtureEntry as N}from"../../../contracts/fixture-manifest.js";import{readNodeVitestRuntimeInput as d}from"../runtime-input.js";import{expect as T,test as C}from"vitest";import{isUnknownRecord as s}from"../../../../kernel/unknown-values.js";export{T as expect};const w=Object.freeze({}),E=Object.freeze({env:w});export function contractScenario(t,e,n){const{options:r,run:i}=M(e,n);C(t,async()=>{await i(O())},r.timeoutMs||r.timeout)}export function readContractContext(){const t=d();if(t===null)return E;if(t.profileId!=="node-vitest-contract")throw new Error("Node/Vitest contract API requires node-vitest-contract runtime input");const e={...t.context,env:t.environment,...Object.hasOwn(t,"setupData")?{setupData:t.setupData}:{}};if(!A(e))throw new Error("Node/Vitest contract runtime context is invalid");return Object.freeze(e)}export function createHttpClient(t={}){const e=(t.baseUrl||readContractContext().baseUrl||"").replace(/\/+$/u,"");if(!e)throw new Error("createHttpClient(...) requires baseUrl or the managed Node/Vitest contract context baseUrl");const n=t.defaultHeaders||{"Content-Type":"application/json"};async function r(i,c,y,h={},a={}){const u=i.toUpperCase()||"GET",f=j(y,{contentTypeJson:a.contentTypeJson!==!1}),o=await fetch(`${e}${l(c)}`,{method:u,headers:{...f.body==null?{}:n,...h},body:f.body,signal:a.signal}),p=await o.text();return{body:p,headers:R(o.headers),json(){return JSON.parse(p)},method:u,path:l(c),status:o.status,url:o.url}}return{baseUrl:e,...x(r
|
|
1
|
+
import{createHttpMethods as x}from"../../../../config/authoring/http-methods.js";import b from"node:fs";import{parseRuntimeFixtureManifestEntries as g,resolveRuntimeFixtureEntry as N}from"../../../contracts/fixture-manifest.js";import{readNodeVitestRuntimeInput as d}from"../runtime-input.js";import{expect as T,test as C}from"vitest";import{isUnknownRecord as s}from"../../../../kernel/unknown-values.js";export{T as expect};const w=Object.freeze({}),E=Object.freeze({env:w});export function contractScenario(t,e,n){const{options:r,run:i}=M(e,n);C(t,async()=>{await i(O())},r.timeoutMs||r.timeout)}export function readContractContext(){const t=d();if(t===null)return E;if(t.profileId!=="node-vitest-contract")throw new Error("Node/Vitest contract API requires node-vitest-contract runtime input");const e={...t.context,env:t.environment,...Object.hasOwn(t,"setupData")?{setupData:t.setupData}:{}};if(!A(e))throw new Error("Node/Vitest contract runtime context is invalid");return Object.freeze(e)}export function createHttpClient(t={}){const e=(t.baseUrl||readContractContext().baseUrl||"").replace(/\/+$/u,"");if(!e)throw new Error("createHttpClient(...) requires baseUrl or the managed Node/Vitest contract context baseUrl");const n=t.defaultHeaders||{"Content-Type":"application/json"};async function r(i,c,y,h={},a={}){const u=i.toUpperCase()||"GET",f=j(y,{contentTypeJson:a.contentTypeJson!==!1}),o=await fetch(`${e}${l(c)}`,{method:u,headers:{...f.body==null?{}:n,...h},body:f.body,signal:a.signal}),p=await o.text();return{body:p,headers:R(o.headers),json(){return JSON.parse(p)},method:u,path:l(c),status:o.status,url:o.url}}return{baseUrl:e,...x(r),request:r}}function O(){const t=readContractContext();return Object.freeze({...t,fixture(e){return S(e)},http(e={}){return createHttpClient(e)}})}function S(t){const e=U(t),n=b.readFileSync(e.absolutePath);return{buffer(){return Buffer.from(n)},contentType:e.contentType,filename:e.filename,json(){return JSON.parse(n.toString("utf8"))},path:e.path,sha256:e.sha256,sizeBytes:e.sizeBytes,text(r="utf8"){return n.toString(r)}}}function U(t){const e=q(t,"fixture name"),n=z();return N(n.entries,e)}function z(){const t=d();return t===null?{entries:[]}:{entries:g(t.fixtures,"Node/Vitest contract fixture manifest")}}function j(t,e){if(t==null)return{body:void 0};if(typeof t=="string")return{body:t};if(t instanceof Uint8Array){const n=new Uint8Array(t.byteLength);return n.set(t),{body:n}}if(e.contentTypeJson)return{body:JSON.stringify(t)};throw new TypeError("Non-JSON contract request bodies must be strings or Uint8Array values")}function l(t){const e=t||"/";return e.startsWith("/")?e:`/${e}`}function R(t){const e={};for(const[n,r]of t.entries())e[n.toLowerCase()]=r;return e}function M(t,e){if(typeof t=="function")return{options:{},run:t};if(typeof e!="function")throw new Error("contractScenario(name, options?, run) requires a callback");return{options:t,run:e}}function q(t,e){const n=typeof t=="string"?t.trim():"";if(!n)throw new Error(`${e} is required`);return n}function A(t){return!s(t)||t.engineId!=="node-vitest"||t.profileId!=="node-vitest-contract"||!k(t.env)||"runner"in t||t.baseUrl!==void 0&&t.baseUrl!==null&&typeof t.baseUrl!="string"||t.serviceName!==void 0&&typeof t.serviceName!="string"?!1:I(t.task)}function I(t){return s(t)?!("type"in t)&&t.testType==="contract"&&m(t.file)&&J(t.id)&&m(t.suiteName):!1}function m(t){return t===void 0||typeof t=="string"}function J(t){return t===void 0||typeof t=="string"||typeof t=="number"}function k(t){return s(t)&&Object.values(t).every(e=>typeof e=="string")}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{stringFromUnknown as _}from"./primitives.js";import{createHttpMethods as b}from"../../../../config/authoring/http-methods.js";import{resolveHttpProfile as F}from"../../../../config/authoring/runtime.js";import{readNodeVitestRuntimeInput as G}from"../runtime-input.js";import{isUnknownRecord as l}from"../../../../kernel/unknown-values.js";export function createHttpClient(
|
|
1
|
+
import{stringFromUnknown as _}from"./primitives.js";import{createHttpMethods as b}from"../../../../config/authoring/http-methods.js";import{resolveHttpProfile as F}from"../../../../config/authoring/runtime.js";import{readNodeVitestRuntimeInput as G}from"../runtime-input.js";import{isUnknownRecord as l}from"../../../../kernel/unknown-values.js";export function createHttpClient(t={}){const e=(t.baseUrl??readDataContext().baseUrl??"").replace(/\/+$/u,"");if(!e)throw new Error("createHttpClient(...) requires baseUrl or the managed Node/Vitest data context baseUrl");const n=t.recorder||t.trace||null,o=t.defaultHeaders||{"Content-Type":"application/json"},r=t.sessionBundle||null,i=t.defaultActor||r?.primaryActor||null,c=typeof t.getHeaders=="function"?t.getHeaders:null,s=typeof t.getRawHeaders=="function"?t.getRawHeaders:c;async function u(a,f,w,d,E,k={},g={}){O(r,a);const A=w.trim()===""?"GET":w.toUpperCase(),D=`${e}${x(d)}`,H=v(E,{contentTypeJson:g.contentTypeJson!==!1}),$={actor:a&&r?r.actors[a]??null:null,actorName:a,sessionBundle:r},S={...H.body==null?{}:o,...m(f?s:c,$),...k},L=Date.now(),h=await fetch(D,{method:A,headers:S,body:H.body,signal:g.signal}),T=await h.text(),P=Date.now()-L,M=C(h.headers),J={body:T,cookies:V(h.headers),durationMs:P,headers:M,json(){return JSON.parse(T)},method:A,path:x(d),status:h.status,url:D};return n&&n.recordHttpRequest({bodyBytes:it(H.body),durationMs:P,method:A,path:x(d),requestHeaders:S,responseBytes:Buffer.byteLength(T),status:h.status}),J}const p=y(null,!0),R=b(p),U=Object.assign(p,{as:B,get:R.get,post:R.post}),N=y(i,!1);return{...b(N),baseUrl:e,headers(a={}){return{...m(c,{actorName:i,actor:j(r,i),sessionBundle:r}),...a}},rawHeaders(a={}){return{...m(s,{actorName:i,actor:j(r,i),sessionBundle:r}),...a}},raw:U,rawReq:U,request:N,as:I};function y(a,f){return(w,d,E,k,g)=>u(a,f,w,d,E,k,g)}function I(a){O(r,a);const f=y(a,!1),w=B(a);return{...b(f),headers(d={}){return{...m(c,{actorName:a,actor:r?r.actors[a]??null:null,sessionBundle:r}),...d}},rawHeaders(d={}){return{...m(s,{actorName:a,actor:r?r.actors[a]??null:null,sessionBundle:r}),...d}},raw:w,rawReq:w,request:f}}function B(a){const f=y(a,!0);return Object.assign(f,b(f))}}export function readDataContext(){const t=G();if(t===null)return nt;if(t.profileId!=="node-vitest-data")throw new Error("Node/Vitest data API requires node-vitest-data runtime input");return et({...t.context,env:t.environment,...Object.hasOwn(t,"setupData")?{setupData:t.setupData}:{}})}export async function createDataHttpClient(t={}){if(!t.profile)return createHttpClient(t);const e=F(t.profile);if(!e)throw new Error(`Data HTTP profile "${t.profile}" is unavailable because no repo config is registered`);const n=Y(e,t),o=X(n),r=await W(n.auth,o,t.profile),i=createHttpClient({...t,baseUrl:o.BASE,...r?.primaryActor?{defaultActor:r.primaryActor}:{},getHeaders(s){return{...n.auth?.headers?.(r,{actor:s.actorName,env:o})??{},...q(n.headers,r,o,s.actorName)}},getRawHeaders(s){return q(n.rawHeaders,r,o,s.actorName)},...r?{sessionBundle:r}:{}}),c=Q(r,i);return{...i,actor:c.actor,actors:c.actors,env:o}}function K(t){return t??null}function Y(t,e){return{...t,...e,auth:e.auth??K(t.auth),headers:e.headers??t.headers,rawHeaders:e.rawHeaders??t.rawHeaders,env:e.env??t.env}}async function W(t,e,n){const o={env:e,http:Z(),json:ot};let r=null;if(typeof t?.setupAsync=="function"?r=await t.setupAsync(o):typeof t?.setup=="function"&&(r=t.setup(o)),r==null)return null;if(!ft(r))throw new Error(`Data HTTP profile "${n??""}" auth setup must return a session bundle with actors and primaryActor`);return r}function q(t,e,n,o){return typeof t!="function"?{}:t(e,{actor:o,env:n})??{}}function X(t){const n={BASE:readDataContext().baseUrl||process.env.BASE_URL},o={...t.env||n,rawEnv:process.env};if(!o.BASE)throw new Error("Data HTTP profile requires BASE_URL or the managed Node/Vitest data context baseUrl");return{...o,BASE:o.BASE,rawEnv:process.env}}function Q(t,e){const n=Object.keys(t?.actors??{}),o=n.map(s=>{const u=t?.actors[s]??null,p=e.as(s);return{email:u?.email||null,headers:p.headers(),index:u?.actorIndex??0,key:s,name:u?.name||null,organizationKey:u?.organizationKey||null,organizationName:u?.organizationName||null,rawHeaders:p.rawHeaders(),rawReq:p.rawReq,req:p,session:u?.session||null}}),r=new Map(o.map(s=>[s.key,s])),i=t?.primaryActor||null,c=i&&r.get(i)||null;return{actor:c,actors:{names:n,primary:c,get(s){const u=r.get(s);if(!u)throw new Error(`Unknown testkit actor "${s}"`);return u},has(s){return r.has(s)},list(){return o.slice()}}}}function Z(){async function t(e,n,o,r={}){const i=st(r),c=await fetch(n,{method:e,headers:i,body:e==="GET"?void 0:at(o)});return{body:await c.text(),cookies:V(c.headers),headers:C(c.headers),status:c.status}}return{del(e,n,o){return t("DELETE",e,n,o)},get(e,n){return t("GET",e,null,n)},patch(e,n,o){return t("PATCH",e,n,o)},post(e,n,o){return t("POST",e,n,o)},put(e,n,o){return t("PUT",e,n,o)}}}function m(t,e){return typeof t!="function"?{}:t(e)}function O(t,e){if(!(!e||!t)&&!Object.hasOwn(t.actors,e))throw new Error(`Unknown testkit actor "${e}"`)}function x(t){const e=t||"/";return e.startsWith("/")?e:`/${e}`}function v(t,e={}){return t==null?{body:void 0}:typeof t=="string"?{body:t}:t instanceof Uint8Array?{body:Uint8Array.from(t)}:t instanceof URLSearchParams||t instanceof FormData||t instanceof Blob?{body:t}:e.contentTypeJson===!1?{body:z(t)}:{body:JSON.stringify(t)}}function C(t){const e={};for(const[n,o]of t.entries())e[n]=o;return e}function V(t){const e=typeof t.getSetCookie=="function"?t.getSetCookie():tt(t.get("set-cookie")),n={};for(const o of e){const[r]=o.split(";"),i=r.indexOf("=");if(i<=0)continue;const c=r.slice(0,i).trim(),s=r.slice(i+1).trim();n[c]=[{value:s}]}return n}function tt(t){return t?t.split(/,(?=\s*[^;,]+=)/u).map(e=>e.trim()).filter(Boolean):[]}function et(t){if(!l(t))throw new Error("Node/Vitest data context must be an object");if(t.engineId!=="node-vitest")throw new Error('Node/Vitest data context.engineId must be "node-vitest"');if(t.profileId!=="node-vitest-data")throw new Error('Node/Vitest data context.profileId must be "node-vitest-data"');if(!dt(t.env))throw new Error("Node/Vitest data context.env must be a string environment record");if("runner"in t)throw new Error("Node/Vitest data context.runner is not supported");const e={...t,env:t.env};if(t.baseUrl!==void 0&&t.baseUrl!==null&&typeof t.baseUrl!="string")throw new Error("Node/Vitest data context.baseUrl must be a string");if(t.serviceName!==void 0&&typeof t.serviceName!="string")throw new Error("Node/Vitest data context.serviceName must be a string");if(!l(t.task))throw new Error("Node/Vitest data context.task must be an object");{const n=t.task.id;if(n!==void 0&&typeof n!="string"&&typeof n!="number")throw new Error("Node/Vitest data context.task.id is invalid");for(const o of["file","suiteName"])if(t.task[o]!==void 0&&typeof t.task[o]!="string")throw new Error(`Node/Vitest data context.task.${o} must be a string`);if(t.task.testType!=="data")throw new Error('Node/Vitest data context.task.testType must be "data"');if("type"in t.task)throw new Error("Node/Vitest data context.task.type is not supported");e.task={...typeof t.task.file=="string"?{file:t.task.file}:{},...n===void 0?{}:{id:n},...typeof t.task.suiteName=="string"?{suiteName:t.task.suiteName}:{},testType:t.task.testType}}return e.engineId=t.engineId,e.profileId=t.profileId,Object.freeze(e)}const rt=Object.freeze({}),nt=Object.freeze({env:rt});function ot(t){if(!l(t)||typeof t.body!="string")throw new Error("Data HTTP profile response body must be a string");return JSON.parse(t.body)}function st(t){if(t==null)return{};if(!l(t))throw new Error("Data HTTP profile request options must be an object");return t.headers===void 0?{}:ct(t.headers,"Data HTTP profile request headers")}function at(t){if(t!=null)return z(t)}function it(t){return t===void 0?0:typeof t=="string"?Buffer.byteLength(t):t instanceof Blob?t.size:t instanceof URLSearchParams?Buffer.byteLength(t.toString()):t instanceof ArrayBuffer||ArrayBuffer.isView(t)?t.byteLength:0}function j(t,e){return e&&t?.actors?t.actors[e]??null:null}function z(t){return typeof t=="string"||t instanceof Blob||t instanceof FormData||t instanceof URLSearchParams||t instanceof ArrayBuffer?t:ArrayBuffer.isView(t)?Uint8Array.from(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)):_(t)}function ct(t,e){if(!l(t))throw new Error(`${e} must be an object`);const n={};for(const[o,r]of Object.entries(t))n[o]=ut(r,`${e}.${o}`);return n}function ut(t,e){if(typeof t!="string"||t.length===0)throw new Error(`${e} must be a non-empty string`);return t}function ft(t){return l(t)&&l(t.actors)&&(t.primaryActor===null||typeof t.primaryActor=="string")}function dt(t){return l(t)&&Object.values(t).every(e=>typeof e=="string")}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{expect as e}from"vitest";import{registerRepoConfig as o}from"../../../../config/authoring/runtime.js";export function __testkitRegisterNodeVitestRepositoryConfiguration(t){o(t)}export{e as expect};export{createHttpClient,readDataContext}from"./http.js";export{renderDataFlowMarkdown}from"./report.js";export{dataFlow,dataScenario,measureJsonBytes,stableHash}from"./scenario.js";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import{stringFromUnknown as m}from"./primitives.js";import i from"node:fs";import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
`)
|
|
5
|
-
`)}function
|
|
6
|
-
`).trimEnd()}function _(t,n){if(t.push("### Evidence"),n.length===0){t.push(""),t.push("No structured data-flow evidence recorded."),t.push("");return}t.push(""),t.push("| Kind | Name | Status | Details |"),t.push("| --- | --- | --- | --- |");for(const e of n)t.push(`| ${a(e.kind)} | ${a(e.name)} | ${a(e.status||"")} | ${a(N(e.details))} |`);t.push("")}function b(t,n){if(t.push("### Metrics"),n.length===0){t.push(""),t.push("No metrics recorded."),t.push("");return}t.push(""),t.push("| Metric | Value | Unit | Kind |"),t.push("| --- | ---: | --- | --- |");for(const e of n)t.push(`| ${a(e.name)} | ${j(e.value)} | ${a(e.unit||"")} | ${a(e.kind||"")} |`);t.push("")}function w(t,n){if(t.push("### Sequences"),n.length===0){t.push(""),t.push("No sequences recorded."),t.push("");return}t.push(""),t.push("| Sequence | Values |"),t.push("| --- | --- |");for(const e of n)t.push(`| ${a(e.name)} | ${a(e.values.join(" -> "))} |`);t.push("")}function F(t,n){if(t.push("### Budgets"),n.length===0){t.push(""),t.push("No budgets declared."),t.push("");return}t.push("");for(const e of n)t.push(`- ${e.status.toUpperCase()} ${e.name}: ${e.message}`);t.push("")}function I(t,n){if(t.push("### Findings"),n.length===0){t.push(""),t.push("No findings recorded."),t.push("");return}t.push("");for(const e of n)t.push(`- ${e.severity.toUpperCase()}: ${e.message}`);t.push("")}function N(t){const n=Object.entries(t||{}).filter(([e])=>e!=="status").slice(0,6);return n.length===0?"":n.map(([e,s])=>`${e}: ${k(s)}`).join(", ")}function k(t){return t==null?"":typeof t=="string"||typeof t=="number"||typeof t=="boolean"?String(t):JSON.stringify(t)}function O(t){const n={info:0,watch:0,waste:0,error:0};for(const e of t)n[e.severity]+=1;return n}function a(t){return m(t??"").replaceAll("|","\\|").replace(/\s+/gu," ").trim()}function j(t){return Number.isInteger(t)?String(t):String(Number(t.toFixed(4)))}
|
|
1
|
+
import{stringFromUnknown as m}from"./primitives.js";import i from"node:fs";import h from"node:path";import{NODE_VITEST_DATA_BUDGET_FAILURE_DETAIL_KIND as g,NODE_VITEST_DATA_FAILURE_DETAILS_ARTIFACT_KIND as l,NODE_VITEST_DATA_FAILURE_DETAILS_ARTIFACT_NAME as $,nodeVitestDataScenarioFile as S}from"../runtime-input.js";import{DATA_ARTIFACT_KIND as p,DATA_REPORT_KIND as T,DATA_SCHEMA_VERSION as y}from"./types.js";import{isUnknownArray as A,isUnknownRecord as D}from"../../../../kernel/unknown-values.js";export function writeDataFlowScenario(t,n,e){const r=process.env.TESTKIT_DATA_ARTIFACT_DIR;if(!r)return;const u=S(r,t);i.mkdirSync(h.dirname(u),{recursive:!0}),i.writeFileSync(`${u}.tmp`,JSON.stringify({...n,scenario:e})),i.renameSync(`${u}.tmp`,u)}export function dataFlowArtifacts(t,n,e){const r=_(t,n,e),u=E(r),a=u?.failures.length??0;return[{contentType:"application/json",contents:`${JSON.stringify(r,null,2)}
|
|
2
|
+
`,kind:p,name:"data-flow",summary:r.summaryText},{contentType:"text/markdown",contents:`${renderDataFlowMarkdown(r)}
|
|
3
|
+
`,kind:T,name:"data-flow-report",summary:r.summaryText},...u===null?[]:[{contentType:"application/json",contents:`${JSON.stringify(u,null,2)}
|
|
4
|
+
`,kind:l,name:$,summary:`${String(a)} failed data-flow budget${a===1?"":"s"}`}]]}function E(t){const n=t.scenarios.flatMap(e=>e.budgetFailures.map(r=>{const u=`${r.target} budget "${r.name}" (${r.operator})`;return{actual:c(r.actual,`${e.name} ${r.name} actual value`),checkName:r.name,count:1,expected:c(r.expected,`${e.name} ${r.name} expected value`),groupPath:[e.name],key:`${e.name} > ${u}`,kind:g,location:e.location,message:r.message,title:u}}));return n.length===0?null:{failures:n,phase:"exec"}}function c(t,n){let e;try{e=JSON.stringify(t)}catch(u){throw new TypeError(`${n} must be JSON-serializable`,{cause:u})}const r=JSON.parse(e);if(!N(r))throw new TypeError(`${n} must be a finite JSON value`);return r}function N(t){const n=[t];for(;n.length>0;){const e=n.pop();if(!(e===null||typeof e=="boolean"||typeof e=="string")){if(typeof e=="number"){if(!Number.isFinite(e))return!1;continue}if(A(e)){n.push(...e);continue}if(!D(e))return!1;n.push(...Object.values(e))}}return!0}function _(t,n,e){const r=t.filter(o=>o.status==="failed").length,u=t.reduce((o,d)=>o+d.budgetFailures.length,0),a=x(t.flatMap(o=>o.findings)),f=`${String(t.length-r)}/${String(t.length)} data scenario(s) passed, ${String(u)} budget failure(s)`;return{schemaVersion:y,kind:p,generatedAt:new Date().toISOString(),file:n,taskId:e,summary:{budgetFailures:u,failed:r,findingCounts:a,passed:t.length-r,scenarios:t.length,status:r>0?"failed":"passed"},summaryText:f,scenarios:t}}export function renderDataFlowMarkdown(t){const n=[];n.push("# Data Flow Report"),n.push(""),n.push(`Status: ${t.summary.status}`),n.push(`Scenarios: ${String(t.summary.passed)}/${String(t.summary.scenarios)} passed`),n.push(`Budget failures: ${String(t.summary.budgetFailures)}`),n.push("");for(const e of t.scenarios)n.push(`## ${e.name}`),n.push(""),n.push(`Status: ${e.status}`),n.push(`Duration: ${String(e.durationMs)}ms`),e.description&&n.push(`Description: ${e.description}`),e.error?.message&&n.push(`Error: ${e.error.message}`),n.push(""),w(n,e.metrics),F(n,e.sequences),b(n,e.evidence),I(n,e.budgets),O(n,e.findings);return n.join(`
|
|
5
|
+
`).trimEnd()}function b(t,n){if(t.push("### Evidence"),n.length===0){t.push(""),t.push("No structured data-flow evidence recorded."),t.push("");return}t.push(""),t.push("| Kind | Name | Status | Details |"),t.push("| --- | --- | --- | --- |");for(const e of n)t.push(`| ${s(e.kind)} | ${s(e.name)} | ${s(e.status||"")} | ${s(k(e.details))} |`);t.push("")}function w(t,n){if(t.push("### Metrics"),n.length===0){t.push(""),t.push("No metrics recorded."),t.push("");return}t.push(""),t.push("| Metric | Value | Unit | Kind |"),t.push("| --- | ---: | --- | --- |");for(const e of n)t.push(`| ${s(e.name)} | ${V(e.value)} | ${s(e.unit||"")} | ${s(e.kind||"")} |`);t.push("")}function F(t,n){if(t.push("### Sequences"),n.length===0){t.push(""),t.push("No sequences recorded."),t.push("");return}t.push(""),t.push("| Sequence | Values |"),t.push("| --- | --- |");for(const e of n)t.push(`| ${s(e.name)} | ${s(e.values.join(" -> "))} |`);t.push("")}function I(t,n){if(t.push("### Budgets"),n.length===0){t.push(""),t.push("No budgets declared."),t.push("");return}t.push("");for(const e of n)t.push(`- ${e.status.toUpperCase()} ${e.name}: ${e.message}`);t.push("")}function O(t,n){if(t.push("### Findings"),n.length===0){t.push(""),t.push("No findings recorded."),t.push("");return}t.push("");for(const e of n)t.push(`- ${e.severity.toUpperCase()}: ${e.message}`);t.push("")}function k(t){const n=Object.entries(t||{}).filter(([e])=>e!=="status").slice(0,6);return n.length===0?"":n.map(([e,r])=>`${e}: ${R(r)}`).join(", ")}function R(t){return t==null?"":typeof t=="string"||typeof t=="number"||typeof t=="boolean"?String(t):JSON.stringify(t)}function x(t){const n={info:0,watch:0,waste:0,error:0};for(const e of t)n[e.severity]+=1;return n}function s(t){return m(t??"").replaceAll("|","\\|").replace(/\s+/gu," ").trim()}function V(t){return Number.isInteger(t)?String(t):String(Number(t.toFixed(4)))}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{stringFromUnknown as
|
|
2
|
-
`)}function
|
|
1
|
+
import{stringFromUnknown as y}from"./primitives.js";import z from"node:crypto";import A from"node:fs";import{parseRuntimeFixtureManifestEntries as D,resolveRuntimeFixtureEntry as T}from"../../../contracts/fixture-manifest.js";import{readNodeVitestRuntimeInput as N}from"../runtime-input.js";import*as $ from"vitest";import{createDataHttpClient as v,readDataContext as C}from"./http.js";import{writeDataFlowScenario as O}from"./report.js";import{isUnknownArray as V,isUnknownRecord as l}from"../../../../kernel/unknown-values.js";const j=/(authorization|cookie|password|secret|token|api[_-]?key|private[_-]?key)/iu,b=String,k=new WeakSet,h=new WeakMap;export function isDataScenarioCase(e){return k.has(e)}export function dataScenario(e,n,r){const{options:t,run:s}=ee(n,r),i=a=>({...C(),fixture:o=>R(o,a),http:async(o={})=>v({...o,recorder:o.recorder||a})});$.test(e,a=>s(B(a,t.description,i)),t.timeoutMs||t.timeout);const u=$.TestRunner.getCurrentSuite().tasks.at(-1);if(u?.type!=="test")throw new Error("dataScenario did not register a native test case");k.add(u)}export function dataFlow(e){return B(e)}function B(e,n,r=()=>({})){const t=e?.task;if(t?.result===void 0||t.result.duration!==void 0||e?.onTestFinished===void 0)throw new Error("dataFlow(context) needs the context of a running Vitest test: test(name, (context) => { dataFlow(context); })");const s=h.get(e);if(s!==void 0)return s;const i=I(_(t),n,{path:process.env.TESTKIT_TEST_FILE??t.file.name,...t.location}),u=L(i,r);return h.set(e,u),e.onTestFinished(()=>{if(h.delete(e),t.result?.state==="skip")return;const a=U(i,t.result),o={attempt:(t.result?.retryCount??0)+1,repeat:t.result?.repeatCount??0};if(O(t.id,o,a),a.budgetFailures.length>0)throw new Error(X(a))}),u}function _(e){const n=[e.name];for(let r=e.suite;r!==void 0&&r!==e.file;r=r.suite)n.unshift(r.name);return n.join(" ")}export function measureJsonBytes(e){return Buffer.byteLength(JSON.stringify(e??null))}export function stableHash(e){const n=w(e);if(n===void 0)throw new TypeError("stableHash(...) requires a serializable value");return z.createHash("sha256").update(n).digest("hex")}function L(e,n){const r={addFinding(t,s,i={}){return e.findings.push({severity:te(t),message:c(s,"finding message"),details:p(i)}),r},actor(t,s={}){return m(e,"actor",t,s),r},budget(t){return F(e,t)},bytes(t,s,i={}){return r.metric(t,s,{...i,kind:"bytes",unit:i.unit||"bytes"})},count(t,s=1,i={}){return r.metric(t,s,{...i,kind:"count",unit:i.unit||"count"})},duration(t,s,i={}){return r.metric(t,s,{...i,kind:"duration",unit:i.unit||"ms"})},event(t,s={}){return e.events.push({atMs:Date.now()-e.startedAtMs,name:c(t,"event name"),details:p(s)}),r},externalCall(t,s={}){const i=g(s);return m(e,"external-call",t,i),typeof i.durationMs=="number"&&r.duration(`${t}.external.duration`,i.durationMs),typeof i.requestBytes=="number"&&r.bytes(`${t}.external.request.bytes`,i.requestBytes),typeof i.responseBytes=="number"&&r.bytes(`${t}.external.response.bytes`,i.responseBytes),typeof i.costMinor=="number"&&r.money(`${t}.external.cost`,i.costMinor),r},expectMetric(t){return F(e,t)},expectSequence(t){return E(e,t)},finding(t,s,i={}){return r.addFinding(t,s,i)},metric(t,s,i={}){return P(e,t,s,i),r},money(t,s,i={}){return r.metric(t,s,{...i,kind:"money",unit:i.unit||"minor"})},ratio(t,s,i={}){return r.metric(t,s,{...i,kind:"ratio",unit:i.unit||"ratio"})},reconcile(t,s={}){return m(e,"reconciliation",t,s),r},record(t,s={}){const i=g(s);return m(e,"record",t,i),typeof i.count=="number"&&r.count(`${t}.record.count`,i.count),r},recordCache(t,{hits:s=0,misses:i=0,reads:u=0,writes:a=0}={}){const o=c(t,"cache metric name");r.count(`${o}.cache.hits`,s),r.count(`${o}.cache.misses`,i),r.count(`${o}.cache.reads`,u),r.count(`${o}.cache.writes`,a);const S=s+i;return S>0&&r.ratio(`${o}.cache.hit_rate`,s/S),r},recordHttpRequest(t){return r.count("http.request.count",1),r.bytes("http.request.bytes",t.bodyBytes||0),r.bytes("http.response.bytes",t.responseBytes||0),r.duration("http.request.duration",t.durationMs||0),r.sequence("http.methods",[t.method]),r.sequence("http.paths",[t.path]),r.event("http.request",{durationMs:t.durationMs||0,method:t.method,path:t.path,requestBytes:t.bodyBytes||0,responseBytes:t.responseBytes||0,status:t.status}),r},recordLlmUsage(t,s={}){const i=c(t,"llm usage name");for(const[u,a]of Object.entries(s))typeof a=="number"&&Number.isFinite(a)&&r.count(`${i}.${se(u)}`,a,{unit:u.toLowerCase().includes("cost")?"minor":"tokens"});return r},recordRpc(t,{method:s,requestBytes:i=0,responseBytes:u=0}={}){const a=c(t,"rpc metric name");return r.count(`${a}.rpc.count`,1),s&&r.sequence(`${a}.rpc.methods`,[s]),r.bytes(`${a}.rpc.request.bytes`,i),r.bytes(`${a}.rpc.response.bytes`,u),r},sequence(t,s,i={}){return K(e,t,s,i),r},sequenceBudget(t){return E(e,t)},system(t,s={}){return m(e,"system",t,s),r},transition(t,s={}){return m(e,"transition",t,s),r}};return Object.freeze(Object.assign(r,n(r)))}function R(e,n=null){const r=J(e),t=A.readFileSync(r.absolutePath);return n?.count("fixture.count",1,{dimensions:{path:r.path}}),n?.bytes("fixture.bytes",t.byteLength,{dimensions:{path:r.path}}),{buffer(){return Buffer.from(t)},contentType:r.contentType,filename:r.filename,json(){return JSON.parse(t.toString("utf8"))},path:r.path,sha256:r.sha256,sizeBytes:r.sizeBytes,text(s="utf8"){return t.toString(s)}}}function J(e){const n=c(e,"fixture name"),r=H();return T(r.entries,n)}function H(){const e=N();return e===null?{entries:[]}:{entries:D(e.fixtures,"Node/Vitest data fixture manifest")}}function F(e,n){const r=c(n,"metric budget name");return{atLeast(t,s={}){return f(e,{name:r,target:"metric",operator:">=",expected:t,message:s.message}),this},atMost(t,s={}){return f(e,{name:r,target:"metric",operator:"<=",expected:t,message:s.message}),this},equals(t,s={}){return f(e,{name:r,target:"metric",operator:"==",expected:t,message:s.message}),this},greaterThan(t,s={}){return f(e,{name:r,target:"metric",operator:">",expected:t,message:s.message}),this},lessThan(t,s={}){return f(e,{name:r,target:"metric",operator:"<",expected:t,message:s.message}),this},required(t={}){return f(e,{name:r,target:"metric",operator:"exists",message:t.message}),this}}}function E(e,n){const r=c(n,"sequence budget name");return{equals(t,s={}){return f(e,{name:r,target:"sequence",operator:"sequence==",expected:x(t),message:s.message}),this},includesOnly(t,s={}){return f(e,{name:r,target:"sequence",operator:"sequenceOnly",expected:x(t),message:s.message}),this},required(t={}){return f(e,{name:r,target:"sequence",operator:"exists",message:t.message}),this}}}function I(e,n,r){return{budgets:[],description:n||null,events:[],evidence:[],findings:[],location:r,metrics:[],name:c(e,"data scenario name"),sequences:[],startedAtMs:Date.now()}}function U(e,n){const{budgets:r,startedAtMs:t,...s}=e,i=r.map(o=>W(e,o)),u=i.filter(o=>o.status==="failed"),a=n?.state==="fail"?re(n.errors?.at(-1)):null;return{...s,budgetFailures:u,budgets:i,durationMs:Date.now()-t,error:a,status:a||u.length>0?"failed":"passed"}}function P(e,n,r,t={}){const s=r;if(!Number.isFinite(s))throw new Error(`Data metric "${n}" must be a finite number`);e.metrics.push({description:d(t.description),dimensions:M(t.dimensions??{}),kind:d(t.kind)||"metric",name:c(n,"metric name"),unit:d(t.unit),value:s})}function K(e,n,r,t={}){const s=x(r).map(i=>b(i));e.sequences.push({description:d(t.description),dimensions:M(t.dimensions??{}),name:c(n,"sequence name"),values:s})}function f(e,n){e.budgets.push({...n,message:d(n.message)})}function m(e,n,r,t={}){const s=g(t);e.evidence.push({atMs:Date.now()-e.startedAtMs,details:p(s),kind:n,name:c(r,`${n} evidence name`),status:d(s.status)||null})}function g(e){return l(e)?e:{value:e}}function W(e,n){const r=n.target==="sequence"?G(e,n.name):Y(e,n.name),t=Z(n,r),s=n.message||Q(n,r,t);return n.target==="metric"?{...n,actual:r,expected:n.expected??null,message:s,status:t?"passed":"failed"}:{...n,actual:r,expected:n.expected??null,message:s,status:t?"passed":"failed"}}function Z(e,n){if(e.target==="metric")return e.operator==="exists"?n!==null:typeof n!="number"?!1:e.operator==="<="?n<=Number(e.expected):e.operator===">="?n>=Number(e.expected):e.operator==="<"?n<Number(e.expected):e.operator===">"?n>Number(e.expected):Object.is(n,Number(e.expected));if(e.operator==="exists")return n!==null;if(!Array.isArray(n))return!1;if(e.operator==="sequence==")return ne(n,e.expected);const r=new Set((e.expected??[]).map(t=>y(t)));return n.every(t=>r.has(t))}function Y(e,n){for(let r=e.metrics.length-1;r>=0;r-=1)if(e.metrics[r].name===n)return e.metrics[r].value;return null}function G(e,n){const r=[];for(const t of e.sequences)t.name===n&&r.push(...t.values);return r.length>0?r:null}function Q(e,n,r){return e.operator==="exists"?r?`${e.target} "${e.name}" was recorded`:`${e.target} "${e.name}" was not recorded`:`${e.target} "${e.name}" expected ${e.operator} ${JSON.stringify(e.expected)}, got ${JSON.stringify(n)}`}function X(e){return[`Data-flow budgets failed in "${e.name}":`,...e.budgetFailures.map(n=>`- ${n.message}`)].join(`
|
|
2
|
+
`)}function ee(e,n){if(typeof e=="function")return{options:{},run:e};if(typeof n!="function")throw new Error("dataScenario(name, options?, run) requires a run callback");return{options:e,run:n}}function x(e){return V(e)?[...e]:[e]}function c(e,n){const r=y(e).trim();if(!r)throw new Error(`${n} must be a non-empty string`);return r}function d(e){if(e==null)return null;const n=y(e).trim();return n||null}function te(e){const n=y(e||"info").toLowerCase();return ae(n)?n:"info"}function p(e){if(Array.isArray(e))return e.map(r=>p(r));if(!l(e))return e;const n={};for(const[r,t]of Object.entries(e))n[r]=j.test(r)?"[redacted]":p(t);return n}function re(e){return e instanceof Error?{message:e.message,name:e.name,stack:e.stack??null}:{message:q(e,"message")??ie(e),name:q(e,"name")??"Error",stack:q(e,"stack")}}function w(e){return Array.isArray(e)?`[${e.map(n=>w(n)).join(",")}]`:l(e)?`{${Object.keys(e).sort().map(n=>{const r=w(e[n]);return`${JSON.stringify(n)}:${r??"undefined"}`}).join(",")}}`:JSON.stringify(e)}function ne(e,n){return!Array.isArray(e)||!Array.isArray(n)||e.length!==n.length?!1:e.every((r,t)=>String(r)===String(n[t]))}function se(e){return e.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/[^a-zA-Z0-9]+/g,"_").replace(/^_+|_+$/g,"").toLowerCase()}function M(e){const n=p(e);return l(n)?n:{}}function q(e,n){if(!l(e))return null;try{const r=Reflect.get(e,n);return typeof r=="string"?r:null}catch{return null}}function ie(e){try{return b(e)}catch{return"Unknown thrown value"}}function ae(e){return e==="error"||e==="info"||e==="waste"||e==="watch"}
|