@opensip-cli/simulation 0.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/LICENSE +202 -0
- package/NOTICE +8 -0
- package/README.md +31 -0
- package/dist/__tests__/internal-surface.test.d.ts +9 -0
- package/dist/__tests__/internal-surface.test.d.ts.map +1 -0
- package/dist/__tests__/internal-surface.test.js +38 -0
- package/dist/__tests__/internal-surface.test.js.map +1 -0
- package/dist/__tests__/plugin-loader.test.d.ts +2 -0
- package/dist/__tests__/plugin-loader.test.d.ts.map +1 -0
- package/dist/__tests__/plugin-loader.test.js +64 -0
- package/dist/__tests__/plugin-loader.test.js.map +1 -0
- package/dist/__tests__/public-api.test.d.ts +15 -0
- package/dist/__tests__/public-api.test.d.ts.map +1 -0
- package/dist/__tests__/public-api.test.js +73 -0
- package/dist/__tests__/public-api.test.js.map +1 -0
- package/dist/__tests__/registry-cross-kind.test.d.ts +6 -0
- package/dist/__tests__/registry-cross-kind.test.d.ts.map +1 -0
- package/dist/__tests__/registry-cross-kind.test.js +86 -0
- package/dist/__tests__/registry-cross-kind.test.js.map +1 -0
- package/dist/__tests__/scenario-execution.test.d.ts +10 -0
- package/dist/__tests__/scenario-execution.test.d.ts.map +1 -0
- package/dist/__tests__/scenario-execution.test.js +92 -0
- package/dist/__tests__/scenario-execution.test.js.map +1 -0
- package/dist/__tests__/sim-capability-contract.test.d.ts +10 -0
- package/dist/__tests__/sim-capability-contract.test.d.ts.map +1 -0
- package/dist/__tests__/sim-capability-contract.test.js +131 -0
- package/dist/__tests__/sim-capability-contract.test.js.map +1 -0
- package/dist/__tests__/sim-config-schema.test.d.ts +5 -0
- package/dist/__tests__/sim-config-schema.test.d.ts.map +1 -0
- package/dist/__tests__/sim-config-schema.test.js +23 -0
- package/dist/__tests__/sim-config-schema.test.js.map +1 -0
- package/dist/__tests__/sim-failure-signal.test.d.ts +10 -0
- package/dist/__tests__/sim-failure-signal.test.d.ts.map +1 -0
- package/dist/__tests__/sim-failure-signal.test.js +86 -0
- package/dist/__tests__/sim-failure-signal.test.js.map +1 -0
- package/dist/__tests__/surviving-surface-edges.test.d.ts +10 -0
- package/dist/__tests__/surviving-surface-edges.test.d.ts.map +1 -0
- package/dist/__tests__/surviving-surface-edges.test.js +122 -0
- package/dist/__tests__/surviving-surface-edges.test.js.map +1 -0
- package/dist/__tests__/test-utils/targets.d.ts +26 -0
- package/dist/__tests__/test-utils/targets.d.ts.map +1 -0
- package/dist/__tests__/test-utils/targets.js +38 -0
- package/dist/__tests__/test-utils/targets.js.map +1 -0
- package/dist/__tests__/test-utils/with-sim-scope.d.ts +12 -0
- package/dist/__tests__/test-utils/with-sim-scope.d.ts.map +1 -0
- package/dist/__tests__/test-utils/with-sim-scope.js +22 -0
- package/dist/__tests__/test-utils/with-sim-scope.js.map +1 -0
- package/dist/__tests__/tool-live-view.test.d.ts +20 -0
- package/dist/__tests__/tool-live-view.test.d.ts.map +1 -0
- package/dist/__tests__/tool-live-view.test.js +146 -0
- package/dist/__tests__/tool-live-view.test.js.map +1 -0
- package/dist/__tests__/tool-show-mode.test.d.ts +10 -0
- package/dist/__tests__/tool-show-mode.test.d.ts.map +1 -0
- package/dist/__tests__/tool-show-mode.test.js +156 -0
- package/dist/__tests__/tool-show-mode.test.js.map +1 -0
- package/dist/__tests__/tool.test.d.ts +15 -0
- package/dist/__tests__/tool.test.d.ts.map +1 -0
- package/dist/__tests__/tool.test.js +250 -0
- package/dist/__tests__/tool.test.js.map +1 -0
- package/dist/cli/__tests__/sim-config.test.d.ts +2 -0
- package/dist/cli/__tests__/sim-config.test.d.ts.map +1 -0
- package/dist/cli/__tests__/sim-config.test.js +94 -0
- package/dist/cli/__tests__/sim-config.test.js.map +1 -0
- package/dist/cli/__tests__/sim-runner.test.d.ts +23 -0
- package/dist/cli/__tests__/sim-runner.test.d.ts.map +1 -0
- package/dist/cli/__tests__/sim-runner.test.js +188 -0
- package/dist/cli/__tests__/sim-runner.test.js.map +1 -0
- package/dist/cli/__tests__/sim-worker.test.d.ts +12 -0
- package/dist/cli/__tests__/sim-worker.test.d.ts.map +1 -0
- package/dist/cli/__tests__/sim-worker.test.js +69 -0
- package/dist/cli/__tests__/sim-worker.test.js.map +1 -0
- package/dist/cli/__tests__/sim.test.d.ts +2 -0
- package/dist/cli/__tests__/sim.test.d.ts.map +1 -0
- package/dist/cli/__tests__/sim.test.js +232 -0
- package/dist/cli/__tests__/sim.test.js.map +1 -0
- package/dist/cli/sim-config-schema.d.ts +30 -0
- package/dist/cli/sim-config-schema.d.ts.map +1 -0
- package/dist/cli/sim-config-schema.js +33 -0
- package/dist/cli/sim-config-schema.js.map +1 -0
- package/dist/cli/sim-config.d.ts +22 -0
- package/dist/cli/sim-config.d.ts.map +1 -0
- package/dist/cli/sim-config.js +73 -0
- package/dist/cli/sim-config.js.map +1 -0
- package/dist/cli/sim-runner.d.ts +60 -0
- package/dist/cli/sim-runner.d.ts.map +1 -0
- package/dist/cli/sim-runner.js +175 -0
- package/dist/cli/sim-runner.js.map +1 -0
- package/dist/cli/sim-worker.d.ts +24 -0
- package/dist/cli/sim-worker.d.ts.map +1 -0
- package/dist/cli/sim-worker.js +65 -0
- package/dist/cli/sim-worker.js.map +1 -0
- package/dist/cli/sim.d.ts +56 -0
- package/dist/cli/sim.d.ts.map +1 -0
- package/dist/cli/sim.js +265 -0
- package/dist/cli/sim.js.map +1 -0
- package/dist/framework/__tests__/assertions.test.d.ts +2 -0
- package/dist/framework/__tests__/assertions.test.d.ts.map +1 -0
- package/dist/framework/__tests__/assertions.test.js +122 -0
- package/dist/framework/__tests__/assertions.test.js.map +1 -0
- package/dist/framework/__tests__/misc-coverage.test.d.ts +18 -0
- package/dist/framework/__tests__/misc-coverage.test.d.ts.map +1 -0
- package/dist/framework/__tests__/misc-coverage.test.js +142 -0
- package/dist/framework/__tests__/misc-coverage.test.js.map +1 -0
- package/dist/framework/__tests__/resolve-metric.test.d.ts +12 -0
- package/dist/framework/__tests__/resolve-metric.test.d.ts.map +1 -0
- package/dist/framework/__tests__/resolve-metric.test.js +124 -0
- package/dist/framework/__tests__/resolve-metric.test.js.map +1 -0
- package/dist/framework/__tests__/result-builder.test.d.ts +2 -0
- package/dist/framework/__tests__/result-builder.test.d.ts.map +1 -0
- package/dist/framework/__tests__/result-builder.test.js +180 -0
- package/dist/framework/__tests__/result-builder.test.js.map +1 -0
- package/dist/framework/__tests__/scenario-logger.test.d.ts +9 -0
- package/dist/framework/__tests__/scenario-logger.test.d.ts.map +1 -0
- package/dist/framework/__tests__/scenario-logger.test.js +110 -0
- package/dist/framework/__tests__/scenario-logger.test.js.map +1 -0
- package/dist/framework/__tests__/validation.test.d.ts +9 -0
- package/dist/framework/__tests__/validation.test.d.ts.map +1 -0
- package/dist/framework/__tests__/validation.test.js +126 -0
- package/dist/framework/__tests__/validation.test.js.map +1 -0
- package/dist/framework/assertions.d.ts +106 -0
- package/dist/framework/assertions.d.ts.map +1 -0
- package/dist/framework/assertions.js +256 -0
- package/dist/framework/assertions.js.map +1 -0
- package/dist/framework/execution/__tests__/execution-engine.test.d.ts +9 -0
- package/dist/framework/execution/__tests__/execution-engine.test.d.ts.map +1 -0
- package/dist/framework/execution/__tests__/execution-engine.test.js +138 -0
- package/dist/framework/execution/__tests__/execution-engine.test.js.map +1 -0
- package/dist/framework/execution/__tests__/fault-builders.test.d.ts +5 -0
- package/dist/framework/execution/__tests__/fault-builders.test.d.ts.map +1 -0
- package/dist/framework/execution/__tests__/fault-builders.test.js +23 -0
- package/dist/framework/execution/__tests__/fault-builders.test.js.map +1 -0
- package/dist/framework/execution/__tests__/fault-model.test.d.ts +6 -0
- package/dist/framework/execution/__tests__/fault-model.test.d.ts.map +1 -0
- package/dist/framework/execution/__tests__/fault-model.test.js +64 -0
- package/dist/framework/execution/__tests__/fault-model.test.js.map +1 -0
- package/dist/framework/execution/__tests__/http-target.test.d.ts +5 -0
- package/dist/framework/execution/__tests__/http-target.test.d.ts.map +1 -0
- package/dist/framework/execution/__tests__/http-target.test.js +36 -0
- package/dist/framework/execution/__tests__/http-target.test.js.map +1 -0
- package/dist/framework/execution/__tests__/run-load-window.test.d.ts +7 -0
- package/dist/framework/execution/__tests__/run-load-window.test.d.ts.map +1 -0
- package/dist/framework/execution/__tests__/run-load-window.test.js +89 -0
- package/dist/framework/execution/__tests__/run-load-window.test.js.map +1 -0
- package/dist/framework/execution/execution-engine.d.ts +55 -0
- package/dist/framework/execution/execution-engine.d.ts.map +1 -0
- package/dist/framework/execution/execution-engine.js +111 -0
- package/dist/framework/execution/execution-engine.js.map +1 -0
- package/dist/framework/execution/fault-builders.d.ts +26 -0
- package/dist/framework/execution/fault-builders.d.ts.map +1 -0
- package/dist/framework/execution/fault-builders.js +24 -0
- package/dist/framework/execution/fault-builders.js.map +1 -0
- package/dist/framework/execution/fault-model.d.ts +49 -0
- package/dist/framework/execution/fault-model.d.ts.map +1 -0
- package/dist/framework/execution/fault-model.js +108 -0
- package/dist/framework/execution/fault-model.js.map +1 -0
- package/dist/framework/execution/fault-spec.d.ts +40 -0
- package/dist/framework/execution/fault-spec.d.ts.map +1 -0
- package/dist/framework/execution/fault-spec.js +23 -0
- package/dist/framework/execution/fault-spec.js.map +1 -0
- package/dist/framework/execution/http-target.d.ts +34 -0
- package/dist/framework/execution/http-target.d.ts.map +1 -0
- package/dist/framework/execution/http-target.js +41 -0
- package/dist/framework/execution/http-target.js.map +1 -0
- package/dist/framework/execution/latency-tracker.d.ts +44 -0
- package/dist/framework/execution/latency-tracker.d.ts.map +1 -0
- package/dist/framework/execution/latency-tracker.js +76 -0
- package/dist/framework/execution/latency-tracker.js.map +1 -0
- package/dist/framework/execution/run-load-window.d.ts +45 -0
- package/dist/framework/execution/run-load-window.d.ts.map +1 -0
- package/dist/framework/execution/run-load-window.js +136 -0
- package/dist/framework/execution/run-load-window.js.map +1 -0
- package/dist/framework/execution/scenario-aborted-error.d.ts +14 -0
- package/dist/framework/execution/scenario-aborted-error.d.ts.map +1 -0
- package/dist/framework/execution/scenario-aborted-error.js +24 -0
- package/dist/framework/execution/scenario-aborted-error.js.map +1 -0
- package/dist/framework/execution/target.d.ts +35 -0
- package/dist/framework/execution/target.d.ts.map +1 -0
- package/dist/framework/execution/target.js +21 -0
- package/dist/framework/execution/target.js.map +1 -0
- package/dist/framework/registry.d.ts +67 -0
- package/dist/framework/registry.d.ts.map +1 -0
- package/dist/framework/registry.js +113 -0
- package/dist/framework/registry.js.map +1 -0
- package/dist/framework/resolve-metric.d.ts +79 -0
- package/dist/framework/resolve-metric.d.ts.map +1 -0
- package/dist/framework/resolve-metric.js +135 -0
- package/dist/framework/resolve-metric.js.map +1 -0
- package/dist/framework/result-builder.d.ts +72 -0
- package/dist/framework/result-builder.d.ts.map +1 -0
- package/dist/framework/result-builder.js +214 -0
- package/dist/framework/result-builder.js.map +1 -0
- package/dist/framework/result-renderers.d.ts +37 -0
- package/dist/framework/result-renderers.d.ts.map +1 -0
- package/dist/framework/result-renderers.js +62 -0
- package/dist/framework/result-renderers.js.map +1 -0
- package/dist/framework/runnable-scenario.d.ts +37 -0
- package/dist/framework/runnable-scenario.d.ts.map +1 -0
- package/dist/framework/runnable-scenario.js +9 -0
- package/dist/framework/runnable-scenario.js.map +1 -0
- package/dist/framework/scenario-executor-result.d.ts +44 -0
- package/dist/framework/scenario-executor-result.d.ts.map +1 -0
- package/dist/framework/scenario-executor-result.js +13 -0
- package/dist/framework/scenario-executor-result.js.map +1 -0
- package/dist/framework/scenario-logger.d.ts +18 -0
- package/dist/framework/scenario-logger.d.ts.map +1 -0
- package/dist/framework/scenario-logger.js +39 -0
- package/dist/framework/scenario-logger.js.map +1 -0
- package/dist/framework/scenario-metric-key.d.ts +24 -0
- package/dist/framework/scenario-metric-key.d.ts.map +1 -0
- package/dist/framework/scenario-metric-key.js +17 -0
- package/dist/framework/scenario-metric-key.js.map +1 -0
- package/dist/framework/validation.d.ts +83 -0
- package/dist/framework/validation.d.ts.map +1 -0
- package/dist/framework/validation.js +93 -0
- package/dist/framework/validation.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/internal.d.ts +19 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +16 -0
- package/dist/internal.js.map +1 -0
- package/dist/kinds/chaos/__tests__/executor.test.d.ts +6 -0
- package/dist/kinds/chaos/__tests__/executor.test.d.ts.map +1 -0
- package/dist/kinds/chaos/__tests__/executor.test.js +117 -0
- package/dist/kinds/chaos/__tests__/executor.test.js.map +1 -0
- package/dist/kinds/chaos/config.d.ts +48 -0
- package/dist/kinds/chaos/config.d.ts.map +1 -0
- package/dist/kinds/chaos/config.js +15 -0
- package/dist/kinds/chaos/config.js.map +1 -0
- package/dist/kinds/chaos/define.d.ts +32 -0
- package/dist/kinds/chaos/define.d.ts.map +1 -0
- package/dist/kinds/chaos/define.js +111 -0
- package/dist/kinds/chaos/define.js.map +1 -0
- package/dist/kinds/chaos/executor.d.ts +21 -0
- package/dist/kinds/chaos/executor.d.ts.map +1 -0
- package/dist/kinds/chaos/executor.js +107 -0
- package/dist/kinds/chaos/executor.js.map +1 -0
- package/dist/kinds/chaos/result.d.ts +43 -0
- package/dist/kinds/chaos/result.d.ts.map +1 -0
- package/dist/kinds/chaos/result.js +12 -0
- package/dist/kinds/chaos/result.js.map +1 -0
- package/dist/kinds/load/__tests__/executor.test.d.ts +6 -0
- package/dist/kinds/load/__tests__/executor.test.d.ts.map +1 -0
- package/dist/kinds/load/__tests__/executor.test.js +75 -0
- package/dist/kinds/load/__tests__/executor.test.js.map +1 -0
- package/dist/kinds/load/config.d.ts +30 -0
- package/dist/kinds/load/config.d.ts.map +1 -0
- package/dist/kinds/load/config.js +9 -0
- package/dist/kinds/load/config.js.map +1 -0
- package/dist/kinds/load/define.d.ts +47 -0
- package/dist/kinds/load/define.d.ts.map +1 -0
- package/dist/kinds/load/define.js +76 -0
- package/dist/kinds/load/define.js.map +1 -0
- package/dist/kinds/load/executor.d.ts +16 -0
- package/dist/kinds/load/executor.d.ts.map +1 -0
- package/dist/kinds/load/executor.js +90 -0
- package/dist/kinds/load/executor.js.map +1 -0
- package/dist/kinds/load/result.d.ts +21 -0
- package/dist/kinds/load/result.d.ts.map +1 -0
- package/dist/kinds/load/result.js +10 -0
- package/dist/kinds/load/result.js.map +1 -0
- package/dist/persistence/session-payload.d.ts +32 -0
- package/dist/persistence/session-payload.d.ts.map +1 -0
- package/dist/persistence/session-payload.js +46 -0
- package/dist/persistence/session-payload.js.map +1 -0
- package/dist/persistence/session-replay.d.ts +13 -0
- package/dist/persistence/session-replay.d.ts.map +1 -0
- package/dist/persistence/session-replay.js +76 -0
- package/dist/persistence/session-replay.js.map +1 -0
- package/dist/persistence/session-replay.test.d.ts +10 -0
- package/dist/persistence/session-replay.test.d.ts.map +1 -0
- package/dist/persistence/session-replay.test.js +169 -0
- package/dist/persistence/session-replay.test.js.map +1 -0
- package/dist/plugins/__tests__/loader-scenarios.test.d.ts +12 -0
- package/dist/plugins/__tests__/loader-scenarios.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/loader-scenarios.test.js +61 -0
- package/dist/plugins/__tests__/loader-scenarios.test.js.map +1 -0
- package/dist/plugins/__tests__/scenario-package-discovery.test.d.ts +2 -0
- package/dist/plugins/__tests__/scenario-package-discovery.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/scenario-package-discovery.test.js +43 -0
- package/dist/plugins/__tests__/scenario-package-discovery.test.js.map +1 -0
- package/dist/plugins/loader.d.ts +32 -0
- package/dist/plugins/loader.d.ts.map +1 -0
- package/dist/plugins/loader.js +119 -0
- package/dist/plugins/loader.js.map +1 -0
- package/dist/plugins/scenario-package-discovery.d.ts +23 -0
- package/dist/plugins/scenario-package-discovery.d.ts.map +1 -0
- package/dist/plugins/scenario-package-discovery.js +42 -0
- package/dist/plugins/scenario-package-discovery.js.map +1 -0
- package/dist/plugins/types.d.ts +24 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +18 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/recipes/__tests__/recipes.test.d.ts +2 -0
- package/dist/recipes/__tests__/recipes.test.d.ts.map +1 -0
- package/dist/recipes/__tests__/recipes.test.js +515 -0
- package/dist/recipes/__tests__/recipes.test.js.map +1 -0
- package/dist/recipes/built-in-recipes.d.ts +16 -0
- package/dist/recipes/built-in-recipes.d.ts.map +1 -0
- package/dist/recipes/built-in-recipes.js +37 -0
- package/dist/recipes/built-in-recipes.js.map +1 -0
- package/dist/recipes/define-recipe.d.ts +29 -0
- package/dist/recipes/define-recipe.d.ts.map +1 -0
- package/dist/recipes/define-recipe.js +68 -0
- package/dist/recipes/define-recipe.js.map +1 -0
- package/dist/recipes/registry.d.ts +54 -0
- package/dist/recipes/registry.d.ts.map +1 -0
- package/dist/recipes/registry.js +89 -0
- package/dist/recipes/registry.js.map +1 -0
- package/dist/recipes/service.d.ts +61 -0
- package/dist/recipes/service.d.ts.map +1 -0
- package/dist/recipes/service.js +205 -0
- package/dist/recipes/service.js.map +1 -0
- package/dist/recipes/types.d.ts +62 -0
- package/dist/recipes/types.d.ts.map +1 -0
- package/dist/recipes/types.js +10 -0
- package/dist/recipes/types.js.map +1 -0
- package/dist/scaffold/examples.d.ts +22 -0
- package/dist/scaffold/examples.d.ts.map +1 -0
- package/dist/scaffold/examples.js +91 -0
- package/dist/scaffold/examples.js.map +1 -0
- package/dist/scope-augmentation.d.ts +70 -0
- package/dist/scope-augmentation.d.ts.map +1 -0
- package/dist/scope-augmentation.js +28 -0
- package/dist/scope-augmentation.js.map +1 -0
- package/dist/tool.d.ts +21 -0
- package/dist/tool.d.ts.map +1 -0
- package/dist/tool.js +347 -0
- package/dist/tool.js.map +1 -0
- package/dist/types/base-types.d.ts +35 -0
- package/dist/types/base-types.d.ts.map +1 -0
- package/dist/types/base-types.js +8 -0
- package/dist/types/base-types.js.map +1 -0
- package/dist/types/framework-types.d.ts +62 -0
- package/dist/types/framework-types.d.ts.map +1 -0
- package/dist/types/framework-types.js +15 -0
- package/dist/types/framework-types.js.map +1 -0
- package/dist/types/kind-types.d.ts +24 -0
- package/dist/types/kind-types.d.ts.map +1 -0
- package/dist/types/kind-types.js +22 -0
- package/dist/types/kind-types.js.map +1 -0
- package/dist/types/workload.d.ts +30 -0
- package/dist/types/workload.d.ts.map +1 -0
- package/dist/types/workload.js +20 -0
- package/dist/types/workload.js.map +1 -0
- package/package.json +120 -0
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Smoke tests for simulationTool — the Tool plugin
|
|
3
|
+
* descriptor wired into the CLI dispatcher.
|
|
4
|
+
*
|
|
5
|
+
* Since release 2.11.0 Phase 3 (the reference migration) sim mounts via a
|
|
6
|
+
* declarative `CommandSpec` (`simulationTool.commandSpecs`) rather than the
|
|
7
|
+
* deprecated `register()` hook. The host-owned mount path
|
|
8
|
+
* (`mountCommandSpec` → parse → handler → dispatch) is covered in
|
|
9
|
+
* `cli/src/__tests__/mount-command-spec.test.ts`; this file exercises the
|
|
10
|
+
* descriptor metadata, the declared command surface, and the command
|
|
11
|
+
* handler directly with a fake ToolCliContext (the handler is what the host
|
|
12
|
+
* invokes after parsing).
|
|
13
|
+
*/
|
|
14
|
+
import { readFileSync } from 'node:fs';
|
|
15
|
+
import { dirname, resolve } from 'node:path';
|
|
16
|
+
import { fileURLToPath } from 'node:url';
|
|
17
|
+
import { enterScope, RunScope } from '@opensip-cli/core';
|
|
18
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
19
|
+
import { ASSERTIONS } from '../framework/assertions.js';
|
|
20
|
+
import { clearScenarioRegistry, currentScenarioRegistry } from '../framework/registry.js';
|
|
21
|
+
import { defineLoadScenario } from '../kinds/load/define.js';
|
|
22
|
+
import { simulationTool } from '../tool.js';
|
|
23
|
+
import { noopTarget } from './test-utils/targets.js';
|
|
24
|
+
const HERE = dirname(fileURLToPath(import.meta.url));
|
|
25
|
+
const PKG = JSON.parse(readFileSync(resolve(HERE, '../../package.json'), 'utf8'));
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
// Item 1: scenarioRegistry and recipe registry are per-RunScope.
|
|
28
|
+
// Construct a fresh scope (with simulation extended) and enter it via
|
|
29
|
+
// AsyncLocalStorage so the handler resolves them through currentScope()
|
|
30
|
+
// while it runs.
|
|
31
|
+
const scope = new RunScope();
|
|
32
|
+
Object.assign(scope, simulationTool.contributeScope?.() ?? {});
|
|
33
|
+
enterScope(scope);
|
|
34
|
+
});
|
|
35
|
+
afterEach(() => {
|
|
36
|
+
clearScenarioRegistry();
|
|
37
|
+
});
|
|
38
|
+
/** The single declarative `sim` command sim now exports. */
|
|
39
|
+
function simSpec() {
|
|
40
|
+
const spec = simulationTool.commandSpecs?.[0];
|
|
41
|
+
if (spec === undefined)
|
|
42
|
+
throw new Error('simulationTool exposes no commandSpecs');
|
|
43
|
+
return spec;
|
|
44
|
+
}
|
|
45
|
+
function makeFakeContext() {
|
|
46
|
+
const rendered = [];
|
|
47
|
+
const exitCodes = [];
|
|
48
|
+
const emitted = [];
|
|
49
|
+
const delivered = [];
|
|
50
|
+
const project = {
|
|
51
|
+
cwd: '/test',
|
|
52
|
+
cwdExplicit: false,
|
|
53
|
+
projectRoot: '/test',
|
|
54
|
+
configPath: undefined,
|
|
55
|
+
walkedUp: 0,
|
|
56
|
+
scope: 'none',
|
|
57
|
+
};
|
|
58
|
+
// The handler uses currentScope() (set by enterScope in beforeEach), not
|
|
59
|
+
// cli.scope, but ToolCliContext requires a scope value; mirror project
|
|
60
|
+
// into a throwaway scope here.
|
|
61
|
+
const ctxScope = new RunScope({ projectContext: project });
|
|
62
|
+
Object.assign(ctxScope, simulationTool.contributeScope?.() ?? {});
|
|
63
|
+
const ctx = {
|
|
64
|
+
scope: ctxScope,
|
|
65
|
+
render: vi.fn((result) => {
|
|
66
|
+
rendered.push(result);
|
|
67
|
+
return Promise.resolve();
|
|
68
|
+
}),
|
|
69
|
+
registerLiveView: vi.fn(),
|
|
70
|
+
renderLive: vi.fn(() => Promise.resolve()),
|
|
71
|
+
maybeOpenReport: vi.fn(() => Promise.resolve()),
|
|
72
|
+
logger: {
|
|
73
|
+
debug: vi.fn(),
|
|
74
|
+
info: vi.fn(),
|
|
75
|
+
warn: vi.fn(),
|
|
76
|
+
error: vi.fn(),
|
|
77
|
+
},
|
|
78
|
+
setExitCode: (code) => {
|
|
79
|
+
exitCodes.push(code);
|
|
80
|
+
},
|
|
81
|
+
emitJson: (value) => {
|
|
82
|
+
emitted.push(value);
|
|
83
|
+
},
|
|
84
|
+
emitRaw: (value) => {
|
|
85
|
+
emitted.push(value);
|
|
86
|
+
},
|
|
87
|
+
emitEnvelope: (value) => {
|
|
88
|
+
emitted.push(value);
|
|
89
|
+
},
|
|
90
|
+
emitError: (detail) => {
|
|
91
|
+
exitCodes.push(detail.exitCode);
|
|
92
|
+
emitted.push(detail);
|
|
93
|
+
},
|
|
94
|
+
deliverSignals: (_envelope, opts) => {
|
|
95
|
+
delivered.push(opts);
|
|
96
|
+
return Promise.resolve({ cloudAccepted: 0 });
|
|
97
|
+
},
|
|
98
|
+
writeSarif: () => Promise.resolve(),
|
|
99
|
+
saveBaseline: () => Promise.resolve(),
|
|
100
|
+
compareBaseline: () => Promise.resolve({
|
|
101
|
+
added: [],
|
|
102
|
+
resolved: [],
|
|
103
|
+
unchanged: [],
|
|
104
|
+
degraded: false,
|
|
105
|
+
}),
|
|
106
|
+
exportBaselineSarif: () => Promise.resolve(),
|
|
107
|
+
exportBaselineFingerprints: () => Promise.resolve(),
|
|
108
|
+
toolState: {
|
|
109
|
+
get: () => Promise.resolve(undefined),
|
|
110
|
+
put: () => Promise.resolve(),
|
|
111
|
+
delete: () => Promise.resolve(),
|
|
112
|
+
list: () => Promise.resolve([]),
|
|
113
|
+
},
|
|
114
|
+
runSession: {
|
|
115
|
+
timing: {
|
|
116
|
+
startedAt: new Date().toISOString(),
|
|
117
|
+
startedAtEpochMs: Date.now(),
|
|
118
|
+
elapsedMs: () => 0,
|
|
119
|
+
snapshot: () => ({
|
|
120
|
+
startedAt: new Date().toISOString(),
|
|
121
|
+
completedAt: new Date().toISOString(),
|
|
122
|
+
durationMs: 0,
|
|
123
|
+
}),
|
|
124
|
+
complete: () => ({
|
|
125
|
+
startedAt: new Date().toISOString(),
|
|
126
|
+
completedAt: new Date().toISOString(),
|
|
127
|
+
durationMs: 0,
|
|
128
|
+
}),
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
return { ctx, rendered, exitCodes, emitted, delivered };
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Register one trivial load scenario into the current scope's registry so a
|
|
136
|
+
* `sim` run has work to do. Since the zero-scenario fail-closed guard (audit
|
|
137
|
+
* P1c), a run with an empty registry returns an ErrorResult (exit 2) rather
|
|
138
|
+
* than a sim-done pass — happy-path tests must supply at least one scenario.
|
|
139
|
+
*/
|
|
140
|
+
function registerProbeScenario() {
|
|
141
|
+
currentScenarioRegistry().register(defineLoadScenario({
|
|
142
|
+
id: 'probe',
|
|
143
|
+
name: 'probe',
|
|
144
|
+
description: 'probe',
|
|
145
|
+
tags: [],
|
|
146
|
+
target: noopTarget,
|
|
147
|
+
workload: { rps: 1 },
|
|
148
|
+
duration: 1,
|
|
149
|
+
assertions: [ASSERTIONS.lowErrorRate(1)],
|
|
150
|
+
}));
|
|
151
|
+
}
|
|
152
|
+
describe('simulationTool metadata', () => {
|
|
153
|
+
it('exposes name (human), id (stable UUID), version, description', () => {
|
|
154
|
+
expect(simulationTool.metadata.name).toBe('simulation');
|
|
155
|
+
expect(simulationTool.metadata.id).toBe('715d32c2-692c-4ed4-985b-a35deaf186aa');
|
|
156
|
+
expect(simulationTool.metadata.version).toBe(PKG.version);
|
|
157
|
+
expect(simulationTool.metadata.description).toContain('simulation');
|
|
158
|
+
});
|
|
159
|
+
it('declares the user-facing sim subcommand (+ the internal worker)', () => {
|
|
160
|
+
const names = simulationTool.commands.map((c) => c.name);
|
|
161
|
+
expect(names).toContain('sim');
|
|
162
|
+
// The internal off-main-process worker (ADR-0028), forked by the live view.
|
|
163
|
+
expect(names).toContain('sim-run-worker');
|
|
164
|
+
expect(simulationTool.commands).toHaveLength(2);
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
describe('simulationTool command surface (Phase 3 — CommandSpec migration)', () => {
|
|
168
|
+
it('mounts via commandSpecs — the one command surface (register() removed in 3.0.0)', () => {
|
|
169
|
+
// `sim` + the internal `sim-run-worker` (ADR-0028).
|
|
170
|
+
expect(simulationTool.commandSpecs).toHaveLength(2);
|
|
171
|
+
// `register` is no longer a Tool member (3.0.0) — its absence is structural,
|
|
172
|
+
// enforced by the type system, not asserted at runtime.
|
|
173
|
+
});
|
|
174
|
+
it('declares the sim command name/description/output/scope', () => {
|
|
175
|
+
const spec = simSpec();
|
|
176
|
+
expect(spec.name).toBe('sim');
|
|
177
|
+
expect(spec.description).toBe('Run simulation scenarios');
|
|
178
|
+
// The handler owns its full output surface (TTY-vs-static branch + egress).
|
|
179
|
+
expect(spec.output).toBe('raw-stream');
|
|
180
|
+
expect(spec.scope).toBe('project');
|
|
181
|
+
expect(typeof spec.handler).toBe('function');
|
|
182
|
+
});
|
|
183
|
+
it('declares the ADR-0021 common flags and the --recipe option', () => {
|
|
184
|
+
const spec = simSpec();
|
|
185
|
+
// Cross-tool flags from the single registry (ADR-0021).
|
|
186
|
+
expect([...spec.commonFlags]).toEqual(expect.arrayContaining([
|
|
187
|
+
'cwd',
|
|
188
|
+
'json',
|
|
189
|
+
'quiet',
|
|
190
|
+
'verbose',
|
|
191
|
+
'debug',
|
|
192
|
+
'reportTo',
|
|
193
|
+
'apiKey',
|
|
194
|
+
'open',
|
|
195
|
+
]));
|
|
196
|
+
const optionFlags = (spec.options ?? []).map((o) => o.flag);
|
|
197
|
+
expect(optionFlags).toContain('--recipe');
|
|
198
|
+
const recipe = (spec.options ?? []).find((o) => o.flag === '--recipe');
|
|
199
|
+
expect(recipe?.value).toBe('<name>');
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
describe('sim command handler', () => {
|
|
203
|
+
it('runs against the default recipe and renders the result', async () => {
|
|
204
|
+
const { ctx, rendered } = makeFakeContext();
|
|
205
|
+
registerProbeScenario();
|
|
206
|
+
// Non-TTY/non-json path: the handler runs the engine and renders statically.
|
|
207
|
+
await simSpec().handler({ cwd: process.cwd() }, ctx);
|
|
208
|
+
expect(rendered).toHaveLength(1);
|
|
209
|
+
const result = rendered[0];
|
|
210
|
+
expect(result.type).toBe('sim-done');
|
|
211
|
+
expect(result.recipeName).toBe('default');
|
|
212
|
+
});
|
|
213
|
+
it('emits the signal envelope through cli.emitEnvelope when --json is passed', async () => {
|
|
214
|
+
const { ctx, emitted } = makeFakeContext();
|
|
215
|
+
registerProbeScenario();
|
|
216
|
+
await simSpec().handler({ cwd: process.cwd(), json: true }, ctx);
|
|
217
|
+
// ADR-0011 (Phase 4): --json routes the SignalEnvelope (not the bespoke
|
|
218
|
+
// SimDoneResult) through the root's emitEnvelope → formatSignalJson.
|
|
219
|
+
expect(emitted).toHaveLength(1);
|
|
220
|
+
const payload = emitted[0];
|
|
221
|
+
expect(payload.schemaVersion).toBe(2);
|
|
222
|
+
expect(payload.tool).toBe('sim');
|
|
223
|
+
});
|
|
224
|
+
it('delivers static egress with the requested cwd', async () => {
|
|
225
|
+
const { ctx, delivered } = makeFakeContext();
|
|
226
|
+
registerProbeScenario();
|
|
227
|
+
await simSpec().handler({ cwd: HERE, json: true }, ctx);
|
|
228
|
+
expect(delivered).toHaveLength(1);
|
|
229
|
+
expect(delivered[0]).toMatchObject({ cwd: HERE });
|
|
230
|
+
});
|
|
231
|
+
it('returns exit code 2 in JSON mode when the recipe is unknown', async () => {
|
|
232
|
+
const { ctx, exitCodes, emitted } = makeFakeContext();
|
|
233
|
+
await simSpec().handler({ cwd: process.cwd(), json: true, recipe: 'nope' }, ctx);
|
|
234
|
+
expect(exitCodes).toContain(2);
|
|
235
|
+
expect(emitted).toHaveLength(1);
|
|
236
|
+
// 2.12.0: a failed --json run emits a structured error detail (`message`),
|
|
237
|
+
// not a bare `{ error }` (the host wraps it in a status:'error' outcome).
|
|
238
|
+
const payload = emitted[0];
|
|
239
|
+
expect(payload.message).toContain('Unknown sim recipe');
|
|
240
|
+
});
|
|
241
|
+
it('returns exit code 2 in non-JSON mode for unknown recipe', async () => {
|
|
242
|
+
const { ctx, exitCodes, rendered } = makeFakeContext();
|
|
243
|
+
await simSpec().handler({ cwd: process.cwd(), recipe: 'still-nope' }, ctx);
|
|
244
|
+
expect(exitCodes).toContain(2);
|
|
245
|
+
const errResult = rendered[0];
|
|
246
|
+
expect(errResult.type).toBe('error');
|
|
247
|
+
expect(errResult.message).toContain('still-nope');
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
//# sourceMappingURL=tool.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool.test.js","sourceRoot":"","sources":["../../src/__tests__/tool.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAEzE,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAC1F,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,YA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AuC,CAAC;QACpE,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACrC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-config.test.d.ts","sourceRoot":"","sources":["../../../src/cli/__tests__/sim-config.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import { tmpdir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { runWithScopeSync } from '@opensip-cli/core';
|
|
5
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
6
|
+
import { makeSimTestScope } from '../../__tests__/test-utils/with-sim-scope.js';
|
|
7
|
+
import { resolveSimRecipeSelection } from '../sim-config.js';
|
|
8
|
+
/**
|
|
9
|
+
* `resolveSimRecipeSelection` reads `simulation.recipe` from the project config
|
|
10
|
+
* (permissively — sim must not depend on fitness's strict schema) and applies
|
|
11
|
+
* ADR-0022 precedence.
|
|
12
|
+
*/
|
|
13
|
+
describe('resolveSimRecipeSelection (ADR-0022)', () => {
|
|
14
|
+
let dir;
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
dir = mkdtempSync(join(tmpdir(), 'opensip-sim-cfg-'));
|
|
17
|
+
});
|
|
18
|
+
afterEach(() => {
|
|
19
|
+
rmSync(dir, { recursive: true, force: true });
|
|
20
|
+
});
|
|
21
|
+
const write = (yaml) => {
|
|
22
|
+
writeFileSync(join(dir, 'opensip-cli.config.yml'), yaml);
|
|
23
|
+
};
|
|
24
|
+
it('explicit --recipe wins and is strict', () => {
|
|
25
|
+
write('simulation:\n recipe: from-config\n');
|
|
26
|
+
expect(resolveSimRecipeSelection(dir, 'explicit')).toMatchObject({
|
|
27
|
+
name: 'explicit',
|
|
28
|
+
source: 'flag',
|
|
29
|
+
tolerant: false,
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
it('reads simulation.recipe when no flag', () => {
|
|
33
|
+
write('simulation:\n recipe: smoke\n');
|
|
34
|
+
expect(resolveSimRecipeSelection(dir, undefined)).toMatchObject({
|
|
35
|
+
name: 'smoke',
|
|
36
|
+
source: 'tool-config',
|
|
37
|
+
tolerant: true,
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
it('ignores cli.recipe now that the fallback was removed', () => {
|
|
41
|
+
write('cli:\n recipe: opensip\n');
|
|
42
|
+
expect(resolveSimRecipeSelection(dir, undefined)).toMatchObject({
|
|
43
|
+
name: 'default',
|
|
44
|
+
source: 'builtin',
|
|
45
|
+
tolerant: true,
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
it('returns the builtin default when no config file exists', () => {
|
|
49
|
+
expect(resolveSimRecipeSelection(dir, undefined)).toMatchObject({
|
|
50
|
+
name: 'default',
|
|
51
|
+
source: 'builtin',
|
|
52
|
+
tolerant: true,
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
it('ignores a non-string simulation.recipe (malformed) and falls through', () => {
|
|
56
|
+
write('simulation:\n recipe:\n - not-a-string\ncli:\n recipe: from-cli\n');
|
|
57
|
+
expect(resolveSimRecipeSelection(dir, undefined)).toMatchObject({
|
|
58
|
+
name: 'default',
|
|
59
|
+
source: 'builtin',
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
it('returns builtin default when simulation: block is not a mapping', () => {
|
|
63
|
+
write('simulation: just-a-scalar\n');
|
|
64
|
+
expect(resolveSimRecipeSelection(dir, undefined)).toMatchObject({
|
|
65
|
+
name: 'default',
|
|
66
|
+
source: 'builtin',
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
// ADR-0023, Phase 4: when a RunScope is present, sim reads `simulation.recipe`
|
|
70
|
+
// off the host-RESOLVED `scope.toolConfig.simulation` block, NOT a second YAML
|
|
71
|
+
// read. These prove the value comes from the scope (and that the on-disk file
|
|
72
|
+
// is ignored when the scope is present).
|
|
73
|
+
describe('reads simulation.recipe off scope.toolConfig.simulation', () => {
|
|
74
|
+
it('returns the resolved scope recipe, ignoring the on-disk simulation.recipe', () => {
|
|
75
|
+
// On-disk says `from-file`; a second YAML read would surface it. The scope
|
|
76
|
+
// says `from-scope` — sim must return the SCOPE value.
|
|
77
|
+
write('simulation:\n recipe: from-file\n');
|
|
78
|
+
const scope = makeSimTestScope();
|
|
79
|
+
Object.assign(scope, { toolConfig: { simulation: { recipe: 'from-scope' } } });
|
|
80
|
+
const resolved = runWithScopeSync(scope, () => resolveSimRecipeSelection(dir, undefined));
|
|
81
|
+
expect(resolved).toMatchObject({ name: 'from-scope', source: 'tool-config' });
|
|
82
|
+
});
|
|
83
|
+
it('returns builtin default when the scope simulation block has no recipe', () => {
|
|
84
|
+
// Scope simulation block is empty → no tool recipe, so the builtin default
|
|
85
|
+
// supplies the fallback.
|
|
86
|
+
write('cli:\n recipe: from-cli\n');
|
|
87
|
+
const scope = makeSimTestScope();
|
|
88
|
+
Object.assign(scope, { toolConfig: { simulation: {} } });
|
|
89
|
+
const resolved = runWithScopeSync(scope, () => resolveSimRecipeSelection(dir, undefined));
|
|
90
|
+
expect(resolved).toMatchObject({ name: 'default', source: 'builtin' });
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
//# sourceMappingURL=sim-config.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-config.test.js","sourceRoot":"","sources":["../../../src/cli/__tests__/sim-config.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,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machine
|
|
3
|
+
* (ADR-0016). Drives `<SimRunner>` directly under ink-testing-library — no real
|
|
4
|
+
* TTY `render()` host — and asserts the rendered frames reflect each phase:
|
|
5
|
+
*
|
|
6
|
+
* - loading → running → done: the banner/run-header, the live spinner, and
|
|
7
|
+
* the final pass/fail RunSummary, with the run's SignalEnvelope handed back
|
|
8
|
+
* via `onEnvelope`.
|
|
9
|
+
* - failing scenario: `setExitCode(RUNTIME_ERROR)` fires when a scenario
|
|
10
|
+
* fails (the run still completes and shows a summary).
|
|
11
|
+
* - unknown recipe: the error phase renders <ErrorMessage> and reports the
|
|
12
|
+
* configuration exit code.
|
|
13
|
+
* - `--quiet`: the banner/header block is suppressed, leaving only the
|
|
14
|
+
* summary.
|
|
15
|
+
* - `mini` banner with an available update: the inline UpdateHint renders.
|
|
16
|
+
*
|
|
17
|
+
* The assertions inspect event-driven frame content (labels, counters,
|
|
18
|
+
* pass/fail glyphs), never the animated spinner frame, so they're
|
|
19
|
+
* deterministic. `waitForFrame` polls the latest frame to absorb React's async
|
|
20
|
+
* re-renders.
|
|
21
|
+
*/
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=sim-runner.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-runner.test.d.ts","sourceRoot":"","sources":["../../../src/cli/__tests__/sim-runner.test.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Behavioural tests for the `sim` live-view state machine
|
|
4
|
+
* (ADR-0016). Drives `<SimRunner>` directly under ink-testing-library — no real
|
|
5
|
+
* TTY `render()` host — and asserts the rendered frames reflect each phase:
|
|
6
|
+
*
|
|
7
|
+
* - loading → running → done: the banner/run-header, the live spinner, and
|
|
8
|
+
* the final pass/fail RunSummary, with the run's SignalEnvelope handed back
|
|
9
|
+
* via `onEnvelope`.
|
|
10
|
+
* - failing scenario: `setExitCode(RUNTIME_ERROR)` fires when a scenario
|
|
11
|
+
* fails (the run still completes and shows a summary).
|
|
12
|
+
* - unknown recipe: the error phase renders <ErrorMessage> and reports the
|
|
13
|
+
* configuration exit code.
|
|
14
|
+
* - `--quiet`: the banner/header block is suppressed, leaving only the
|
|
15
|
+
* summary.
|
|
16
|
+
* - `mini` banner with an available update: the inline UpdateHint renders.
|
|
17
|
+
*
|
|
18
|
+
* The assertions inspect event-driven frame content (labels, counters,
|
|
19
|
+
* pass/fail glyphs), never the animated spinner frame, so they're
|
|
20
|
+
* deterministic. `waitForFrame` polls the latest frame to absorb React's async
|
|
21
|
+
* re-renders.
|
|
22
|
+
*/
|
|
23
|
+
import { enterScope, RunScope } from '@opensip-cli/core';
|
|
24
|
+
import { render } from 'ink-testing-library';
|
|
25
|
+
import { afterAll, afterEach, beforeAll, describe, expect, it } from 'vitest';
|
|
26
|
+
import { noopTarget } from '../../__tests__/test-utils/targets.js';
|
|
27
|
+
import { ASSERTIONS } from '../../framework/assertions.js';
|
|
28
|
+
import { clearScenarioRegistry, currentScenarioRegistry } from '../../framework/registry.js';
|
|
29
|
+
import { defineLoadScenario } from '../../kinds/load/define.js';
|
|
30
|
+
import { simulationTool } from '../../tool.js';
|
|
31
|
+
import { SimRunner } from '../sim-runner.js';
|
|
32
|
+
// The live runner forks `sim-run-worker` off the main process (ADR-0028), but in
|
|
33
|
+
// the test runner `process.argv[1]` is vitest, not the CLI — so force the
|
|
34
|
+
// in-process fallback, which exercises the SimRunner state machine directly
|
|
35
|
+
// against the scope each test sets up. (The fork path is covered by a dedicated
|
|
36
|
+
// subprocess harness, not the component unit tests.)
|
|
37
|
+
beforeAll(() => {
|
|
38
|
+
process.env.OPENSIP_CLI_NO_WORKER = '1';
|
|
39
|
+
});
|
|
40
|
+
afterAll(() => {
|
|
41
|
+
delete process.env.OPENSIP_CLI_NO_WORKER;
|
|
42
|
+
});
|
|
43
|
+
afterEach(() => {
|
|
44
|
+
// Each test enters its own scope; clear the scenario registry between runs.
|
|
45
|
+
try {
|
|
46
|
+
clearScenarioRegistry();
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
// No active scope (a test that never entered one) — nothing to clear.
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
/** Enter a fresh scope (with the simulation subscope attached) plus any
|
|
53
|
+
* presentation context the header branch under test needs. */
|
|
54
|
+
function enterSimScope(opts = {}) {
|
|
55
|
+
const scope = new RunScope(opts);
|
|
56
|
+
Object.assign(scope, simulationTool.contributeScope?.() ?? {});
|
|
57
|
+
enterScope(scope);
|
|
58
|
+
}
|
|
59
|
+
function registerProbe(id = 'probe') {
|
|
60
|
+
currentScenarioRegistry().register(defineLoadScenario({
|
|
61
|
+
id,
|
|
62
|
+
name: id,
|
|
63
|
+
description: id,
|
|
64
|
+
tags: [],
|
|
65
|
+
target: noopTarget,
|
|
66
|
+
workload: { rps: 1 },
|
|
67
|
+
duration: 1,
|
|
68
|
+
assertions: [ASSERTIONS.lowErrorRate(1)],
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
const baseArgs = (overrides = {}) => ({
|
|
72
|
+
json: false,
|
|
73
|
+
cwd: process.cwd(),
|
|
74
|
+
debug: false,
|
|
75
|
+
...overrides,
|
|
76
|
+
});
|
|
77
|
+
/** Poll the latest frame until it contains `substr` (or time out). */
|
|
78
|
+
async function waitForFrame(lastFrame, substr) {
|
|
79
|
+
for (let i = 0; i < 200; i++) {
|
|
80
|
+
if ((lastFrame() ?? '').includes(substr))
|
|
81
|
+
return;
|
|
82
|
+
await new Promise((resolve) => {
|
|
83
|
+
setTimeout(resolve, 5);
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
describe('<SimRunner> — live-view state machine', () => {
|
|
88
|
+
it('renders the run header, then the final pass summary, and returns the envelope', async () => {
|
|
89
|
+
enterSimScope();
|
|
90
|
+
registerProbe('runner-pass');
|
|
91
|
+
let captured;
|
|
92
|
+
const exitCodes = [];
|
|
93
|
+
const { lastFrame, unmount } = render(_jsx(SimRunner, { args: baseArgs(), setExitCode: (c) => exitCodes.push(c), onEnvelope: (e) => {
|
|
94
|
+
captured = e;
|
|
95
|
+
} }));
|
|
96
|
+
// Header (non-quiet, non-mini default) carries the tool title + recipe.
|
|
97
|
+
await waitForFrame(lastFrame, 'Simulation Scenarios');
|
|
98
|
+
expect(lastFrame()).toContain('Recipe');
|
|
99
|
+
expect(lastFrame()).toContain('default');
|
|
100
|
+
// The run completes; the summary shows the PASS verdict (ADR-0035).
|
|
101
|
+
await waitForFrame(lastFrame, 'PASS');
|
|
102
|
+
const frame = lastFrame() ?? '';
|
|
103
|
+
expect(frame).toContain('PASS');
|
|
104
|
+
// The completed run handed its envelope back to the composition root, and a
|
|
105
|
+
// green run sets no failure exit code.
|
|
106
|
+
expect(captured).toBeDefined();
|
|
107
|
+
expect(captured?.tool).toBe('sim');
|
|
108
|
+
expect(captured?.verdict.passed).toBe(true);
|
|
109
|
+
expect(exitCodes).not.toContain(1);
|
|
110
|
+
unmount();
|
|
111
|
+
});
|
|
112
|
+
it('yields a failing-verdict envelope when a scenario fails (host owns the exit)', async () => {
|
|
113
|
+
enterSimScope();
|
|
114
|
+
// A scenario whose run() rejects → recorded as failed.
|
|
115
|
+
currentScenarioRegistry().register({
|
|
116
|
+
id: 'runner-boom',
|
|
117
|
+
name: 'runner-boom',
|
|
118
|
+
description: 'boom',
|
|
119
|
+
kind: 'load',
|
|
120
|
+
tags: [],
|
|
121
|
+
run: () => Promise.reject(new Error('kaboom')),
|
|
122
|
+
});
|
|
123
|
+
const exitCodes = [];
|
|
124
|
+
let captured;
|
|
125
|
+
const { lastFrame, unmount } = render(_jsx(SimRunner, { args: baseArgs(), setExitCode: (c) => exitCodes.push(c), onEnvelope: (e) => {
|
|
126
|
+
captured = e;
|
|
127
|
+
} }));
|
|
128
|
+
await waitForFrame(lastFrame, 'FAIL');
|
|
129
|
+
// ADR-0035: the runner no longer sets the findings exit — it hands the
|
|
130
|
+
// envelope to the host (via onEnvelope → deliverSignals), which derives the
|
|
131
|
+
// exit from envelope.verdict.passed. The runner itself sets no findings code.
|
|
132
|
+
expect(exitCodes).not.toContain(1);
|
|
133
|
+
expect(captured).toBeDefined();
|
|
134
|
+
expect(captured?.verdict.summary.failed).toBe(1);
|
|
135
|
+
// A thrown scenario fails its unit → the run verdict fails → the host exits 1.
|
|
136
|
+
expect(captured?.verdict.passed).toBe(false);
|
|
137
|
+
unmount();
|
|
138
|
+
});
|
|
139
|
+
it('renders the error phase and reports the config exit code for an unknown recipe', async () => {
|
|
140
|
+
enterSimScope();
|
|
141
|
+
registerProbe('runner-unused');
|
|
142
|
+
const exitCodes = [];
|
|
143
|
+
const { lastFrame, unmount } = render(_jsx(SimRunner, { args: baseArgs({ recipe: 'does-not-exist' }), setExitCode: (c) => exitCodes.push(c) }));
|
|
144
|
+
await waitForFrame(lastFrame, 'does-not-exist');
|
|
145
|
+
expect(lastFrame()).toContain('does-not-exist');
|
|
146
|
+
// CONFIGURATION_ERROR === 2. The exit code is set in the same async tick as
|
|
147
|
+
// the error-phase transition; poll briefly to absorb the React re-render.
|
|
148
|
+
for (let i = 0; i < 50 && !exitCodes.includes(2); i++) {
|
|
149
|
+
await new Promise((resolve) => {
|
|
150
|
+
setTimeout(resolve, 5);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
expect(exitCodes).toContain(2);
|
|
154
|
+
unmount();
|
|
155
|
+
});
|
|
156
|
+
it('suppresses the banner/header block under --quiet but still shows the summary', async () => {
|
|
157
|
+
enterSimScope();
|
|
158
|
+
registerProbe('runner-quiet');
|
|
159
|
+
const { lastFrame, unmount } = render(_jsx(SimRunner, { args: baseArgs({ quiet: true }) }));
|
|
160
|
+
await waitForFrame(lastFrame, 'PASS');
|
|
161
|
+
const frame = lastFrame() ?? '';
|
|
162
|
+
// Quiet drops the run-header chrome…
|
|
163
|
+
expect(frame).not.toContain('Simulation Scenarios');
|
|
164
|
+
// …but keeps the PASS/FAIL verdict summary.
|
|
165
|
+
expect(frame).toContain('PASS');
|
|
166
|
+
unmount();
|
|
167
|
+
});
|
|
168
|
+
it('renders the mini banner update hint when an update is available', async () => {
|
|
169
|
+
enterSimScope({
|
|
170
|
+
ui: { bannerSize: 'mini', version: '3.0.0', update: '3.1.0' },
|
|
171
|
+
projectContext: {
|
|
172
|
+
cwd: process.cwd(),
|
|
173
|
+
cwdExplicit: false,
|
|
174
|
+
projectRoot: process.cwd(),
|
|
175
|
+
configPath: undefined,
|
|
176
|
+
walkedUp: 0,
|
|
177
|
+
scope: 'none',
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
registerProbe('runner-mini');
|
|
181
|
+
const { lastFrame, unmount } = render(_jsx(SimRunner, { args: baseArgs() }));
|
|
182
|
+
// The mini banner surfaces the available update; the UpdateHint row renders.
|
|
183
|
+
await waitForFrame(lastFrame, '3.1.0');
|
|
184
|
+
expect(lastFrame()).toContain('3.1.0');
|
|
185
|
+
unmount();
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
//# sourceMappingURL=sim-runner.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-runner.test.js","sourceRoot":"","sources":["../../../src/cli/__tests__/sim-runner.test.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9E,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;AACnE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO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E,OAAO,CAAC,GAAG,EAAE;gBAClB,WAAW,EAAE,KAAK;gBAClB,WAAW,EAAE,OAAO,CAAC,GAAG,EAAE;gBAC1B,UAAU,EAAE,SAAS;gBACrB,QAAQ,EAAE,CAAC;gBACX,KAAK,EAAE,MAAM;aACd;SACF,CAAC,CAAC;QACH,aAAa,CAAC,aAAa,CAAC,CAAC;QAE7B,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,MAAM,CAAC,KAAC,SAAS,IAAC,IAAI,EAAE,QAAQ,EAAE,GAAI,CAAC,CAAC;QAEvE,6EAA6E;QAC7E,MAAM,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACvC,MAAM,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAEvC,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `sim-run-worker` — the headless sim run forked by the live view
|
|
3
|
+
* (`executeSimWorker`, ADR-0028). It reads a serializable sim-args spec, runs
|
|
4
|
+
* `executeSim` headless, streams pool progress over the fork IPC channel
|
|
5
|
+
* (`process.send`), and posts the final result. A bad spec is reported as a
|
|
6
|
+
* `{ kind: 'error' }` message, not a throw.
|
|
7
|
+
*
|
|
8
|
+
* The test stubs `process.send` (the process is not actually forked under vitest)
|
|
9
|
+
* and registers a scenario so the default recipe has work to run.
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=sim-worker.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-worker.test.d.ts","sourceRoot":"","sources":["../../../src/cli/__tests__/sim-worker.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|