ppef 1.0.0 → 1.1.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 +172 -0
- package/bin/ppef.mjs +20 -0
- package/dist/__tests__/framework-pipeline.integration.test.d.ts +7 -0
- package/dist/__tests__/framework-pipeline.integration.test.d.ts.map +1 -0
- package/dist/__tests__/framework-pipeline.integration.test.js +415 -0
- package/dist/__tests__/framework-pipeline.integration.test.js.map +1 -0
- package/dist/__tests__/index-exports.unit.test.d.ts +8 -0
- package/dist/__tests__/index-exports.unit.test.d.ts.map +1 -0
- package/dist/__tests__/index-exports.unit.test.js +127 -0
- package/dist/__tests__/index-exports.unit.test.js.map +1 -0
- package/dist/__tests__/registry-executor.integration.test.d.ts +5 -0
- package/dist/__tests__/registry-executor.integration.test.d.ts.map +1 -0
- package/dist/__tests__/registry-executor.integration.test.js +352 -0
- package/dist/__tests__/registry-executor.integration.test.js.map +1 -0
- package/dist/__tests__/test-helpers.d.ts +94 -0
- package/dist/__tests__/test-helpers.d.ts.map +1 -0
- package/dist/__tests__/test-helpers.js +271 -0
- package/dist/__tests__/test-helpers.js.map +1 -0
- package/dist/aggregation/__tests__/aggregators.unit.test.d.ts +7 -0
- package/dist/aggregation/__tests__/aggregators.unit.test.d.ts.map +1 -0
- package/dist/aggregation/__tests__/aggregators.unit.test.js +350 -0
- package/dist/aggregation/__tests__/aggregators.unit.test.js.map +1 -0
- package/dist/aggregation/__tests__/pipeline.unit.test.d.ts +7 -0
- package/dist/aggregation/__tests__/pipeline.unit.test.d.ts.map +1 -0
- package/dist/aggregation/__tests__/pipeline.unit.test.js +213 -0
- package/dist/aggregation/__tests__/pipeline.unit.test.js.map +1 -0
- package/dist/aggregation/aggregators.d.ts +63 -0
- package/dist/aggregation/aggregators.d.ts.map +1 -0
- package/dist/aggregation/aggregators.js +228 -0
- package/dist/aggregation/aggregators.js.map +1 -0
- package/dist/aggregation/index.d.ts +8 -0
- package/dist/aggregation/index.d.ts.map +1 -0
- package/dist/aggregation/index.js +8 -0
- package/dist/aggregation/index.js.map +1 -0
- package/dist/aggregation/pipeline.d.ts +38 -0
- package/dist/aggregation/pipeline.d.ts.map +1 -0
- package/dist/aggregation/pipeline.js +198 -0
- package/dist/aggregation/pipeline.js.map +1 -0
- package/dist/claims/__tests__/evaluator.unit.test.d.ts +12 -0
- package/dist/claims/__tests__/evaluator.unit.test.d.ts.map +1 -0
- package/dist/claims/__tests__/evaluator.unit.test.js +801 -0
- package/dist/claims/__tests__/evaluator.unit.test.js.map +1 -0
- package/dist/claims/evaluator.d.ts +33 -0
- package/dist/claims/evaluator.d.ts.map +1 -0
- package/dist/claims/evaluator.js +174 -0
- package/dist/claims/evaluator.js.map +1 -0
- package/dist/claims/index.d.ts +7 -0
- package/dist/claims/index.d.ts.map +1 -0
- package/dist/claims/index.js +7 -0
- package/dist/claims/index.js.map +1 -0
- package/dist/cli/__tests__/aggregate.command.unit.test.d.ts +7 -0
- package/dist/cli/__tests__/aggregate.command.unit.test.d.ts.map +1 -0
- package/dist/cli/__tests__/aggregate.command.unit.test.js +396 -0
- package/dist/cli/__tests__/aggregate.command.unit.test.js.map +1 -0
- package/dist/cli/__tests__/commands.unit.test.d.ts +10 -0
- package/dist/cli/__tests__/commands.unit.test.d.ts.map +1 -0
- package/dist/cli/__tests__/commands.unit.test.js +217 -0
- package/dist/cli/__tests__/commands.unit.test.js.map +1 -0
- package/dist/cli/__tests__/index.unit.test.d.ts +10 -0
- package/dist/cli/__tests__/index.unit.test.d.ts.map +1 -0
- package/dist/cli/__tests__/index.unit.test.js +65 -0
- package/dist/cli/__tests__/index.unit.test.js.map +1 -0
- package/dist/cli/__tests__/logger.unit.test.d.ts +11 -0
- package/dist/cli/__tests__/logger.unit.test.d.ts.map +1 -0
- package/dist/cli/__tests__/logger.unit.test.js +180 -0
- package/dist/cli/__tests__/logger.unit.test.js.map +1 -0
- package/dist/cli/__tests__/module-loader.unit.test.d.ts +11 -0
- package/dist/cli/__tests__/module-loader.unit.test.d.ts.map +1 -0
- package/dist/cli/__tests__/module-loader.unit.test.js +262 -0
- package/dist/cli/__tests__/module-loader.unit.test.js.map +1 -0
- package/dist/cli/__tests__/output-writer.unit.test.d.ts +10 -0
- package/dist/cli/__tests__/output-writer.unit.test.d.ts.map +1 -0
- package/dist/cli/__tests__/output-writer.unit.test.js +216 -0
- package/dist/cli/__tests__/output-writer.unit.test.js.map +1 -0
- package/dist/cli/__tests__/plan.command.unit.test.d.ts +7 -0
- package/dist/cli/__tests__/plan.command.unit.test.d.ts.map +1 -0
- package/dist/cli/__tests__/plan.command.unit.test.js +289 -0
- package/dist/cli/__tests__/plan.command.unit.test.js.map +1 -0
- package/dist/cli/__tests__/run.command.unit.test.d.ts +7 -0
- package/dist/cli/__tests__/run.command.unit.test.d.ts.map +1 -0
- package/dist/cli/__tests__/run.command.unit.test.js +422 -0
- package/dist/cli/__tests__/run.command.unit.test.js.map +1 -0
- package/dist/cli/__tests__/validate.command.unit.test.d.ts +7 -0
- package/dist/cli/__tests__/validate.command.unit.test.d.ts.map +1 -0
- package/dist/cli/__tests__/validate.command.unit.test.js +226 -0
- package/dist/cli/__tests__/validate.command.unit.test.js.map +1 -0
- package/dist/cli/command-deps.d.ts +125 -0
- package/dist/cli/command-deps.d.ts.map +1 -0
- package/dist/cli/command-deps.js +7 -0
- package/dist/cli/command-deps.js.map +1 -0
- package/dist/cli/commands/aggregate.d.ts +35 -0
- package/dist/cli/commands/aggregate.d.ts.map +1 -0
- package/dist/cli/commands/aggregate.js +121 -0
- package/dist/cli/commands/aggregate.js.map +1 -0
- package/dist/cli/commands/plan.d.ts +36 -0
- package/dist/cli/commands/plan.d.ts.map +1 -0
- package/dist/cli/commands/plan.js +109 -0
- package/dist/cli/commands/plan.js.map +1 -0
- package/dist/cli/commands/run.d.ts +33 -0
- package/dist/cli/commands/run.d.ts.map +1 -0
- package/dist/cli/commands/run.js +185 -0
- package/dist/cli/commands/run.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +27 -0
- package/dist/cli/commands/validate.d.ts.map +1 -0
- package/dist/cli/commands/validate.js +88 -0
- package/dist/cli/commands/validate.js.map +1 -0
- package/dist/cli/config-loader.d.ts +30 -0
- package/dist/cli/config-loader.d.ts.map +1 -0
- package/dist/cli/config-loader.js +181 -0
- package/dist/cli/config-loader.js.map +1 -0
- package/dist/cli/index.d.ts +26 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +58 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/logger.d.ts +75 -0
- package/dist/cli/logger.d.ts.map +1 -0
- package/dist/cli/logger.js +131 -0
- package/dist/cli/logger.js.map +1 -0
- package/dist/cli/module-loader.d.ts +46 -0
- package/dist/cli/module-loader.d.ts.map +1 -0
- package/dist/cli/module-loader.js +116 -0
- package/dist/cli/module-loader.js.map +1 -0
- package/dist/cli/output-writer.d.ts +51 -0
- package/dist/cli/output-writer.d.ts.map +1 -0
- package/dist/cli/output-writer.js +65 -0
- package/dist/cli/output-writer.js.map +1 -0
- package/dist/cli/types.d.ts +174 -0
- package/dist/cli/types.d.ts.map +1 -0
- package/dist/cli/types.js +7 -0
- package/dist/cli/types.js.map +1 -0
- package/dist/collector/__tests__/result-collector.unit.test.d.ts +7 -0
- package/dist/collector/__tests__/result-collector.unit.test.d.ts.map +1 -0
- package/dist/collector/__tests__/result-collector.unit.test.js +1021 -0
- package/dist/collector/__tests__/result-collector.unit.test.js.map +1 -0
- package/dist/collector/__tests__/schema.unit.test.d.ts +7 -0
- package/dist/collector/__tests__/schema.unit.test.d.ts.map +1 -0
- package/dist/collector/__tests__/schema.unit.test.js +360 -0
- package/dist/collector/__tests__/schema.unit.test.js.map +1 -0
- package/dist/collector/index.d.ts +8 -0
- package/dist/collector/index.d.ts.map +1 -0
- package/dist/collector/index.js +8 -0
- package/dist/collector/index.js.map +1 -0
- package/dist/collector/result-collector.d.ts +159 -0
- package/dist/collector/result-collector.d.ts.map +1 -0
- package/dist/collector/result-collector.js +213 -0
- package/dist/collector/result-collector.js.map +1 -0
- package/dist/collector/schema.d.ts +34 -0
- package/dist/collector/schema.d.ts.map +1 -0
- package/dist/collector/schema.js +145 -0
- package/dist/collector/schema.js.map +1 -0
- package/dist/executor/__tests__/checkpoint-hash-bug.diagnostic.test.d.ts +10 -0
- package/dist/executor/__tests__/checkpoint-hash-bug.diagnostic.test.d.ts.map +1 -0
- package/dist/executor/__tests__/checkpoint-hash-bug.diagnostic.test.js +122 -0
- package/dist/executor/__tests__/checkpoint-hash-bug.diagnostic.test.js.map +1 -0
- package/dist/executor/__tests__/checkpoint-manager.integration.test.d.ts +7 -0
- package/dist/executor/__tests__/checkpoint-manager.integration.test.d.ts.map +1 -0
- package/dist/executor/__tests__/checkpoint-manager.integration.test.js +330 -0
- package/dist/executor/__tests__/checkpoint-manager.integration.test.js.map +1 -0
- package/dist/executor/__tests__/checkpoint-manager.unit.test.d.ts +7 -0
- package/dist/executor/__tests__/checkpoint-manager.unit.test.d.ts.map +1 -0
- package/dist/executor/__tests__/checkpoint-manager.unit.test.js +531 -0
- package/dist/executor/__tests__/checkpoint-manager.unit.test.js.map +1 -0
- package/dist/executor/__tests__/checkpoint-merge-bug.diagnostic.test.d.ts +8 -0
- package/dist/executor/__tests__/checkpoint-merge-bug.diagnostic.test.d.ts.map +1 -0
- package/dist/executor/__tests__/checkpoint-merge-bug.diagnostic.test.js +493 -0
- package/dist/executor/__tests__/checkpoint-merge-bug.diagnostic.test.js.map +1 -0
- package/dist/executor/__tests__/checkpoint-merge-bug.unit.test.d.ts +8 -0
- package/dist/executor/__tests__/checkpoint-merge-bug.unit.test.d.ts.map +1 -0
- package/dist/executor/__tests__/checkpoint-merge-bug.unit.test.js +164 -0
- package/dist/executor/__tests__/checkpoint-merge-bug.unit.test.js.map +1 -0
- package/dist/executor/__tests__/checkpoint-storage.unit.test.d.ts +7 -0
- package/dist/executor/__tests__/checkpoint-storage.unit.test.d.ts.map +1 -0
- package/dist/executor/__tests__/checkpoint-storage.unit.test.js +490 -0
- package/dist/executor/__tests__/checkpoint-storage.unit.test.js.map +1 -0
- package/dist/executor/__tests__/executor.unit.test.d.ts +7 -0
- package/dist/executor/__tests__/executor.unit.test.d.ts.map +1 -0
- package/dist/executor/__tests__/executor.unit.test.js +202 -0
- package/dist/executor/__tests__/executor.unit.test.js.map +1 -0
- package/dist/executor/__tests__/memory-monitor.unit.test.d.ts +7 -0
- package/dist/executor/__tests__/memory-monitor.unit.test.d.ts.map +1 -0
- package/dist/executor/__tests__/memory-monitor.unit.test.js +285 -0
- package/dist/executor/__tests__/memory-monitor.unit.test.js.map +1 -0
- package/dist/executor/__tests__/parallel-checkpoint-merge.integration.test.d.ts +12 -0
- package/dist/executor/__tests__/parallel-checkpoint-merge.integration.test.d.ts.map +1 -0
- package/dist/executor/__tests__/parallel-checkpoint-merge.integration.test.js +196 -0
- package/dist/executor/__tests__/parallel-checkpoint-merge.integration.test.js.map +1 -0
- package/dist/executor/__tests__/parallel-executor.integration.test.d.ts +7 -0
- package/dist/executor/__tests__/parallel-executor.integration.test.d.ts.map +1 -0
- package/dist/executor/__tests__/parallel-executor.integration.test.js +249 -0
- package/dist/executor/__tests__/parallel-executor.integration.test.js.map +1 -0
- package/dist/executor/__tests__/parallel-executor.unit.test.d.ts +8 -0
- package/dist/executor/__tests__/parallel-executor.unit.test.d.ts.map +1 -0
- package/dist/executor/__tests__/parallel-executor.unit.test.js +473 -0
- package/dist/executor/__tests__/parallel-executor.unit.test.js.map +1 -0
- package/dist/executor/__tests__/run-id.unit.test.d.ts +8 -0
- package/dist/executor/__tests__/run-id.unit.test.d.ts.map +1 -0
- package/dist/executor/__tests__/run-id.unit.test.js +156 -0
- package/dist/executor/__tests__/run-id.unit.test.js.map +1 -0
- package/dist/executor/__tests__/worker-entry.integration.test.d.ts +24 -0
- package/dist/executor/__tests__/worker-entry.integration.test.d.ts.map +1 -0
- package/dist/executor/__tests__/worker-entry.integration.test.js +82 -0
- package/dist/executor/__tests__/worker-entry.integration.test.js.map +1 -0
- package/dist/executor/__tests__/worker-entry.unit.test.d.ts +7 -0
- package/dist/executor/__tests__/worker-entry.unit.test.d.ts.map +1 -0
- package/dist/executor/__tests__/worker-entry.unit.test.js +364 -0
- package/dist/executor/__tests__/worker-entry.unit.test.js.map +1 -0
- package/dist/executor/checkpoint-manager.d.ts +231 -0
- package/dist/executor/checkpoint-manager.d.ts.map +1 -0
- package/dist/executor/checkpoint-manager.js +395 -0
- package/dist/executor/checkpoint-manager.js.map +1 -0
- package/dist/executor/checkpoint-storage.d.ts +230 -0
- package/dist/executor/checkpoint-storage.d.ts.map +1 -0
- package/dist/executor/checkpoint-storage.js +370 -0
- package/dist/executor/checkpoint-storage.js.map +1 -0
- package/dist/executor/checkpoint-types.d.ts +48 -0
- package/dist/executor/checkpoint-types.d.ts.map +1 -0
- package/dist/executor/checkpoint-types.js +8 -0
- package/dist/executor/checkpoint-types.js.map +1 -0
- package/dist/executor/executor.d.ts +164 -0
- package/dist/executor/executor.d.ts.map +1 -0
- package/dist/executor/executor.js +408 -0
- package/dist/executor/executor.js.map +1 -0
- package/dist/executor/index.d.ts +11 -0
- package/dist/executor/index.d.ts.map +1 -0
- package/dist/executor/index.js +11 -0
- package/dist/executor/index.js.map +1 -0
- package/dist/executor/memory-monitor.d.ts +115 -0
- package/dist/executor/memory-monitor.d.ts.map +1 -0
- package/dist/executor/memory-monitor.js +168 -0
- package/dist/executor/memory-monitor.js.map +1 -0
- package/dist/executor/parallel-executor.d.ts +239 -0
- package/dist/executor/parallel-executor.d.ts.map +1 -0
- package/dist/executor/parallel-executor.js +329 -0
- package/dist/executor/parallel-executor.js.map +1 -0
- package/dist/executor/run-id.d.ts +71 -0
- package/dist/executor/run-id.d.ts.map +1 -0
- package/dist/executor/run-id.js +74 -0
- package/dist/executor/run-id.js.map +1 -0
- package/dist/executor/worker-entry.d.ts +10 -0
- package/dist/executor/worker-entry.d.ts.map +1 -0
- package/dist/executor/worker-entry.js +42 -0
- package/dist/executor/worker-entry.js.map +1 -0
- package/dist/executor/worker-executor.d.ts +156 -0
- package/dist/executor/worker-executor.d.ts.map +1 -0
- package/dist/executor/worker-executor.js +88 -0
- package/dist/executor/worker-executor.js.map +1 -0
- package/dist/index.cjs +11 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/registry/case-registry.d.ts +113 -0
- package/dist/registry/case-registry.d.ts.map +1 -0
- package/dist/registry/case-registry.js +160 -0
- package/dist/registry/case-registry.js.map +1 -0
- package/dist/registry/index.d.ts +8 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +8 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/sut-registry.d.ts +96 -0
- package/dist/registry/sut-registry.d.ts.map +1 -0
- package/dist/registry/sut-registry.js +126 -0
- package/dist/registry/sut-registry.js.map +1 -0
- package/dist/renderers/index.d.ts +10 -0
- package/dist/renderers/index.d.ts.map +1 -0
- package/dist/renderers/index.js +9 -0
- package/dist/renderers/index.js.map +1 -0
- package/dist/renderers/latex-renderer.d.ts +84 -0
- package/dist/renderers/latex-renderer.d.ts.map +1 -0
- package/dist/renderers/latex-renderer.js +208 -0
- package/dist/renderers/latex-renderer.js.map +1 -0
- package/dist/renderers/types.d.ts +106 -0
- package/dist/renderers/types.d.ts.map +1 -0
- package/dist/renderers/types.js +23 -0
- package/dist/renderers/types.js.map +1 -0
- package/dist/robustness/__tests__/analyzer.unit.test.d.ts +11 -0
- package/dist/robustness/__tests__/analyzer.unit.test.d.ts.map +1 -0
- package/dist/robustness/__tests__/analyzer.unit.test.js +455 -0
- package/dist/robustness/__tests__/analyzer.unit.test.js.map +1 -0
- package/dist/robustness/__tests__/perturbations.unit.test.d.ts +11 -0
- package/dist/robustness/__tests__/perturbations.unit.test.d.ts.map +1 -0
- package/dist/robustness/__tests__/perturbations.unit.test.js +284 -0
- package/dist/robustness/__tests__/perturbations.unit.test.js.map +1 -0
- package/dist/robustness/analyzer.d.ts +61 -0
- package/dist/robustness/analyzer.d.ts.map +1 -0
- package/dist/robustness/analyzer.js +191 -0
- package/dist/robustness/analyzer.js.map +1 -0
- package/dist/robustness/index.d.ts +8 -0
- package/dist/robustness/index.d.ts.map +1 -0
- package/dist/robustness/index.js +8 -0
- package/dist/robustness/index.js.map +1 -0
- package/dist/robustness/perturbations.d.ts +46 -0
- package/dist/robustness/perturbations.d.ts.map +1 -0
- package/dist/robustness/perturbations.js +184 -0
- package/dist/robustness/perturbations.js.map +1 -0
- package/dist/statistical/__tests__/mann-whitney-u.unit.test.d.ts +7 -0
- package/dist/statistical/__tests__/mann-whitney-u.unit.test.d.ts.map +1 -0
- package/dist/statistical/__tests__/mann-whitney-u.unit.test.js +185 -0
- package/dist/statistical/__tests__/mann-whitney-u.unit.test.js.map +1 -0
- package/dist/statistical/index.d.ts +8 -0
- package/dist/statistical/index.d.ts.map +1 -0
- package/dist/statistical/index.js +8 -0
- package/dist/statistical/index.js.map +1 -0
- package/dist/statistical/mann-whitney-u.d.ts +62 -0
- package/dist/statistical/mann-whitney-u.d.ts.map +1 -0
- package/dist/statistical/mann-whitney-u.js +127 -0
- package/dist/statistical/mann-whitney-u.js.map +1 -0
- package/dist/types/aggregate.d.ts +124 -0
- package/dist/types/aggregate.d.ts.map +1 -0
- package/dist/types/aggregate.js +9 -0
- package/dist/types/aggregate.js.map +1 -0
- package/dist/types/case.d.ts +105 -0
- package/dist/types/case.d.ts.map +1 -0
- package/dist/types/case.js +10 -0
- package/dist/types/case.js.map +1 -0
- package/dist/types/claims.d.ts +122 -0
- package/dist/types/claims.d.ts.map +1 -0
- package/dist/types/claims.js +14 -0
- package/dist/types/claims.js.map +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +7 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/perturbation.d.ts +105 -0
- package/dist/types/perturbation.d.ts.map +1 -0
- package/dist/types/perturbation.js +9 -0
- package/dist/types/perturbation.js.map +1 -0
- package/dist/types/result.d.ts +150 -0
- package/dist/types/result.d.ts.map +1 -0
- package/dist/types/result.js +12 -0
- package/dist/types/result.js.map +1 -0
- package/dist/types/sut.d.ts +128 -0
- package/dist/types/sut.d.ts.map +1 -0
- package/dist/types/sut.js +12 -0
- package/dist/types/sut.js.map +1 -0
- package/package.json +290 -7
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for run-id generation
|
|
3
|
+
*
|
|
4
|
+
* Tests deterministic run ID generation, config hashing,
|
|
5
|
+
* run ID validation, and parsing.
|
|
6
|
+
*/
|
|
7
|
+
import { describe, it } from "node:test";
|
|
8
|
+
import { strict as assert } from "node:assert";
|
|
9
|
+
import { generateRunId, generateConfigHash, validateRunId, parseRunId, } from "../run-id.js";
|
|
10
|
+
describe("generateRunId", () => {
|
|
11
|
+
it("should generate consistent IDs for same inputs", () => {
|
|
12
|
+
const inputs = {
|
|
13
|
+
sutId: "degree-prioritised-v1.0.0",
|
|
14
|
+
caseId: "karate-v1",
|
|
15
|
+
seed: 42,
|
|
16
|
+
repetition: 1,
|
|
17
|
+
};
|
|
18
|
+
const id1 = generateRunId(inputs);
|
|
19
|
+
const id2 = generateRunId(inputs);
|
|
20
|
+
assert.strictEqual(id1, id2);
|
|
21
|
+
assert.strictEqual(id1.length, 16);
|
|
22
|
+
});
|
|
23
|
+
it("should generate different IDs for different inputs", () => {
|
|
24
|
+
const inputs1 = {
|
|
25
|
+
sutId: "sut-1",
|
|
26
|
+
caseId: "case-1",
|
|
27
|
+
seed: 42,
|
|
28
|
+
};
|
|
29
|
+
const inputs2 = {
|
|
30
|
+
sutId: "sut-2",
|
|
31
|
+
caseId: "case-1",
|
|
32
|
+
seed: 42,
|
|
33
|
+
};
|
|
34
|
+
assert.notStrictEqual(generateRunId(inputs1), generateRunId(inputs2));
|
|
35
|
+
});
|
|
36
|
+
it("should handle optional fields", () => {
|
|
37
|
+
const inputs1 = {
|
|
38
|
+
sutId: "sut-1",
|
|
39
|
+
caseId: "case-1",
|
|
40
|
+
};
|
|
41
|
+
const inputs2 = {
|
|
42
|
+
sutId: "sut-1",
|
|
43
|
+
caseId: "case-1",
|
|
44
|
+
seed: 42,
|
|
45
|
+
repetition: 1,
|
|
46
|
+
configHash: "abc123",
|
|
47
|
+
};
|
|
48
|
+
assert.strictEqual(generateRunId(inputs1).length, 16);
|
|
49
|
+
assert.strictEqual(generateRunId(inputs2).length, 16);
|
|
50
|
+
assert.notStrictEqual(generateRunId(inputs1), generateRunId(inputs2));
|
|
51
|
+
});
|
|
52
|
+
it("should generate lowercase hex strings", () => {
|
|
53
|
+
const inputs = { sutId: "test", caseId: "test" };
|
|
54
|
+
const id = generateRunId(inputs);
|
|
55
|
+
assert.ok(/^[0-9a-f]{16}$/.test(id));
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
describe("generateConfigHash", () => {
|
|
59
|
+
it("should generate consistent hashes for same config", () => {
|
|
60
|
+
const config = { threshold: 0.9, iterations: 100 };
|
|
61
|
+
const hash1 = generateConfigHash(config);
|
|
62
|
+
const hash2 = generateConfigHash(config);
|
|
63
|
+
assert.strictEqual(hash1, hash2);
|
|
64
|
+
assert.strictEqual(hash1.length, 8);
|
|
65
|
+
});
|
|
66
|
+
it("should generate different hashes for different configs", () => {
|
|
67
|
+
const config1 = { threshold: 0.9 };
|
|
68
|
+
const config2 = { threshold: 0.5 };
|
|
69
|
+
assert.notStrictEqual(generateConfigHash(config1), generateConfigHash(config2));
|
|
70
|
+
});
|
|
71
|
+
it("should handle nested objects", () => {
|
|
72
|
+
const config1 = { nested: { value: 1 } };
|
|
73
|
+
const config2 = { nested: { value: 2 } };
|
|
74
|
+
assert.notStrictEqual(generateConfigHash(config1), generateConfigHash(config2));
|
|
75
|
+
});
|
|
76
|
+
it("should handle arrays", () => {
|
|
77
|
+
const config1 = { items: [1, 2, 3] };
|
|
78
|
+
const config2 = { items: [1, 2, 4] };
|
|
79
|
+
assert.notStrictEqual(generateConfigHash(config1), generateConfigHash(config2));
|
|
80
|
+
});
|
|
81
|
+
it("should generate lowercase hex strings", () => {
|
|
82
|
+
const hash = generateConfigHash({ test: true });
|
|
83
|
+
assert.ok(/^[0-9a-f]{8}$/.test(hash));
|
|
84
|
+
});
|
|
85
|
+
it("should handle empty config", () => {
|
|
86
|
+
const hash = generateConfigHash({});
|
|
87
|
+
assert.strictEqual(hash.length, 8);
|
|
88
|
+
});
|
|
89
|
+
it("should be order-independent due to key sorting", () => {
|
|
90
|
+
const hash1 = generateConfigHash({ a: 1, b: 2, c: 3 });
|
|
91
|
+
const hash2 = generateConfigHash({ c: 3, a: 1, b: 2 });
|
|
92
|
+
assert.strictEqual(hash1, hash2);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
describe("validateRunId", () => {
|
|
96
|
+
it("should return true for matching run ID", () => {
|
|
97
|
+
const inputs = { sutId: "test", caseId: "case" };
|
|
98
|
+
const runId = generateRunId(inputs);
|
|
99
|
+
assert.strictEqual(validateRunId(runId, inputs), true);
|
|
100
|
+
});
|
|
101
|
+
it("should return false for non-matching run ID", () => {
|
|
102
|
+
const inputs = { sutId: "test", caseId: "case" };
|
|
103
|
+
const runId = generateRunId({ sutId: "other", caseId: "case" });
|
|
104
|
+
assert.strictEqual(validateRunId(runId, inputs), false);
|
|
105
|
+
});
|
|
106
|
+
it("should return false for invalid run ID format", () => {
|
|
107
|
+
const inputs = { sutId: "test", caseId: "case" };
|
|
108
|
+
assert.strictEqual(validateRunId("not-a-valid-id", inputs), false);
|
|
109
|
+
assert.strictEqual(validateRunId("", inputs), false);
|
|
110
|
+
assert.strictEqual(validateRunId("abc", inputs), false);
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
describe("parseRunId", () => {
|
|
114
|
+
it("should validate correctly formatted run IDs", () => {
|
|
115
|
+
const result = parseRunId("abc123def4567890");
|
|
116
|
+
assert.strictEqual(result.valid, true);
|
|
117
|
+
assert.strictEqual(result.length, 16);
|
|
118
|
+
});
|
|
119
|
+
it("should reject run IDs with wrong length", () => {
|
|
120
|
+
const result = parseRunId("abc123");
|
|
121
|
+
assert.strictEqual(result.valid, false);
|
|
122
|
+
assert.strictEqual(result.length, 6);
|
|
123
|
+
});
|
|
124
|
+
it("should reject run IDs with non-hex characters", () => {
|
|
125
|
+
const result = parseRunId("abc123xyz4567890");
|
|
126
|
+
assert.strictEqual(result.valid, false);
|
|
127
|
+
assert.strictEqual(result.length, 16);
|
|
128
|
+
});
|
|
129
|
+
it("should accept uppercase letters (hex is case-insensitive)", () => {
|
|
130
|
+
const result = parseRunId("ABC123DEF4567890");
|
|
131
|
+
// The implementation uses case-insensitive regex, so uppercase is valid
|
|
132
|
+
assert.strictEqual(result.valid, true);
|
|
133
|
+
assert.strictEqual(result.length, 16);
|
|
134
|
+
});
|
|
135
|
+
it("should reject empty string", () => {
|
|
136
|
+
const result = parseRunId("");
|
|
137
|
+
assert.strictEqual(result.valid, false);
|
|
138
|
+
assert.strictEqual(result.length, 0);
|
|
139
|
+
});
|
|
140
|
+
it("should reject strings with special characters", () => {
|
|
141
|
+
const result = parseRunId("abc-123-def-456");
|
|
142
|
+
assert.strictEqual(result.valid, false);
|
|
143
|
+
assert.strictEqual(result.length, 15);
|
|
144
|
+
});
|
|
145
|
+
it("should accept all zeros", () => {
|
|
146
|
+
const result = parseRunId("0000000000000000");
|
|
147
|
+
assert.strictEqual(result.valid, true);
|
|
148
|
+
assert.strictEqual(result.length, 16);
|
|
149
|
+
});
|
|
150
|
+
it("should accept all f's", () => {
|
|
151
|
+
const result = parseRunId("ffffffffffffffff");
|
|
152
|
+
assert.strictEqual(result.valid, true);
|
|
153
|
+
assert.strictEqual(result.length, 16);
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
//# sourceMappingURL=run-id.unit.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-id.unit.test.js","sourceRoot":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AAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAChC,MAAM,MAAM,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;QAE9C,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACvC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration tests for worker-entry
|
|
3
|
+
*
|
|
4
|
+
* Tests the worker entry point by actually spawning a worker thread
|
|
5
|
+
* and sending messages to it.
|
|
6
|
+
*
|
|
7
|
+
* These tests automatically skip if the build output doesn't exist.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
/**
|
|
11
|
+
* Note: The worker-entry.ts file is a thin wrapper around WorkerExecutor.
|
|
12
|
+
*
|
|
13
|
+
* The core logic is tested in worker-executor.unit.test.ts with 98.27% coverage.
|
|
14
|
+
*
|
|
15
|
+
* These integration tests automatically skip if the build output doesn't exist.
|
|
16
|
+
* To enable them:
|
|
17
|
+
*
|
|
18
|
+
* 1. Build the project: `npm run build`
|
|
19
|
+
*
|
|
20
|
+
* The tests check for `dist/executor/worker-entry.js` at runtime and skip
|
|
21
|
+
* if it's not found. Using tsx/esm with Worker was attempted but has
|
|
22
|
+
* issues resolving .js imports to .ts files in the worker context.
|
|
23
|
+
*/
|
|
24
|
+
//# sourceMappingURL=worker-entry.integration.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-entry.integration.test.d.ts","sourceRoot":"","sources":["../../../src/executor/__tests__/worker-entry.integration.test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;;AAwEH;;;;;;;;;;;;;GAaG"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integration tests for worker-entry
|
|
3
|
+
*
|
|
4
|
+
* Tests the worker entry point by actually spawning a worker thread
|
|
5
|
+
* and sending messages to it.
|
|
6
|
+
*
|
|
7
|
+
* These tests automatically skip if the build output doesn't exist.
|
|
8
|
+
*/
|
|
9
|
+
import { describe, it } from "node:test";
|
|
10
|
+
import { strict as assert } from "node:assert";
|
|
11
|
+
import { existsSync } from "node:fs";
|
|
12
|
+
import { Worker } from "node:worker_threads";
|
|
13
|
+
import { resolve, dirname } from "node:path";
|
|
14
|
+
import { fileURLToPath } from "node:url";
|
|
15
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
+
const __dirname = dirname(__filename);
|
|
17
|
+
// Path to the built worker entry (requires npm run build)
|
|
18
|
+
const workerEntryPath = resolve(__dirname, "../../../dist/executor/worker-entry.js");
|
|
19
|
+
// Check if build output exists - skip tests if not built
|
|
20
|
+
const isBuilt = existsSync(workerEntryPath);
|
|
21
|
+
describe("worker-entry integration", { skip: !isBuilt }, () => {
|
|
22
|
+
it("should spawn worker and respond to messages", async () => {
|
|
23
|
+
// Tests skipped: Requires build (npm run build)
|
|
24
|
+
// WorkerExecutor is tested at 98.27% coverage in unit tests
|
|
25
|
+
const worker = new Worker(workerEntryPath, {
|
|
26
|
+
workerData: {},
|
|
27
|
+
});
|
|
28
|
+
try {
|
|
29
|
+
// Test basic communication
|
|
30
|
+
const response = await new Promise((resolve, reject) => {
|
|
31
|
+
worker.on("message", resolve);
|
|
32
|
+
worker.on("error", reject);
|
|
33
|
+
worker.on("exit", (code) => {
|
|
34
|
+
if (code !== 0) {
|
|
35
|
+
reject(new Error(`Worker stopped with exit code ${code}`));
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
// Send a test message
|
|
39
|
+
worker.postMessage({ type: "test" });
|
|
40
|
+
});
|
|
41
|
+
assert.ok(response);
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
await worker.terminate();
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
it("should handle execute batch messages", async () => {
|
|
48
|
+
// Test that the worker can handle executeBatch messages
|
|
49
|
+
// This is the main use case for the worker
|
|
50
|
+
const worker = new Worker(workerEntryPath);
|
|
51
|
+
try {
|
|
52
|
+
const response = await new Promise((resolve, reject) => {
|
|
53
|
+
worker.on("message", resolve);
|
|
54
|
+
worker.on("error", reject);
|
|
55
|
+
// Send an executeBatch message with mock data
|
|
56
|
+
worker.postMessage({
|
|
57
|
+
type: "executeBatch",
|
|
58
|
+
runs: [],
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
assert.ok(response);
|
|
62
|
+
}
|
|
63
|
+
finally {
|
|
64
|
+
await worker.terminate();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* Note: The worker-entry.ts file is a thin wrapper around WorkerExecutor.
|
|
70
|
+
*
|
|
71
|
+
* The core logic is tested in worker-executor.unit.test.ts with 98.27% coverage.
|
|
72
|
+
*
|
|
73
|
+
* These integration tests automatically skip if the build output doesn't exist.
|
|
74
|
+
* To enable them:
|
|
75
|
+
*
|
|
76
|
+
* 1. Build the project: `npm run build`
|
|
77
|
+
*
|
|
78
|
+
* The tests check for `dist/executor/worker-entry.js` at runtime and skip
|
|
79
|
+
* if it's not found. Using tsx/esm with Worker was attempted but has
|
|
80
|
+
* issues resolving .js imports to .ts files in the worker context.
|
|
81
|
+
*/
|
|
82
|
+
//# sourceMappingURL=worker-entry.integration.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-entry.integration.test.js","sourceRoot":"","sources":["../../../src/executor/__tests__/worker-entry.integration.test.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EA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AsB;gBACtB,MAAM,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;YACtC,CAAC,CAAC,CAAC;YAEH,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;QACrB,CAAC;gBAAS,CAAC;YACV,MAAM,MAAM,CAAC,SAAS,EAAE,CAAC;QAC1B,CAAC;IACF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sCAAsC,EAAE,KAAK,IAAI,EAAE;QACrD,wDAAwD;QACxD,2CAA2C;QAE3C,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,eAAe,CAAC,CAAC;QAE3C,IAAI,CAAC;YACJ,MAAM,QAAQ,GAAG,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBACtD,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;gBAC9B,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;gBAE3B,8CAA8C;gBAC9C,MAAM,CAAC,WAAW,CAAC;oBAClB,IAAI,EAAE,cAAc;oBACpB,IAAI,EAAE,EAAE;iBACR,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC;YAEH,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;QACrB,CAAC;gBAAS,CAAC;YACV,MAAM,MAAM,CAAC,SAAS,EAAE,CAAC;QAC1B,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH;;;;;;;;;;;;;GAaG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worker-entry.unit.test.d.ts","sourceRoot":"","sources":["../../../src/executor/__tests__/worker-entry.unit.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for worker-entry.ts
|
|
3
|
+
*
|
|
4
|
+
* Tests WorkerExecutor with injected mock dependencies.
|
|
5
|
+
*/
|
|
6
|
+
import { describe, it, mock, beforeEach } from "node:test";
|
|
7
|
+
import { strict as assert } from "node:assert";
|
|
8
|
+
import { WorkerExecutor, } from "../worker-executor.js";
|
|
9
|
+
describe("worker-entry", () => {
|
|
10
|
+
let mockParentPort;
|
|
11
|
+
let mockModuleLoader;
|
|
12
|
+
let mockExecutorInstance;
|
|
13
|
+
let postedMessages;
|
|
14
|
+
let onListeners;
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
postedMessages = [];
|
|
17
|
+
onListeners = [];
|
|
18
|
+
// Mock parentPort
|
|
19
|
+
mockParentPort = {
|
|
20
|
+
on: mock.fn((event, listener) => {
|
|
21
|
+
onListeners.push({ event, listener });
|
|
22
|
+
}),
|
|
23
|
+
postMessage: mock.fn((message) => {
|
|
24
|
+
postedMessages.push(message);
|
|
25
|
+
}),
|
|
26
|
+
};
|
|
27
|
+
// Mock executor instance
|
|
28
|
+
mockExecutorInstance = {
|
|
29
|
+
execute: mock.fn(async () => ({
|
|
30
|
+
results: [
|
|
31
|
+
{
|
|
32
|
+
run: {
|
|
33
|
+
runId: "test-1",
|
|
34
|
+
sut: "sut-1",
|
|
35
|
+
sutRole: "primary",
|
|
36
|
+
caseId: "case-1",
|
|
37
|
+
repetition: 0,
|
|
38
|
+
seed: 42,
|
|
39
|
+
},
|
|
40
|
+
correctness: {
|
|
41
|
+
expectedExists: true,
|
|
42
|
+
producedOutput: true,
|
|
43
|
+
valid: true,
|
|
44
|
+
matchesExpected: true,
|
|
45
|
+
},
|
|
46
|
+
outputs: {},
|
|
47
|
+
metrics: { numeric: {} },
|
|
48
|
+
provenance: {
|
|
49
|
+
runtime: {
|
|
50
|
+
platform: "test",
|
|
51
|
+
arch: "test",
|
|
52
|
+
nodeVersion: "test",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
errors: [],
|
|
58
|
+
})),
|
|
59
|
+
};
|
|
60
|
+
// Mock Executor constructor
|
|
61
|
+
const MockExecutor = mock.fn(function () {
|
|
62
|
+
return mockExecutorInstance;
|
|
63
|
+
});
|
|
64
|
+
// Mock module loader
|
|
65
|
+
mockModuleLoader = {
|
|
66
|
+
loadExecutor: async () => {
|
|
67
|
+
return {
|
|
68
|
+
Executor: MockExecutor,
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
loadEvaluate: async () => {
|
|
72
|
+
return {
|
|
73
|
+
getSutDefinitions: () => ({}),
|
|
74
|
+
getCaseDefinitions: () => ({}),
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
loadRegistry: async () => {
|
|
78
|
+
return {
|
|
79
|
+
registerAllBenchmarkCases: async () => ({}),
|
|
80
|
+
};
|
|
81
|
+
},
|
|
82
|
+
loadSuts: async () => {
|
|
83
|
+
return {
|
|
84
|
+
registerAllSuts: () => ({}),
|
|
85
|
+
};
|
|
86
|
+
},
|
|
87
|
+
loadDatasets: async () => {
|
|
88
|
+
return {
|
|
89
|
+
registerBenchmarkDatasets: async () => {
|
|
90
|
+
return;
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
describe("WorkerExecutor", () => {
|
|
97
|
+
it("should register message listener on start", () => {
|
|
98
|
+
const executor = new WorkerExecutor(mockParentPort, mockModuleLoader, "/test/root");
|
|
99
|
+
executor.start();
|
|
100
|
+
assert.strictEqual(onListeners.length, 1);
|
|
101
|
+
assert.strictEqual(onListeners[0].event, "message");
|
|
102
|
+
assert.strictEqual(typeof onListeners[0].listener, "function");
|
|
103
|
+
});
|
|
104
|
+
it("should call module loader methods in order", async () => {
|
|
105
|
+
const callOrder = [];
|
|
106
|
+
// Wrap each loader method to track call order
|
|
107
|
+
const originalLoader = mockModuleLoader;
|
|
108
|
+
mockModuleLoader = {
|
|
109
|
+
loadExecutor: async () => {
|
|
110
|
+
callOrder.push("loadExecutor");
|
|
111
|
+
return originalLoader.loadExecutor();
|
|
112
|
+
},
|
|
113
|
+
loadEvaluate: async () => {
|
|
114
|
+
callOrder.push("loadEvaluate");
|
|
115
|
+
return originalLoader.loadEvaluate();
|
|
116
|
+
},
|
|
117
|
+
loadRegistry: async () => {
|
|
118
|
+
callOrder.push("loadRegistry");
|
|
119
|
+
return originalLoader.loadRegistry();
|
|
120
|
+
},
|
|
121
|
+
loadSuts: async () => {
|
|
122
|
+
callOrder.push("loadSuts");
|
|
123
|
+
return originalLoader.loadSuts();
|
|
124
|
+
},
|
|
125
|
+
loadDatasets: async () => {
|
|
126
|
+
callOrder.push("loadDatasets");
|
|
127
|
+
return originalLoader.loadDatasets();
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
const message = {
|
|
131
|
+
runs: [{ runId: "test-1", sutId: "sut-1", caseId: "case-1", repetition: 0, config: {} }],
|
|
132
|
+
config: {
|
|
133
|
+
repetitions: 1,
|
|
134
|
+
seedBase: 42,
|
|
135
|
+
continueOnError: true,
|
|
136
|
+
timeoutMs: 5000,
|
|
137
|
+
collectProvenance: false,
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
const executor = new WorkerExecutor(mockParentPort, mockModuleLoader, "/test/root");
|
|
141
|
+
await executor.handleMessage(message);
|
|
142
|
+
// Verify all module loaders were called in the expected order
|
|
143
|
+
assert.strictEqual(callOrder.length, 5);
|
|
144
|
+
assert.strictEqual(callOrder[0], "loadExecutor");
|
|
145
|
+
assert.strictEqual(callOrder[1], "loadEvaluate");
|
|
146
|
+
assert.strictEqual(callOrder[2], "loadRegistry");
|
|
147
|
+
assert.strictEqual(callOrder[3], "loadSuts");
|
|
148
|
+
assert.strictEqual(callOrder[4], "loadDatasets");
|
|
149
|
+
});
|
|
150
|
+
it("should post done message on successful execution", async () => {
|
|
151
|
+
const message = {
|
|
152
|
+
runs: [{ runId: "test-1", sutId: "sut-1", caseId: "case-1", repetition: 0, config: {} }],
|
|
153
|
+
config: {
|
|
154
|
+
repetitions: 1,
|
|
155
|
+
seedBase: 42,
|
|
156
|
+
continueOnError: true,
|
|
157
|
+
timeoutMs: 5000,
|
|
158
|
+
collectProvenance: false,
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
const executor = new WorkerExecutor(mockParentPort, mockModuleLoader, "/test/root");
|
|
162
|
+
await executor.handleMessage(message);
|
|
163
|
+
assert.strictEqual(postedMessages.length, 1);
|
|
164
|
+
const posted = postedMessages[0];
|
|
165
|
+
assert.strictEqual(posted.type, "done");
|
|
166
|
+
assert.ok(Array.isArray(posted.results));
|
|
167
|
+
assert.strictEqual(posted.results.length, 1);
|
|
168
|
+
});
|
|
169
|
+
it("should post error message on exception", async () => {
|
|
170
|
+
// Make loadExecutor throw an error
|
|
171
|
+
mockModuleLoader.loadExecutor = async () => {
|
|
172
|
+
throw new Error("Module not found");
|
|
173
|
+
};
|
|
174
|
+
const message = {
|
|
175
|
+
runs: [{ runId: "test-1", sutId: "sut-1", caseId: "case-1", repetition: 0, config: {} }],
|
|
176
|
+
config: {
|
|
177
|
+
repetitions: 1,
|
|
178
|
+
seedBase: 42,
|
|
179
|
+
continueOnError: true,
|
|
180
|
+
timeoutMs: 5000,
|
|
181
|
+
collectProvenance: false,
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
const executor = new WorkerExecutor(mockParentPort, mockModuleLoader, "/test/root");
|
|
185
|
+
await executor.handleMessage(message);
|
|
186
|
+
assert.strictEqual(postedMessages.length, 1);
|
|
187
|
+
const posted = postedMessages[0];
|
|
188
|
+
assert.strictEqual(posted.type, "error");
|
|
189
|
+
assert.strictEqual(posted.error, "Module not found");
|
|
190
|
+
});
|
|
191
|
+
it("should post error message with string error", async () => {
|
|
192
|
+
mockModuleLoader.loadExecutor = async () => {
|
|
193
|
+
throw new Error("String error");
|
|
194
|
+
};
|
|
195
|
+
const message = {
|
|
196
|
+
runs: [{ runId: "test-1", sutId: "sut-1", caseId: "case-1", repetition: 0, config: {} }],
|
|
197
|
+
config: {
|
|
198
|
+
repetitions: 1,
|
|
199
|
+
seedBase: 42,
|
|
200
|
+
continueOnError: true,
|
|
201
|
+
timeoutMs: 5000,
|
|
202
|
+
collectProvenance: false,
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
const executor = new WorkerExecutor(mockParentPort, mockModuleLoader, "/test/root");
|
|
206
|
+
await executor.handleMessage(message);
|
|
207
|
+
assert.strictEqual(postedMessages.length, 1);
|
|
208
|
+
const posted = postedMessages[0];
|
|
209
|
+
assert.strictEqual(posted.type, "error");
|
|
210
|
+
assert.strictEqual(posted.error, "String error");
|
|
211
|
+
});
|
|
212
|
+
it("should pass executor config to Executor constructor", async () => {
|
|
213
|
+
const MockExecutor = mock.fn(function (_config) {
|
|
214
|
+
mockExecutorInstance.execute = mock.fn(async () => ({
|
|
215
|
+
results: [],
|
|
216
|
+
errors: [],
|
|
217
|
+
}));
|
|
218
|
+
return mockExecutorInstance;
|
|
219
|
+
});
|
|
220
|
+
mockModuleLoader.loadExecutor = async () => {
|
|
221
|
+
return {
|
|
222
|
+
Executor: MockExecutor,
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
const message = {
|
|
226
|
+
runs: [{ runId: "test-1", sutId: "sut-1", caseId: "case-1", repetition: 0, config: {} }],
|
|
227
|
+
config: {
|
|
228
|
+
repetitions: 5,
|
|
229
|
+
seedBase: 999,
|
|
230
|
+
continueOnError: false,
|
|
231
|
+
timeoutMs: 15000,
|
|
232
|
+
collectProvenance: true,
|
|
233
|
+
},
|
|
234
|
+
};
|
|
235
|
+
const executor = new WorkerExecutor(mockParentPort, mockModuleLoader, "/test/root");
|
|
236
|
+
await executor.handleMessage(message);
|
|
237
|
+
// Verify Executor was constructed with correct config
|
|
238
|
+
assert.strictEqual(MockExecutor.mock.calls.length, 1);
|
|
239
|
+
const executorConfig = MockExecutor.mock.calls[0].arguments[0];
|
|
240
|
+
assert.strictEqual(executorConfig.repetitions, 5);
|
|
241
|
+
assert.strictEqual(executorConfig.seedBase, 999);
|
|
242
|
+
assert.strictEqual(executorConfig.continueOnError, false);
|
|
243
|
+
assert.strictEqual(executorConfig.timeoutMs, 15000);
|
|
244
|
+
assert.strictEqual(executorConfig.collectProvenance, true);
|
|
245
|
+
});
|
|
246
|
+
it("should handle multiple runs in a batch", async () => {
|
|
247
|
+
const message = {
|
|
248
|
+
runs: [
|
|
249
|
+
{ runId: "test-1", sutId: "sut-1", caseId: "case-1", repetition: 0, config: {} },
|
|
250
|
+
{ runId: "test-2", sutId: "sut-2", caseId: "case-2", repetition: 1, config: {} },
|
|
251
|
+
{ runId: "test-3", sutId: "sut-1", caseId: "case-2", repetition: 0, config: {} },
|
|
252
|
+
],
|
|
253
|
+
config: {
|
|
254
|
+
repetitions: 3,
|
|
255
|
+
seedBase: 100,
|
|
256
|
+
continueOnError: true,
|
|
257
|
+
timeoutMs: 10000,
|
|
258
|
+
collectProvenance: false,
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
const executor = new WorkerExecutor(mockParentPort, mockModuleLoader, "/test/root");
|
|
262
|
+
await executor.handleMessage(message);
|
|
263
|
+
assert.strictEqual(postedMessages.length, 1);
|
|
264
|
+
const posted = postedMessages[0];
|
|
265
|
+
assert.strictEqual(posted.type, "done");
|
|
266
|
+
assert.ok(Array.isArray(posted.results));
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
describe("executeBatch", () => {
|
|
270
|
+
it("should call registerBenchmarkDatasets on datasets module", async () => {
|
|
271
|
+
const registerSpy = mock.fn(async () => {
|
|
272
|
+
return;
|
|
273
|
+
});
|
|
274
|
+
mockModuleLoader.loadDatasets = async () => {
|
|
275
|
+
return {
|
|
276
|
+
registerBenchmarkDatasets: registerSpy,
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
const message = {
|
|
280
|
+
runs: [{ runId: "test-1", sutId: "sut-1", caseId: "case-1", repetition: 0, config: {} }],
|
|
281
|
+
config: {
|
|
282
|
+
repetitions: 1,
|
|
283
|
+
seedBase: 42,
|
|
284
|
+
continueOnError: true,
|
|
285
|
+
timeoutMs: 5000,
|
|
286
|
+
collectProvenance: false,
|
|
287
|
+
},
|
|
288
|
+
};
|
|
289
|
+
const executor = new WorkerExecutor(mockParentPort, mockModuleLoader, "/test/root");
|
|
290
|
+
await executor.executeBatch(message);
|
|
291
|
+
assert.strictEqual(registerSpy.mock.calls.length, 1);
|
|
292
|
+
});
|
|
293
|
+
it("should call registerAllSuts on SUTs module", async () => {
|
|
294
|
+
const registerSpy = mock.fn(() => ({}));
|
|
295
|
+
mockModuleLoader.loadSuts = async () => {
|
|
296
|
+
return {
|
|
297
|
+
registerAllSuts: registerSpy,
|
|
298
|
+
};
|
|
299
|
+
};
|
|
300
|
+
const message = {
|
|
301
|
+
runs: [{ runId: "test-1", sutId: "sut-1", caseId: "case-1", repetition: 0, config: {} }],
|
|
302
|
+
config: {
|
|
303
|
+
repetitions: 1,
|
|
304
|
+
seedBase: 42,
|
|
305
|
+
continueOnError: true,
|
|
306
|
+
timeoutMs: 5000,
|
|
307
|
+
collectProvenance: false,
|
|
308
|
+
},
|
|
309
|
+
};
|
|
310
|
+
const executor = new WorkerExecutor(mockParentPort, mockModuleLoader, "/test/root");
|
|
311
|
+
await executor.executeBatch(message);
|
|
312
|
+
assert.strictEqual(registerSpy.mock.calls.length, 1);
|
|
313
|
+
});
|
|
314
|
+
it("should call registerAllBenchmarkCases on registry module", async () => {
|
|
315
|
+
const registerSpy = mock.fn(async () => ({}));
|
|
316
|
+
mockModuleLoader.loadRegistry = async () => {
|
|
317
|
+
return {
|
|
318
|
+
registerAllBenchmarkCases: registerSpy,
|
|
319
|
+
};
|
|
320
|
+
};
|
|
321
|
+
const message = {
|
|
322
|
+
runs: [{ runId: "test-1", sutId: "sut-1", caseId: "case-1", repetition: 0, config: {} }],
|
|
323
|
+
config: {
|
|
324
|
+
repetitions: 1,
|
|
325
|
+
seedBase: 42,
|
|
326
|
+
continueOnError: true,
|
|
327
|
+
timeoutMs: 5000,
|
|
328
|
+
collectProvenance: false,
|
|
329
|
+
},
|
|
330
|
+
};
|
|
331
|
+
const executor = new WorkerExecutor(mockParentPort, mockModuleLoader, "/test/root");
|
|
332
|
+
await executor.executeBatch(message);
|
|
333
|
+
assert.strictEqual(registerSpy.mock.calls.length, 1);
|
|
334
|
+
});
|
|
335
|
+
it("should create sutRegistry with list and getFactory methods", async () => {
|
|
336
|
+
let capturedSutRegistry;
|
|
337
|
+
mockModuleLoader.loadEvaluate = async () => {
|
|
338
|
+
return {
|
|
339
|
+
getSutDefinitions: (registry) => {
|
|
340
|
+
capturedSutRegistry = registry;
|
|
341
|
+
return {};
|
|
342
|
+
},
|
|
343
|
+
getCaseDefinitions: () => ({}),
|
|
344
|
+
};
|
|
345
|
+
};
|
|
346
|
+
const message = {
|
|
347
|
+
runs: [{ runId: "test-1", sutId: "sut-1", caseId: "case-1", repetition: 0, config: {} }],
|
|
348
|
+
config: {
|
|
349
|
+
repetitions: 1,
|
|
350
|
+
seedBase: 42,
|
|
351
|
+
continueOnError: true,
|
|
352
|
+
timeoutMs: 5000,
|
|
353
|
+
collectProvenance: false,
|
|
354
|
+
},
|
|
355
|
+
};
|
|
356
|
+
const executor = new WorkerExecutor(mockParentPort, mockModuleLoader, "/test/root");
|
|
357
|
+
await executor.executeBatch(message);
|
|
358
|
+
assert.ok(capturedSutRegistry);
|
|
359
|
+
assert.strictEqual(typeof capturedSutRegistry.list, "function");
|
|
360
|
+
assert.strictEqual(typeof capturedSutRegistry.getFactory, "function");
|
|
361
|
+
});
|
|
362
|
+
});
|
|
363
|
+
});
|
|
364
|
+
//# sourceMappingURL=worker-entry.unit.test.js.map
|