@overkill-dev/run 0.0.62 → 0.0.64
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/assertion-protocol/assertion-node.d.ts +0 -15
- package/assertion-protocol/assertion-node.d.ts.map +1 -1
- package/assertion-protocol/assertion-reference.d.ts +0 -21
- package/assertion-protocol/assertion-reference.d.ts.map +1 -1
- package/assertion-protocol/assertion-reference.js +3 -30
- package/assertion-protocol/assertion-reference.js.map +1 -1
- package/assertion-protocol/assertions/boolean.d.ts +0 -7
- package/assertion-protocol/assertions/boolean.d.ts.map +1 -1
- package/assertion-protocol/assertions/collection.d.ts +0 -9
- package/assertion-protocol/assertions/collection.d.ts.map +1 -1
- package/assertion-protocol/assertions/equality.d.ts +0 -11
- package/assertion-protocol/assertions/equality.d.ts.map +1 -1
- package/assertion-protocol/assertions/fail.d.ts +0 -5
- package/assertion-protocol/assertions/fail.d.ts.map +1 -1
- package/assertion-protocol/assertions/numeric.d.ts +0 -13
- package/assertion-protocol/assertions/numeric.d.ts.map +1 -1
- package/assertion-protocol/assertions/partial.d.ts +0 -9
- package/assertion-protocol/assertions/partial.d.ts.map +1 -1
- package/assertion-protocol/assertions/presence.d.ts +0 -11
- package/assertion-protocol/assertions/presence.d.ts.map +1 -1
- package/assertion-protocol/assertions/string.d.ts +0 -13
- package/assertion-protocol/assertions/string.d.ts.map +1 -1
- package/assertion-protocol/assertions/type-shape.d.ts +0 -19
- package/assertion-protocol/assertions/type-shape.d.ts.map +1 -1
- package/assertion-protocol/source-location-forwarding.js +15 -9
- package/assertion-protocol/source-location-forwarding.js.map +1 -1
- package/assertion-protocol/source-location.js +1 -0
- package/assertion-protocol/source-location.js.map +1 -1
- package/assertion-protocol/thrown-error-record.d.ts +0 -1
- package/assertion-protocol/thrown-error-record.d.ts.map +1 -1
- package/assertion-protocol/thrown-matcher.d.ts +1 -18
- package/assertion-protocol/thrown-matcher.d.ts.map +1 -1
- package/compare/serialized-value-shape.d.ts +0 -9
- package/compare/serialized-value-shape.d.ts.map +1 -1
- package/compare/serialized-value.d.ts +1 -8
- package/compare/serialized-value.d.ts.map +1 -1
- package/engine/assertion-facade.d.ts +2 -5
- package/engine/assertion-facade.d.ts.map +1 -1
- package/engine/async-control.d.ts +0 -26
- package/engine/async-control.d.ts.map +1 -1
- package/engine/async-leak-diagnostics.js +9 -9
- package/engine/async-leak-diagnostics.js.map +1 -1
- package/engine/case-attempt-execution.js +191 -0
- package/engine/case-attempt-execution.js.map +1 -0
- package/engine/case-execution.d.ts +5 -16
- package/engine/case-execution.d.ts.map +1 -1
- package/engine/case-execution.js +25 -24
- package/engine/case-execution.js.map +1 -1
- package/engine/coverage-artifact.d.ts +1 -14
- package/engine/coverage-artifact.d.ts.map +1 -1
- package/engine/custom-assertion-recording.js +1 -1
- package/engine/custom-assertion-recording.js.map +1 -1
- package/engine/engine.d.ts +1 -8
- package/engine/engine.d.ts.map +1 -1
- package/engine/execution-async-leak-policy.js +3 -10
- package/engine/execution-async-leak-policy.js.map +1 -1
- package/engine/execution-global-error-observer.d.ts +2 -4
- package/engine/execution-global-error-observer.d.ts.map +1 -1
- package/engine/execution-global-error-observer.js +20 -46
- package/engine/execution-global-error-observer.js.map +1 -1
- package/engine/execution-options.d.ts +4 -7
- package/engine/execution-options.d.ts.map +1 -1
- package/engine/execution-options.js +7 -2
- package/engine/execution-options.js.map +1 -1
- package/engine/execution-resource-budget-breach.d.ts +0 -9
- package/engine/execution-resource-budget-breach.d.ts.map +1 -1
- package/engine/execution-resource-budget-tracking.js.map +1 -1
- package/engine/execution-resource-tracked-cases.js.map +1 -1
- package/engine/execution-result.js.map +1 -1
- package/engine/execution-supervision-state.js.map +1 -1
- package/engine/execution-supervision.d.ts +0 -16
- package/engine/execution-supervision.d.ts.map +1 -1
- package/engine/execution-supervision.js +50 -33
- package/engine/execution-supervision.js.map +1 -1
- package/engine/execution-test-plan-cases.js +6 -126
- package/engine/execution-test-plan-cases.js.map +1 -1
- package/engine/execution-test-plan-resource-usage.js.map +1 -1
- package/engine/execution.d.ts +1 -12
- package/engine/execution.d.ts.map +1 -1
- package/engine/execution.js +3 -3
- package/engine/execution.js.map +1 -1
- package/engine/identity.d.ts +3 -6
- package/engine/identity.d.ts.map +1 -1
- package/engine/reporter-dispatcher.d.ts +1 -11
- package/engine/reporter-dispatcher.d.ts.map +1 -1
- package/engine/reporter-dispatcher.js +1 -0
- package/engine/reporter-dispatcher.js.map +1 -1
- package/engine/reporter-event-queue.js.map +1 -1
- package/engine/reporter-output.d.ts +0 -6
- package/engine/reporter-output.d.ts.map +1 -1
- package/engine/reporter.d.ts +2 -17
- package/engine/reporter.d.ts.map +1 -1
- package/engine/reporter.js.map +1 -1
- package/engine/reporting-context.d.ts +1 -13
- package/engine/reporting-context.d.ts.map +1 -1
- package/engine/require-assertion-facade.d.ts +2 -5
- package/engine/require-assertion-facade.d.ts.map +1 -1
- package/engine/resource-usage.d.ts +22 -0
- package/engine/resource-usage.d.ts.map +1 -0
- package/engine/retry-policy.d.ts +4 -0
- package/engine/retry-policy.d.ts.map +1 -0
- package/engine/retry-policy.js +22 -0
- package/engine/retry-policy.js.map +1 -0
- package/engine/run-artifact.d.ts +45 -0
- package/engine/run-artifact.d.ts.map +1 -0
- package/engine/run-result.d.ts +18 -114
- package/engine/run-result.d.ts.map +1 -1
- package/engine/run-result.js +14 -0
- package/engine/run-result.js.map +1 -1
- package/engine/run-timings.d.ts +0 -18
- package/engine/run-timings.d.ts.map +1 -1
- package/engine/runner-error-reporting.js.map +1 -1
- package/engine/test-attempt-history.js +24 -0
- package/engine/test-attempt-history.js.map +1 -0
- package/engine/test-body-resource-attachment.d.ts +0 -12
- package/engine/test-body-resource-attachment.d.ts.map +1 -1
- package/engine/test-body-resource-attachment.js +3 -134
- package/engine/test-body-resource-attachment.js.map +1 -1
- package/engine/test-data.d.ts +0 -6
- package/engine/test-data.d.ts.map +1 -1
- package/engine/test-node.d.ts +0 -21
- package/engine/test-node.d.ts.map +1 -1
- package/engine/test-node.js +1 -20
- package/engine/test-node.js.map +1 -1
- package/engine/test-plan.d.ts +1 -4
- package/engine/test-plan.d.ts.map +1 -1
- package/package.json +21 -7
- package/packages/run/config.entry-point.d.ts +2 -0
- package/packages/run/config.entry-point.d.ts.map +1 -1
- package/packages/run/run.entry-point.d.ts +2 -0
- package/packages/run/run.entry-point.d.ts.map +1 -1
- package/packages/run/transcript-store.entry-point.d.ts +3 -0
- package/packages/run/transcript-store.entry-point.d.ts.map +1 -0
- package/packages/run/transcript-store.entry-point.js +2 -0
- package/packages/run/transcript-store.entry-point.js.map +1 -0
- package/packages/simulation/transcript.entry-point.js +2 -0
- package/packages/simulation/transcript.entry-point.js.map +1 -0
- package/readme.md +47 -2
- package/reporters/human-reporter-rendering.js +12 -3
- package/reporters/human-reporter-rendering.js.map +1 -1
- package/reporters/line-reporter.js +6 -1
- package/reporters/line-reporter.js.map +1 -1
- package/reporters/tree-reporter.js +2 -103
- package/reporters/tree-reporter.js.map +1 -1
- package/resources/resource-definition-shape.d.ts +0 -2
- package/resources/resource-definition-shape.d.ts.map +1 -1
- package/resources/resource-definition-types.d.ts +1 -96
- package/resources/resource-definition-types.d.ts.map +1 -1
- package/resources/resource-definition.js.map +1 -1
- package/resources/resource-lifecycle-error.d.ts +0 -1
- package/resources/resource-lifecycle-error.d.ts.map +1 -1
- package/resources/resource-lifecycle-error.js +17 -1
- package/resources/resource-lifecycle-error.js.map +1 -1
- package/resources/resource-scenario-binding.js +1 -69
- package/resources/resource-scenario-binding.js.map +1 -1
- package/resources/resource-scenario.d.ts +0 -19
- package/resources/resource-scenario.d.ts.map +1 -1
- package/resources/resource-session.d.ts +1 -20
- package/resources/resource-session.d.ts.map +1 -1
- package/resources/resources.d.ts +5 -88
- package/resources/resources.d.ts.map +1 -1
- package/resources/resources.js +5 -81
- package/resources/resources.js.map +1 -1
- package/resources/runtime-definition.d.ts +0 -7
- package/resources/runtime-definition.d.ts.map +1 -1
- package/resources/runtime-definition.js +2 -57
- package/resources/runtime-definition.js.map +1 -1
- package/resources/runtime-matrix-definition.d.ts +0 -36
- package/resources/runtime-matrix-definition.d.ts.map +1 -1
- package/run/capability-policy-snapshots.d.ts +0 -19
- package/run/capability-policy-snapshots.d.ts.map +1 -1
- package/run/capability-policy.js +10 -5
- package/run/capability-policy.js.map +1 -1
- package/run/collected-run-plan.js.map +1 -1
- package/run/command-line-command-namespace.d.ts +0 -5
- package/run/command-line-command-namespace.d.ts.map +1 -1
- package/run/command-line-command.d.ts +1 -4
- package/run/command-line-command.d.ts.map +1 -1
- package/run/command-line-runner.d.ts +0 -2
- package/run/command-line-runner.d.ts.map +1 -1
- package/run/coverage-loaded-sources.js +112 -0
- package/run/coverage-loaded-sources.js.map +1 -0
- package/run/coverage-native-data.js +18 -0
- package/run/coverage-native-data.js.map +1 -0
- package/run/coverage-paths.js +45 -4
- package/run/coverage-paths.js.map +1 -1
- package/run/coverage-reporting.js +37 -123
- package/run/coverage-reporting.js.map +1 -1
- package/run/coverage-run-record.js +50 -0
- package/run/coverage-run-record.js.map +1 -0
- package/run/coverage-runtime-source.js +37 -0
- package/run/coverage-runtime-source.js.map +1 -0
- package/run/coverage-session.js +344 -6
- package/run/coverage-session.js.map +1 -1
- package/run/coverage-source-map.js +125 -0
- package/run/coverage-source-map.js.map +1 -0
- package/run/coverage-source-selection.js +120 -0
- package/run/coverage-source-selection.js.map +1 -0
- package/run/current-process-run-orchestrator.d.ts +1 -5
- package/run/current-process-run-orchestrator.d.ts.map +1 -1
- package/run/duration-history.d.ts +0 -30
- package/run/duration-history.d.ts.map +1 -1
- package/run/duration-history.js +1 -0
- package/run/duration-history.js.map +1 -1
- package/run/node-run-execution.js +25 -0
- package/run/node-run-execution.js.map +1 -0
- package/run/node-runtime-state-store.js +38 -0
- package/run/node-runtime-state-store.js.map +1 -0
- package/run/node-worker-pool-factory.js +0 -31
- package/run/node-worker-pool-factory.js.map +1 -1
- package/run/path-containment.js +6 -1
- package/run/path-containment.js.map +1 -1
- package/run/permission-denial-runtime-policy.js +21 -13
- package/run/permission-denial-runtime-policy.js.map +1 -1
- package/run/placement-trace.d.ts +0 -18
- package/run/placement-trace.d.ts.map +1 -1
- package/run/recorded-coverage-run.js +45 -0
- package/run/recorded-coverage-run.js.map +1 -0
- package/run/recorded-coverage-session.js +50 -0
- package/run/recorded-coverage-session.js.map +1 -0
- package/run/resource-lifecycle-composition.d.ts +0 -3
- package/run/resource-lifecycle-composition.d.ts.map +1 -1
- package/run/resource-lifecycle-composition.js +1 -14
- package/run/resource-lifecycle-composition.js.map +1 -1
- package/run/resource-lifecycle-session-acquirer.js +11 -6
- package/run/resource-lifecycle-session-acquirer.js.map +1 -1
- package/run/resource-lifecycle-state.d.ts +4 -5
- package/run/resource-lifecycle-state.d.ts.map +1 -1
- package/run/resource-lifecycle-state.js +9 -3
- package/run/resource-lifecycle-state.js.map +1 -1
- package/run/resource-lifecycle.js +36 -10
- package/run/resource-lifecycle.js.map +1 -1
- package/run/resource-usage.js.map +1 -1
- package/run/retry-artifact-retention.js +37 -0
- package/run/retry-artifact-retention.js.map +1 -0
- package/run/run-collection-source.d.ts +1 -5
- package/run/run-collection-source.d.ts.map +1 -1
- package/run/run-config-schema.d.ts +25 -4
- package/run/run-config-schema.d.ts.map +1 -1
- package/run/run-config-schema.js +7 -0
- package/run/run-config-schema.js.map +1 -1
- package/run/run-config.d.ts +3 -3
- package/run/run-config.d.ts.map +1 -1
- package/run/run-config.js +4 -0
- package/run/run-config.js.map +1 -1
- package/run/run-coverage.js +5 -2
- package/run/run-coverage.js.map +1 -1
- package/run/run-discovery-types.d.ts +0 -14
- package/run/run-discovery-types.d.ts.map +1 -1
- package/run/run-engine-primitives.d.ts +11 -0
- package/run/run-engine-primitives.d.ts.map +1 -0
- package/run/run-engine-selection.d.ts +0 -10
- package/run/run-engine-selection.d.ts.map +1 -1
- package/run/run-errors.d.ts +0 -2
- package/run/run-errors.d.ts.map +1 -1
- package/run/run-errors.js +1 -0
- package/run/run-errors.js.map +1 -1
- package/run/run-execution-config.d.ts +5 -0
- package/run/run-execution-config.d.ts.map +1 -1
- package/run/run-facts.js +2 -0
- package/run/run-facts.js.map +1 -1
- package/run/run-if-main-options.d.ts +0 -7
- package/run/run-if-main-options.d.ts.map +1 -1
- package/run/run-if-main-profile.d.ts +0 -1
- package/run/run-if-main-profile.d.ts.map +1 -1
- package/run/run-if-main.d.ts +0 -1
- package/run/run-if-main.d.ts.map +1 -1
- package/run/run-isolated-command.js +2 -0
- package/run/run-isolated-command.js.map +1 -1
- package/run/run-local-command.js +8 -82
- package/run/run-local-command.js.map +1 -1
- package/run/run-local-coverage.js +72 -0
- package/run/run-local-coverage.js.map +1 -0
- package/run/run-local-execution.js +1 -0
- package/run/run-local-execution.js.map +1 -1
- package/run/run-local-resolution.js +6 -3
- package/run/run-local-resolution.js.map +1 -1
- package/run/run-orchestrator-dependencies.d.ts +2 -7
- package/run/run-orchestrator-dependencies.d.ts.map +1 -1
- package/run/run-orchestrator.d.ts +0 -8
- package/run/run-orchestrator.d.ts.map +1 -1
- package/run/run-orchestrator.entry-point.d.ts +1 -1
- package/run/run-orchestrator.entry-point.d.ts.map +1 -1
- package/run/run-orchestrator.js +6 -18
- package/run/run-orchestrator.js.map +1 -1
- package/run/run-record-error.js +26 -0
- package/run/run-record-error.js.map +1 -0
- package/run/run-record-input.js +34 -0
- package/run/run-record-input.js.map +1 -0
- package/run/run-record-outcomes.d.ts +46 -0
- package/run/run-record-outcomes.d.ts.map +1 -0
- package/run/run-record-result.js +58 -0
- package/run/run-record-result.js.map +1 -0
- package/run/run-record-storage.js +51 -0
- package/run/run-record-storage.js.map +1 -0
- package/run/run-record-types.d.ts +73 -0
- package/run/run-record-types.d.ts.map +1 -0
- package/run/run-record-versions.js +51 -0
- package/run/run-record-versions.js.map +1 -0
- package/run/run-record.js +48 -0
- package/run/run-record.js.map +1 -0
- package/run/run-result-reporting.js +16 -0
- package/run/run-result-reporting.js.map +1 -0
- package/run/run-selection-filters.d.ts +2 -11
- package/run/run-selection-filters.d.ts.map +1 -1
- package/run/run-supervised-finalization.js +8 -0
- package/run/run-supervised-finalization.js.map +1 -0
- package/run/run-supervised-process.js +34 -33
- package/run/run-supervised-process.js.map +1 -1
- package/run/run-support.js +17 -8
- package/run/run-support.js.map +1 -1
- package/run/run-test-modules.d.ts +0 -4
- package/run/run-test-modules.d.ts.map +1 -1
- package/run/run-timing-collection.d.ts +0 -21
- package/run/run-timing-collection.d.ts.map +1 -1
- package/run/run-types.d.ts +4 -2
- package/run/run-types.d.ts.map +1 -1
- package/run/run-types.js.map +1 -1
- package/run/run.d.ts +0 -3
- package/run/run.d.ts.map +1 -1
- package/run/supervised-child-execution.js +38 -0
- package/run/supervised-child-execution.js.map +1 -0
- package/run/supervised-child-process.d.ts +1 -53
- package/run/supervised-child-process.d.ts.map +1 -1
- package/run/supervised-child-process.js +1 -5
- package/run/supervised-child-process.js.map +1 -1
- package/run/supervised-child-test-plan.js +2 -0
- package/run/supervised-child-test-plan.js.map +1 -1
- package/run/supervised-child.js +5 -36
- package/run/supervised-child.js.map +1 -1
- package/run/supervised-output-capture.js +66 -0
- package/run/supervised-output-capture.js.map +1 -0
- package/run/supervised-protocol.js.map +1 -1
- package/run/supervised-run-collection.js +3 -1
- package/run/supervised-run-collection.js.map +1 -1
- package/run/supervised-run-resource-policy.js +12 -1
- package/run/supervised-run-resource-policy.js.map +1 -1
- package/run/supervised-run-runtime.js +16 -27
- package/run/supervised-run-runtime.js.map +1 -1
- package/run/supervised-run-state.js +64 -81
- package/run/supervised-run-state.js.map +1 -1
- package/run/supervised-run.js +3 -1
- package/run/supervised-run.js.map +1 -1
- package/run/worker-pool-collection.js +1 -0
- package/run/worker-pool-collection.js.map +1 -1
- package/run/worker-pool-command.js +1 -0
- package/run/worker-pool-command.js.map +1 -1
- package/run/worker-pool-execution.js +2 -1
- package/run/worker-pool-execution.js.map +1 -1
- package/run/worker-pool-hedged-arbitration.js +4 -0
- package/run/worker-pool-hedged-arbitration.js.map +1 -1
- package/run/worker-pool-host-process.js.map +1 -1
- package/run/worker-pool-host-protocol.js.map +1 -1
- package/run/worker-pool-output.js +1 -1
- package/run/worker-pool-output.js.map +1 -1
- package/run/worker-pool-protocol.js.map +1 -1
- package/run/worker-pool-resource-lifecycle-execution.js +1 -0
- package/run/worker-pool-resource-lifecycle-execution.js.map +1 -1
- package/run/worker-pool-resource-tracking.js +2 -2
- package/run/worker-pool-resource-tracking.js.map +1 -1
- package/run/worker-pool-results.js +7 -9
- package/run/worker-pool-results.js.map +1 -1
- package/run/worker-pool-run.js +3 -9
- package/run/worker-pool-run.js.map +1 -1
- package/run/worker-pool-task-events.js +7 -2
- package/run/worker-pool-task-events.js.map +1 -1
- package/run/worker-pool-warm-lane-affinity.d.ts +0 -11
- package/run/worker-pool-warm-lane-affinity.d.ts.map +1 -1
- package/run/worker-pool-worker-plan.js +1 -0
- package/run/worker-pool-worker-plan.js.map +1 -1
- package/run/worker-pool-worker-resources.js +1 -0
- package/run/worker-pool-worker-resources.js.map +1 -1
- package/run/worker-pool-worker.js +2 -1
- package/run/worker-pool-worker.js.map +1 -1
- package/sbom.cdx.json +66 -15
- package/transcript/http-transcript.js +3 -0
- package/transcript/http-transcript.js.map +1 -0
- package/transcript/transcript-store.d.ts +25 -0
- package/transcript/transcript-store.d.ts.map +1 -0
- package/transcript/transcript-store.js +73 -0
- package/transcript/transcript-store.js.map +1 -0
- package/assertion-protocol/assertion-evaluation.d.ts +0 -13
- package/assertion-protocol/assertion-evaluation.d.ts.map +0 -1
- package/assertion-protocol/evaluation.d.ts +0 -32
- package/assertion-protocol/evaluation.d.ts.map +0 -1
- package/assertion-protocol/source-location-forwarding.d.ts +0 -4
- package/assertion-protocol/source-location-forwarding.d.ts.map +0 -1
- package/assertion-protocol/source-location.d.ts +0 -8
- package/assertion-protocol/source-location.d.ts.map +0 -1
- package/compare/comparison-result.d.ts +0 -25
- package/compare/comparison-result.d.ts.map +0 -1
- package/compare/comparison.d.ts +0 -12
- package/compare/comparison.d.ts.map +0 -1
- package/engine/async-leak-diagnostics.d.ts +0 -27
- package/engine/async-leak-diagnostics.d.ts.map +0 -1
- package/engine/custom-assertion-recording.d.ts +0 -33
- package/engine/custom-assertion-recording.d.ts.map +0 -1
- package/engine/execution-async-leak-policy.d.ts +0 -24
- package/engine/execution-async-leak-policy.d.ts.map +0 -1
- package/engine/execution-supervision-state.d.ts +0 -30
- package/engine/execution-supervision-state.d.ts.map +0 -1
- package/engine/reporter-disposal.d.ts +0 -6
- package/engine/reporter-disposal.d.ts.map +0 -1
- package/packages/engine/assertion-protocol.entry-point.d.ts +0 -10
- package/packages/engine/assertion-protocol.entry-point.d.ts.map +0 -1
- package/packages/engine/assertion-protocol.entry-point.js +0 -5
- package/packages/engine/assertion-protocol.entry-point.js.map +0 -1
- package/packages/engine/engine.entry-point.d.ts +0 -58
- package/packages/engine/engine.entry-point.d.ts.map +0 -1
- package/packages/engine/engine.entry-point.js +0 -75
- package/packages/engine/engine.entry-point.js.map +0 -1
- package/resources/resource-definition-brand.d.ts +0 -2
- package/resources/resource-definition-brand.d.ts.map +0 -1
- package/resources/resource-graph.d.ts +0 -24
- package/resources/resource-graph.d.ts.map +0 -1
- package/resources/resource-scenario-binding.d.ts +0 -37
- package/resources/resource-scenario-binding.d.ts.map +0 -1
- package/run/duration-history-schema.d.ts +0 -251
- package/run/duration-history-schema.d.ts.map +0 -1
- package/run/supervised-run-state.d.ts +0 -44
- package/run/supervised-run-state.d.ts.map +0 -1
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { isPathInside } from "./path-containment.js";
|
|
5
|
+
import { inspectCoverageSource, isSupportedCoverageSource } from "./coverage-runtime-source.js";
|
|
6
|
+
import { normalizedCoverageSourceMap, readCoverageSourceMap } from "./coverage-source-map.js";
|
|
7
|
+
function projectScriptPath(url, projectRoot) {
|
|
8
|
+
if (!url.startsWith('file:')) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
const filePath = fileURLToPath(url);
|
|
12
|
+
const insideProject = isPathInside(projectRoot, filePath) && !filePath.split(path.sep).includes('node_modules');
|
|
13
|
+
return insideProject && isSupportedCoverageSource(filePath) ? filePath : null;
|
|
14
|
+
}
|
|
15
|
+
async function readLoadedEntry(url, cached, projectRoot) {
|
|
16
|
+
const filePath = projectScriptPath(url, projectRoot);
|
|
17
|
+
if (filePath === null) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const source = await readFile(filePath, 'utf8');
|
|
21
|
+
const map = await readCoverageSourceMap({ cached, source, url });
|
|
22
|
+
return { filePath, map, source, url };
|
|
23
|
+
}
|
|
24
|
+
async function loadedCoverageEntries(request) {
|
|
25
|
+
const entries = new Map();
|
|
26
|
+
for (const batch of request.batches) {
|
|
27
|
+
for (const entry of batch.entries) {
|
|
28
|
+
const loaded = await readLoadedEntry(entry.url, batch.sourceMaps[entry.url], request.projectRoot);
|
|
29
|
+
if (loaded !== null) {
|
|
30
|
+
entries.set(entry.url, loaded);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return Array.from(entries.values());
|
|
35
|
+
}
|
|
36
|
+
function singleOriginalTestFile(entry, excludedFiles) {
|
|
37
|
+
if (!excludedFiles.has(entry.filePath) || entry.map === null) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const originals = entry.map.resolvedSources;
|
|
41
|
+
const original = originals[0] ?? '';
|
|
42
|
+
return originals.length === 1 && original.startsWith('file:') ? fileURLToPath(original) : null;
|
|
43
|
+
}
|
|
44
|
+
function originalTestFiles(entries, excludedFiles) {
|
|
45
|
+
const files = new Set(excludedFiles);
|
|
46
|
+
for (const entry of entries) {
|
|
47
|
+
const original = singleOriginalTestFile(entry, excludedFiles);
|
|
48
|
+
if (original !== null) {
|
|
49
|
+
files.add(original);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return files;
|
|
53
|
+
}
|
|
54
|
+
function selectedOriginalPath(url, request) {
|
|
55
|
+
if (!url.startsWith('file:')) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
const filePath = fileURLToPath(url);
|
|
59
|
+
return request.excludedFiles.has(filePath) || !request.includeSource(filePath) ? null : filePath;
|
|
60
|
+
}
|
|
61
|
+
async function originalSourceContent(original, request) {
|
|
62
|
+
const filePath = selectedOriginalPath(original.url, request);
|
|
63
|
+
if (filePath === null) {
|
|
64
|
+
return { content: original.content ?? '', filePath: null };
|
|
65
|
+
}
|
|
66
|
+
const content = original.content ?? await readFile(filePath, 'utf8');
|
|
67
|
+
const hasRuntime = isSupportedCoverageSource(filePath) && inspectCoverageSource(content, filePath).hasRuntime;
|
|
68
|
+
return { content, filePath: hasRuntime ? filePath : null };
|
|
69
|
+
}
|
|
70
|
+
async function selectLoadedEntry(entry, request) {
|
|
71
|
+
if (entry.map === null) {
|
|
72
|
+
return request.includeSource(entry.filePath) && inspectCoverageSource(entry.source, entry.filePath).hasRuntime
|
|
73
|
+
? { map: null, sources: [entry.filePath], url: entry.url }
|
|
74
|
+
: null;
|
|
75
|
+
}
|
|
76
|
+
const { map } = entry;
|
|
77
|
+
const originals = await Promise.all(map.resolvedSources.map(async function resolveOriginal(url, index) {
|
|
78
|
+
return await originalSourceContent({ content: map.sourcesContent?.[index] ?? null, url }, request);
|
|
79
|
+
}));
|
|
80
|
+
return {
|
|
81
|
+
map: normalizedCoverageSourceMap(map, originals.map(function originalContent(original) {
|
|
82
|
+
return original.content;
|
|
83
|
+
})),
|
|
84
|
+
sources: originals.flatMap(function executableOriginal(original) {
|
|
85
|
+
return original.filePath === null ? [] : [original.filePath];
|
|
86
|
+
}),
|
|
87
|
+
url: entry.url
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export async function prepareLoadedCoverageSources(request) {
|
|
91
|
+
const loaded = await loadedCoverageEntries(request);
|
|
92
|
+
const excludedFiles = originalTestFiles(loaded, request.excludedFiles);
|
|
93
|
+
const selected = await Promise.all(loaded.map(async function selectEntry(entry) {
|
|
94
|
+
return await selectLoadedEntry(entry, { ...request, excludedFiles });
|
|
95
|
+
}));
|
|
96
|
+
const retained = selected.filter(function isSelected(entry) {
|
|
97
|
+
return entry !== null;
|
|
98
|
+
});
|
|
99
|
+
return {
|
|
100
|
+
entries: new Set(retained.map(function entryUrl(entry) {
|
|
101
|
+
return entry.url;
|
|
102
|
+
})),
|
|
103
|
+
excludedFiles,
|
|
104
|
+
maps: new Map(retained.flatMap(function entryMap(entry) {
|
|
105
|
+
return entry.map === null ? [] : [[entry.url, entry.map]];
|
|
106
|
+
})),
|
|
107
|
+
sources: new Set(retained.flatMap(function entrySources(entry) {
|
|
108
|
+
return entry.sources;
|
|
109
|
+
}))
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=coverage-loaded-sources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage-loaded-sources.js","sourceRoot":"","sources":["../../../../source/run/coverage-loaded-sources.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAChG,OAAO,EAAE,2BAA2B,EAAE,qBAAqB,EAAoB,MAAM,0BAA0B,CAAC;AAqBhH,SAAS,iBAAiB,CAAC,GAAW,EAAE,WAAmB;IACvD,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,MAAM,QAAQ,GAAG,aAAa,CAAC,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G,QAAQ,CAAC,MAAM,CAAC,SAAS,UAAU,CAAC,KAAK;QACtD,OAAO,KAAK,KAAK,IAAI,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,OAAO;QACH,OAAO,EAAE,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,QAAQ,CAAC,KAAK;YACjD,OAAO,KAAK,CAAC,GAAG,CAAC;QACrB,CAAC,CAAC,CAAC;QACH,aAAa;QACb,IAAI,EAAE,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,QAAQ,CAAC,KAAK;YAClD,OAAO,KAAK,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAE,CAAE,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAW,CAAE,CAAC;QAC3E,CAAC,CAAC,CAAC;QACH,OAAO,EAAE,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,YAAY,CAAC,KAAK;YACzD,OAAO,KAAK,CAAC,OAAO,CAAC;QACzB,CAAC,CAAC,CAAC;KACN,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { readFile, readdir } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { z } from 'zod/v4';
|
|
4
|
+
const nativeDataSchema = z.object({
|
|
5
|
+
result: z.array(z.looseObject({ url: z.string() })),
|
|
6
|
+
'source-map-cache': z.record(z.string(), z.unknown()).default({})
|
|
7
|
+
});
|
|
8
|
+
export async function readNativeCoverageBatches(directory) {
|
|
9
|
+
const entries = await readdir(directory);
|
|
10
|
+
const files = entries.filter(function isNativeCoverage(file) {
|
|
11
|
+
return file.endsWith('.json') && !file.startsWith('source-');
|
|
12
|
+
});
|
|
13
|
+
return await Promise.all(files.map(async function readNativeCoverage(file) {
|
|
14
|
+
const data = nativeDataSchema.parse(JSON.parse(await readFile(path.join(directory, file), 'utf8')));
|
|
15
|
+
return { entries: data.result, sourceMaps: data['source-map-cache'] };
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=coverage-native-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage-native-data.js","sourceRoot":"","sources":["../../../../source/run/coverage-native-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAE3B,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACnD,kBAAkB,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC;CACpE,CAAC,CAAC;AAOH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAAC,SAAiB;IAC7D,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,SAAS,CAAC,CAAC;IACzC,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,SAAS,gBAAgB,CAAC,IAAI;QACvD,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,UAAU,kBAAkB,CAAC,IAAI;QACrE,MAAM,IAAI,GAAG,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QAEpG,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC;IAC1E,CAAC,CAAC,CAAC,CAAC;AACR,CAAC"}
|
package/run/coverage-paths.js
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
|
-
import 'node:fs/promises';
|
|
2
|
-
import 'node:path';
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { mkdir, realpath } from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { isPathInside } from "./path-containment.js";
|
|
4
|
+
async function nearestExistingPath(candidate) {
|
|
5
|
+
try {
|
|
6
|
+
return await realpath(candidate);
|
|
7
|
+
}
|
|
8
|
+
catch (error) {
|
|
9
|
+
const parentPath = path.dirname(candidate);
|
|
10
|
+
if (parentPath === candidate) {
|
|
11
|
+
throw error;
|
|
12
|
+
}
|
|
13
|
+
return await nearestExistingPath(parentPath);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
async function validateCreatedCoverageDirectory(projectRoot, coverageDirectory) {
|
|
17
|
+
if (!isPathInside(projectRoot, await realpath(coverageDirectory))) {
|
|
18
|
+
throw new Error('Coverage output directory resolves outside the project root.');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
async function assertCoveragePathInsideProject(projectRoot, coverageDirectory) {
|
|
22
|
+
const existingAncestor = await nearestExistingPath(coverageDirectory);
|
|
23
|
+
if ([coverageDirectory, existingAncestor].some(function escapesProject(candidate) {
|
|
24
|
+
return !isPathInside(projectRoot, candidate);
|
|
25
|
+
})) {
|
|
26
|
+
throw new Error('Coverage output directory must remain inside the project root.');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export function resolveCoveragePaths(request) {
|
|
30
|
+
const projectRoot = path.resolve(request.projectRoot);
|
|
31
|
+
const runtimeStateRoot = path.resolve(projectRoot, request.runtimeStateDir);
|
|
32
|
+
const coverageDirectory = request.coverage.outputDirectory ??
|
|
33
|
+
path.join(runtimeStateRoot, 'runs', request.runId, 'coverage');
|
|
34
|
+
const rawDataDirectory = request.coverage.outputDirectory === null
|
|
35
|
+
? path.join(coverageDirectory, 'raw')
|
|
36
|
+
: path.join(coverageDirectory, 'raw', request.runId);
|
|
37
|
+
return { coverageDirectory, projectRoot, rawDataDirectory };
|
|
38
|
+
}
|
|
39
|
+
export async function createCoveragePaths(paths) {
|
|
40
|
+
const projectRoot = await realpath(paths.projectRoot);
|
|
41
|
+
await assertCoveragePathInsideProject(projectRoot, paths.coverageDirectory);
|
|
42
|
+
await mkdir(paths.rawDataDirectory, { recursive: true });
|
|
43
|
+
await validateCreatedCoverageDirectory(projectRoot, paths.coverageDirectory);
|
|
44
|
+
return { ...paths, projectRoot };
|
|
45
|
+
}
|
|
5
46
|
//# sourceMappingURL=coverage-paths.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coverage-paths.js","sourceRoot":"","sources":["../../../../source/run/coverage-paths.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"coverage-paths.js","sourceRoot":"","sources":["../../../../source/run/coverage-paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAgBrD,KAAK,UAAU,mBAAmB,CAAC,SAAiB;IAChD,IAAI,CAAC;QACD,OAAO,MAAM,QAAQ,CAAC,SAAS,CAAC,CAAC;IACrC,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACtB,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAE3C,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM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AI,CAAC,iBAAiB,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAEzD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC;AAChE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,KAAoB;IAC1D,MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAEtD,MAAM,+BAA+B,CAAC,WAAW,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAC5E,MAAM,KAAK,CAAC,KAAK,CAAC,gBAAgB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,MAAM,gCAAgC,CAAC,WAAW,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAE7E,OAAO,EAAE,GAAG,KAAK,EAAE,WAAW,EAAE,CAAC;AACrC,CAAC"}
|
|
@@ -1,116 +1,6 @@
|
|
|
1
|
-
import { glob, readFile } from 'node:fs/promises';
|
|
2
1
|
import path from 'node:path';
|
|
3
|
-
import { fileURLToPath } from 'node:url';
|
|
4
2
|
import { CoverageReport } from 'monocart-coverage-reports';
|
|
5
|
-
import {
|
|
6
|
-
import { isPathInside } from "./path-containment.js";
|
|
7
|
-
const supportedSourceExtensions = new Set(['.cjs', '.cts', '.js', '.mjs', '.mts', '.ts']);
|
|
8
|
-
const typeScriptSourceExtensions = new Set(['.cts', '.mts', '.ts']);
|
|
9
|
-
function entryFilePath(url) {
|
|
10
|
-
if (!url.startsWith('file:')) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
return path.resolve(fileURLToPath(url));
|
|
14
|
-
}
|
|
15
|
-
function sourceFilePath(sourcePath, projectRoot) {
|
|
16
|
-
return path.resolve(projectRoot, sourcePath);
|
|
17
|
-
}
|
|
18
|
-
function includedProjectFile(filePath, projectRoot, excludedFiles) {
|
|
19
|
-
const resolvedPath = path.resolve(filePath);
|
|
20
|
-
return isPathInside(projectRoot, resolvedPath) &&
|
|
21
|
-
!resolvedPath.split(path.sep).includes('node_modules') &&
|
|
22
|
-
!excludedFiles.has(resolvedPath);
|
|
23
|
-
}
|
|
24
|
-
function matchesSourcePatterns(filePath, projectRoot, include, exclude) {
|
|
25
|
-
const relativePath = path.relative(projectRoot, filePath).split(path.sep).join('/');
|
|
26
|
-
return include.some(function matchesInclude(pattern) {
|
|
27
|
-
return path.matchesGlob(relativePath, pattern);
|
|
28
|
-
}) && exclude.every(function matchesExclude(pattern) {
|
|
29
|
-
return !path.matchesGlob(relativePath, pattern);
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
function includedSourceFile(filePath, request) {
|
|
33
|
-
if (!includedProjectFile(filePath, request.projectRoot, request.sourceScope.excludedFiles)) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
if (request.sourceScope.mode === 'all') {
|
|
37
|
-
return matchesSourcePatterns(filePath, request.projectRoot, request.sourceScope.include, request.sourceScope.exclude);
|
|
38
|
-
}
|
|
39
|
-
return request.sourceScope.exclude.every(function matchesExclude(pattern) {
|
|
40
|
-
const relativePath = path.relative(request.projectRoot, filePath).split(path.sep).join('/');
|
|
41
|
-
return !path.matchesGlob(relativePath, pattern);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
function entryIncluded(entry, request) {
|
|
45
|
-
const filePath = entryFilePath(entry.url);
|
|
46
|
-
return filePath !== null && includedSourceFile(filePath, request);
|
|
47
|
-
}
|
|
48
|
-
function sourceIncluded(sourcePath, request) {
|
|
49
|
-
return includedSourceFile(sourceFilePath(sourcePath, request.projectRoot), request);
|
|
50
|
-
}
|
|
51
|
-
function transformedTypeScript(source, filePath) {
|
|
52
|
-
const result = transform(source, {
|
|
53
|
-
filePath,
|
|
54
|
-
sourceMapOptions: {
|
|
55
|
-
compiledFilename: filePath.replace(/\.[cm]?ts$/u, '.js')
|
|
56
|
-
},
|
|
57
|
-
transforms: ['typescript']
|
|
58
|
-
});
|
|
59
|
-
return {
|
|
60
|
-
source: result.code,
|
|
61
|
-
sourceMap: { ...result.sourceMap, sourcesContent: [source] }
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function hasRuntimeTypeScript(source) {
|
|
65
|
-
return source
|
|
66
|
-
.replace(/^export \{\};?\s*$/mu, '')
|
|
67
|
-
.replace(/^\/\/# sourceMappingURL=.*$/mu, '')
|
|
68
|
-
.trim() !== '';
|
|
69
|
-
}
|
|
70
|
-
async function isRuntimeSourceFile(filePath, request) {
|
|
71
|
-
const extension = path.extname(filePath);
|
|
72
|
-
if (!supportedSourceExtensions.has(extension) || !includedSourceFile(filePath, request)) {
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
if (!typeScriptSourceExtensions.has(extension)) {
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
const transformed = transformedTypeScript(await readFile(filePath, 'utf8'), filePath);
|
|
79
|
-
return hasRuntimeTypeScript(transformed.source);
|
|
80
|
-
}
|
|
81
|
-
async function allRuntimeFiles(request, sourceScope) {
|
|
82
|
-
const runtimeFiles = new Set();
|
|
83
|
-
const matchedFiles = glob(sourceScope.include, {
|
|
84
|
-
cwd: request.projectRoot,
|
|
85
|
-
exclude: sourceScope.exclude
|
|
86
|
-
});
|
|
87
|
-
for await (const relativePath of matchedFiles) {
|
|
88
|
-
const filePath = path.resolve(request.projectRoot, relativePath);
|
|
89
|
-
if (await isRuntimeSourceFile(filePath, request)) {
|
|
90
|
-
runtimeFiles.add(filePath);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return runtimeFiles;
|
|
94
|
-
}
|
|
95
|
-
async function allFilesOptions(request) {
|
|
96
|
-
const { sourceScope } = request;
|
|
97
|
-
if (sourceScope.mode === 'loaded') {
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
const runtimeFiles = await allRuntimeFiles(request, sourceScope);
|
|
101
|
-
return {
|
|
102
|
-
dir: request.projectRoot,
|
|
103
|
-
filter(filePath) {
|
|
104
|
-
const resolvedPath = path.resolve(filePath);
|
|
105
|
-
return runtimeFiles.has(resolvedPath);
|
|
106
|
-
},
|
|
107
|
-
async transformer(entry) {
|
|
108
|
-
if (typeScriptSourceExtensions.has(path.extname(entry.url))) {
|
|
109
|
-
Object.assign(entry, transformedTypeScript(entry.source, entry.url));
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
}
|
|
3
|
+
import { prepareCoverageSources } from "./coverage-source-selection.js";
|
|
114
4
|
function coverageReportBackend(output, relativePath, projectRoot) {
|
|
115
5
|
if (output === 'html') {
|
|
116
6
|
return ['html', { subdir: 'html' }];
|
|
@@ -151,32 +41,56 @@ function metric(results, name) {
|
|
|
151
41
|
const value = results.summary[name];
|
|
152
42
|
return { covered: value.covered, total: value.total };
|
|
153
43
|
}
|
|
44
|
+
async function initializeFilteredCoverage(report, batches) {
|
|
45
|
+
if (report.hasCache()) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const batch = batches.find(function hasNativeEntries(candidate) {
|
|
49
|
+
return candidate.entries.length > 0;
|
|
50
|
+
});
|
|
51
|
+
if (batch === undefined) {
|
|
52
|
+
throw new Error('Coverage collection produced no native V8 data.');
|
|
53
|
+
}
|
|
54
|
+
await report.add(Array.from(batch.entries));
|
|
55
|
+
}
|
|
56
|
+
function hasExecutableCoverage(results) {
|
|
57
|
+
return ['branches', 'functions', 'lines'].some(function hasExecutableMetric(name) {
|
|
58
|
+
return results.summary[name].total > 0;
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
async function generateExecutableCoverageReport(report) {
|
|
62
|
+
const results = await report.generate();
|
|
63
|
+
if (results === undefined) {
|
|
64
|
+
throw new Error('Coverage backend produced no result.');
|
|
65
|
+
}
|
|
66
|
+
if (!hasExecutableCoverage(results)) {
|
|
67
|
+
throw new Error('Coverage source selection contains no executable sources.');
|
|
68
|
+
}
|
|
69
|
+
return results;
|
|
70
|
+
}
|
|
154
71
|
export async function generateCoverageReports(request) {
|
|
155
|
-
const
|
|
72
|
+
const sources = await prepareCoverageSources(request);
|
|
156
73
|
const configuredReports = configuredCoverageReports(request);
|
|
157
74
|
const report = new CoverageReport({
|
|
158
|
-
...all === null ? {} : { all },
|
|
75
|
+
...sources.all === null ? {} : { all: sources.all },
|
|
159
76
|
baseDir: request.projectRoot,
|
|
160
77
|
clean: false,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
},
|
|
78
|
+
cleanCache: true,
|
|
79
|
+
entryFilter: sources.entryIncluded,
|
|
164
80
|
logging: 'off',
|
|
81
|
+
onEntry: sources.onEntry,
|
|
165
82
|
outputDir: request.coverageDirectory,
|
|
166
83
|
reports: configuredReports.length === 0
|
|
167
84
|
? [['none']]
|
|
168
85
|
: configuredReports.map(function backendReport(configuredReport) {
|
|
169
86
|
return configuredReport.backend;
|
|
170
87
|
}),
|
|
171
|
-
sourceFilter
|
|
172
|
-
|
|
173
|
-
}
|
|
88
|
+
sourceFilter: sources.sourceIncluded,
|
|
89
|
+
sourcePath: sources.sourcePath
|
|
174
90
|
});
|
|
175
91
|
await report.addFromDir(request.rawDataDirectory);
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
throw new Error('Coverage backend produced no result.');
|
|
179
|
-
}
|
|
92
|
+
await initializeFilteredCoverage(report, sources.batches);
|
|
93
|
+
const results = await generateExecutableCoverageReport(report);
|
|
180
94
|
return {
|
|
181
95
|
reports: configuredReports.map(function reportFile(configuredReport) {
|
|
182
96
|
return configuredReport.file;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coverage-reporting.js","sourceRoot":"","sources":["../../../../source/run/coverage-reporting.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"coverage-reporting.js","sourceRoot":"","sources":["../../../../source/run/coverage-reporting.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACH,cAAc,EAGjB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AC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAClD,MAAM,0BAA0B,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1D,MAAM,OAAO,GAAG,MAAM,gCAAgC,CAAC,MAAM,CAAC,CAAC;IAE/D,OAAO;QACH,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,SAAS,UAAU,CAAC,gBAAgB;YAC/D,OAAO,gBAAgB,CAAC,IAAI,CAAC;QACjC,CAAC,CAAC;QACF,OAAO,EAAE;YACL,QAAQ,EAAE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC;YACrC,SAAS,EAAE,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC;YACvC,KAAK,EAAE,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC;SAClC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { ulid } from 'ulid';
|
|
3
|
+
import { resolveCoveragePaths } from "./coverage-paths.js";
|
|
4
|
+
import { microtestCoveragePolicy } from "./run-coverage.js";
|
|
5
|
+
import { createRunRecordSession } from "./run-record.js";
|
|
6
|
+
import { runRecordVersions } from "./run-record-versions.js";
|
|
7
|
+
function relativePath(projectRoot, directory) {
|
|
8
|
+
return path.relative(projectRoot, directory).split(path.sep).join('/');
|
|
9
|
+
}
|
|
10
|
+
export async function createCoverageRunRecord(cwd, input, dependencies, timing) {
|
|
11
|
+
const record = createRunRecordSession(cwd, input, {
|
|
12
|
+
createId: ulid,
|
|
13
|
+
node: dependencies.node,
|
|
14
|
+
store: dependencies.runtimeStateStore,
|
|
15
|
+
versions: await runRecordVersions(input.engine, dependencies.node.version),
|
|
16
|
+
wallClock: dependencies.wallClock
|
|
17
|
+
});
|
|
18
|
+
const coverage = microtestCoveragePolicy(input.profile);
|
|
19
|
+
const paths = resolveCoveragePaths({
|
|
20
|
+
coverage,
|
|
21
|
+
projectRoot: input.projectRoot,
|
|
22
|
+
runId: record.id,
|
|
23
|
+
runtimeStateDir: input.config.runtimeStateDir
|
|
24
|
+
});
|
|
25
|
+
return {
|
|
26
|
+
record,
|
|
27
|
+
sessionRequest: {
|
|
28
|
+
coverage,
|
|
29
|
+
paths,
|
|
30
|
+
processModel: input.profile.execution.processModel === 'in-process' ? 'in-process' : 'supervised-process',
|
|
31
|
+
testFiles: input.files.map(function testFilePath(file) {
|
|
32
|
+
return file.file;
|
|
33
|
+
}),
|
|
34
|
+
timing
|
|
35
|
+
},
|
|
36
|
+
async start() {
|
|
37
|
+
await record.start({
|
|
38
|
+
directory: relativePath(input.projectRoot, paths.coverageDirectory),
|
|
39
|
+
policy: {
|
|
40
|
+
...coverage,
|
|
41
|
+
outputDirectory: coverage.outputDirectory === null
|
|
42
|
+
? null
|
|
43
|
+
: relativePath(input.projectRoot, coverage.outputDirectory)
|
|
44
|
+
},
|
|
45
|
+
rawDataDirectory: relativePath(input.projectRoot, paths.rawDataDirectory)
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=coverage-run-record.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage-run-record.js","sourceRoot":"","sources":["../../../../source/run/coverage-run-record.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAG5D,OAAO,EAAE,sBAAsB,EAAyB,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAS7D,SAAS,YAAY,CAAC,WAAmB,EAAE,SAAiB;IACxD,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,KA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AM,EAAE;oBACJ,GAAG,QAAQ;oBACX,eAAe,EAAE,QAAQ,CAAC,eAAe,KAAK,IAAI;wBAC9C,CAAC,CAAC,IAAI;wBACN,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,WAAW,EAAE,QAAQ,CAAC,eAAe,CAAC;iBAClE;gBACD,gBAAgB,EAAE,YAAY,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,gBAAgB,CAAC;aAC5E,CAAC,CAAC;QACP,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { parse } from 'acorn';
|
|
3
|
+
import { transform } from 'sucrase';
|
|
4
|
+
const typeScriptExtensions = new Set(['.cts', '.mts', '.ts']);
|
|
5
|
+
const sourceExtensions = new Set(['.cjs', '.cts', '.js', '.mjs', '.mts', '.ts']);
|
|
6
|
+
export function transformCoverageSource(source, filePath) {
|
|
7
|
+
const result = transform(source, {
|
|
8
|
+
filePath,
|
|
9
|
+
sourceMapOptions: { compiledFilename: filePath.replace(/\.[cm]?ts$/u, '.js') },
|
|
10
|
+
transforms: ['typescript']
|
|
11
|
+
});
|
|
12
|
+
return { source: result.code, sourceMap: { ...result.sourceMap, sourcesContent: [source] } };
|
|
13
|
+
}
|
|
14
|
+
export function isTypeScriptCoverageSource(filePath) {
|
|
15
|
+
return typeScriptExtensions.has(path.extname(filePath));
|
|
16
|
+
}
|
|
17
|
+
export function isSupportedCoverageSource(filePath) {
|
|
18
|
+
return sourceExtensions.has(path.extname(filePath));
|
|
19
|
+
}
|
|
20
|
+
export function inspectCoverageSource(source, filePath) {
|
|
21
|
+
const comments = [];
|
|
22
|
+
const program = parse(isTypeScriptCoverageSource(filePath) ? transformCoverageSource(source, filePath).source : source, {
|
|
23
|
+
allowReturnOutsideFunction: true,
|
|
24
|
+
ecmaVersion: 'latest',
|
|
25
|
+
onComment(block, value) {
|
|
26
|
+
comments.push(block ? `/*${value}*/` : `//${value}`);
|
|
27
|
+
},
|
|
28
|
+
sourceType: 'module'
|
|
29
|
+
});
|
|
30
|
+
const hasRuntime = program.body.some(function executesCode(statement) {
|
|
31
|
+
return statement.type !== 'EmptyStatement' &&
|
|
32
|
+
!(statement.type === 'ExportNamedDeclaration' && statement.declaration === null &&
|
|
33
|
+
statement.specifiers.length === 0 && statement.source === null);
|
|
34
|
+
});
|
|
35
|
+
return { comments, hasRuntime };
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=coverage-runtime-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coverage-runtime-source.js","sourceRoot":"","sources":["../../../../source/run/coverage-runtime-source.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,CAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAE,CAAC,CAAC;AAChE,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAE,CAAC,CAAC;AAWnF,MAAM,UAAU,uBAAuB,CAAC,MAAc,EAAE,QAAgB;IACpE,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE;QAC7B,QAAQ;QACR,gBAAgB,EAAE,EAAE,gBAAgB,EAAE,QAAQ,CAAC,OAAO,CAAC,aAAa,EAAE,KAAK,CAAC,EAAE;QAC9E,UAAU,EAAE,CAAE,YAAY,CAAE;KAC/B,CAAC,CAAC;IAEH,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE,cAAc,EAAE,CAAE,MAAM,CAAE,EAAE,EAAE,CA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