swarmdo 1.4.8 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/helpers/statusline.cjs +7 -7
- package/README.md +9 -6
- package/package.json +5 -3
- package/v3/@swarmdo/cli/dist/src/commands/compact.d.ts +16 -0
- package/v3/@swarmdo/cli/dist/src/commands/compact.js +106 -0
- package/v3/@swarmdo/cli/dist/src/commands/hooks.js +26 -24
- package/v3/@swarmdo/cli/dist/src/commands/index.js +10 -3
- package/v3/@swarmdo/cli/dist/src/commands/integrations.d.ts +14 -0
- package/v3/@swarmdo/cli/dist/src/commands/integrations.js +158 -0
- package/v3/@swarmdo/cli/dist/src/commands/memory.js +50 -1
- package/v3/@swarmdo/cli/dist/src/commands/providers.js +3 -0
- package/v3/@swarmdo/cli/dist/src/commands/release.d.ts +15 -0
- package/v3/@swarmdo/cli/dist/src/commands/release.js +241 -0
- package/v3/@swarmdo/cli/dist/src/commands/security.js +14 -0
- package/v3/@swarmdo/cli/dist/src/commands/transcript.js +82 -1
- package/v3/@swarmdo/cli/dist/src/commands/usage.js +80 -1
- package/v3/@swarmdo/cli/dist/src/compact/compact.d.ts +60 -0
- package/v3/@swarmdo/cli/dist/src/compact/compact.js +170 -0
- package/v3/@swarmdo/cli/dist/src/config-lint/lint.js +11 -1
- package/v3/@swarmdo/cli/dist/src/index.js +4 -2
- package/v3/@swarmdo/cli/dist/src/init/statusline-generator.js +6 -6
- package/v3/@swarmdo/cli/dist/src/integrations/integrations.d.ts +54 -0
- package/v3/@swarmdo/cli/dist/src/integrations/integrations.js +162 -0
- package/v3/@swarmdo/cli/dist/src/mcp-tools/agent-execute-core.js +25 -3
- package/v3/@swarmdo/cli/dist/src/mcp-tools/agentdb-tools.js +8 -8
- package/v3/@swarmdo/cli/dist/src/memory/graph-edge-writer.d.ts +12 -0
- package/v3/@swarmdo/cli/dist/src/memory/graph-edge-writer.js +32 -1
- package/v3/@swarmdo/cli/dist/src/memory-vault/watch.d.ts +32 -0
- package/v3/@swarmdo/cli/dist/src/memory-vault/watch.js +66 -0
- package/v3/@swarmdo/cli/dist/src/providers/openrouter-config.d.ts +91 -0
- package/v3/@swarmdo/cli/dist/src/providers/openrouter-config.js +186 -0
- package/v3/@swarmdo/cli/dist/src/release/release.d.ts +72 -0
- package/v3/@swarmdo/cli/dist/src/release/release.js +86 -0
- package/v3/@swarmdo/cli/dist/src/resilience/backoff.d.ts +23 -0
- package/v3/@swarmdo/cli/dist/src/resilience/backoff.js +30 -0
- package/v3/@swarmdo/cli/dist/src/swarmvector/model-router.js +14 -0
- package/v3/@swarmdo/cli/dist/src/transcript/search.d.ts +39 -0
- package/v3/@swarmdo/cli/dist/src/transcript/search.js +67 -0
- package/v3/@swarmdo/cli/dist/src/usage/diff.d.ts +69 -0
- package/v3/@swarmdo/cli/dist/src/usage/diff.js +112 -0
- package/v3/@swarmdo/cli/package.json +4 -4
- package/v3/@swarmdo/cli-core/dist/src/index.js +1 -1
- package/v3/@swarmdo/codex/dist/cli.js +0 -0
- package/v3/@swarmdo/hooks/dist/cli/guidance-cli.js +0 -0
- package/v3/@swarmdo/hooks/dist/statusline/index.d.ts +3 -3
- package/v3/@swarmdo/hooks/dist/statusline/index.js +3 -3
- package/v3/@swarmdo/integration/dist/__tests__/agentic-flow-agent.test.js +4 -1
- package/v3/@swarmdo/neural/dist/flash-attention.d.ts +1 -1
- package/v3/@swarmdo/neural/dist/flash-attention.js +1 -1
- package/v3/@swarmdo/plugin-agent-federation/dist/plugin.js +1 -1
- package/v3/@swarmdo/plugin-agent-federation/dist/transport/midstream-aware-loader.js +2 -2
- package/v3/@swarmdo/providers/dist/swarmvector-provider.d.ts +1 -1
- package/v3/@swarmdo/providers/dist/swarmvector-provider.js +1 -1
- package/v3/@swarmdo/security/dist/input-validator.d.ts +6 -6
- package/v3/@swarmdo/shared/dist/hooks/safety/git-commit.js +1 -1
- package/v3/@swarmdo/shared/dist/mcp/transport/http.js +8 -1
- package/v3/vendor/agentdb/package.json +0 -1
- package/v3/vendor/agentic-flow/package.json +0 -1
- package/.claude/scheduled_tasks.lock +0 -1
- package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/__init__.cpython-314.pyc +0 -0
- package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/__main__.cpython-314.pyc +0 -0
- package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/cli.cpython-314.pyc +0 -0
- package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/compress.cpython-314.pyc +0 -0
- package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/detect.cpython-314.pyc +0 -0
- package/.claude/skills/sdo-caveman-compress/scripts/__pycache__/validate.cpython-314.pyc +0 -0
- package/v3/@swarmdo/plugin-iot-cognitum/dist/application/index.d.ts +0 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/application/index.js +0 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/application/iot-coordinator.d.ts +0 -138
- package/v3/@swarmdo/plugin-iot-cognitum/dist/application/iot-coordinator.js +0 -418
- package/v3/@swarmdo/plugin-iot-cognitum/dist/bin.d.ts +0 -15
- package/v3/@swarmdo/plugin-iot-cognitum/dist/bin.js +0 -240
- package/v3/@swarmdo/plugin-iot-cognitum/dist/cli-commands.d.ts +0 -7
- package/v3/@swarmdo/plugin-iot-cognitum/dist/cli-commands.js +0 -508
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-agent.d.ts +0 -54
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-agent.js +0 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-fleet.d.ts +0 -46
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-fleet.js +0 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-trust-level.d.ts +0 -18
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/device-trust-level.js +0 -28
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/index.d.ts +0 -5
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/index.js +0 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/telemetry.d.ts +0 -35
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/entities/telemetry.js +0 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/device-repository.d.ts +0 -11
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/device-repository.js +0 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/fleet-repository.d.ts +0 -9
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/fleet-repository.js +0 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/index.d.ts +0 -5
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/index.js +0 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/telemetry-repository.d.ts +0 -12
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/telemetry-repository.js +0 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/trust-history-repository.d.ts +0 -19
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/repositories/trust-history-repository.js +0 -2
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/anomaly-detection-service.d.ts +0 -44
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/anomaly-detection-service.js +0 -117
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/device-lifecycle-service.d.ts +0 -70
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/device-lifecycle-service.js +0 -194
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/firmware-orchestration-service.d.ts +0 -69
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/firmware-orchestration-service.js +0 -139
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/fleet-topology-service.d.ts +0 -34
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/fleet-topology-service.js +0 -101
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/index.d.ts +0 -10
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/index.js +0 -10
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/mesh-service.d.ts +0 -64
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/mesh-service.js +0 -70
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/sona-integration-service.d.ts +0 -44
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/sona-integration-service.js +0 -79
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-ingestion-service.d.ts +0 -37
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-ingestion-service.js +0 -39
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-service.d.ts +0 -67
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/telemetry-service.js +0 -58
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/witness-verification-service.d.ts +0 -45
- package/v3/@swarmdo/plugin-iot-cognitum/dist/domain/services/witness-verification-service.js +0 -63
- package/v3/@swarmdo/plugin-iot-cognitum/dist/index.d.ts +0 -26
- package/v3/@swarmdo/plugin-iot-cognitum/dist/index.js +0 -17
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/agentdb-telemetry-repository.d.ts +0 -51
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/agentdb-telemetry-repository.js +0 -110
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-device-repository.d.ts +0 -13
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-device-repository.js +0 -25
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-fleet-repository.d.ts +0 -11
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-fleet-repository.js +0 -19
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-trust-history-repository.d.ts +0 -11
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/in-memory-trust-history-repository.js +0 -27
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/index.d.ts +0 -6
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/index.js +0 -6
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/seed-client-factory.d.ts +0 -41
- package/v3/@swarmdo/plugin-iot-cognitum/dist/infrastructure/seed-client-factory.js +0 -64
- package/v3/@swarmdo/plugin-iot-cognitum/dist/mcp-tools.d.ts +0 -8
- package/v3/@swarmdo/plugin-iot-cognitum/dist/mcp-tools.js +0 -703
- package/v3/@swarmdo/plugin-iot-cognitum/dist/plugin.d.ts +0 -23
- package/v3/@swarmdo/plugin-iot-cognitum/dist/plugin.js +0 -239
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/anomaly-scan-worker.d.ts +0 -17
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/anomaly-scan-worker.js +0 -42
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/firmware-watch-worker.d.ts +0 -18
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/firmware-watch-worker.js +0 -45
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/health-probe-worker.d.ts +0 -19
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/health-probe-worker.js +0 -50
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/mesh-sync-worker.d.ts +0 -19
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/mesh-sync-worker.js +0 -47
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/telemetry-ingest-worker.d.ts +0 -17
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/telemetry-ingest-worker.js +0 -40
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/witness-audit-worker.d.ts +0 -18
- package/v3/@swarmdo/plugin-iot-cognitum/dist/workers/witness-audit-worker.js +0 -51
- package/v3/@swarmdo/testing/dist/fixtures/agent-fixtures.d.ts +0 -214
- package/v3/@swarmdo/testing/dist/fixtures/agent-fixtures.js +0 -595
- package/v3/@swarmdo/testing/dist/fixtures/agents.d.ts +0 -76
- package/v3/@swarmdo/testing/dist/fixtures/agents.js +0 -158
- package/v3/@swarmdo/testing/dist/fixtures/configurations.d.ts +0 -157
- package/v3/@swarmdo/testing/dist/fixtures/configurations.js +0 -337
- package/v3/@swarmdo/testing/dist/fixtures/index.d.ts +0 -10
- package/v3/@swarmdo/testing/dist/fixtures/index.js +0 -17
- package/v3/@swarmdo/testing/dist/fixtures/mcp-fixtures.d.ts +0 -329
- package/v3/@swarmdo/testing/dist/fixtures/mcp-fixtures.js +0 -714
- package/v3/@swarmdo/testing/dist/fixtures/memory-entries.d.ts +0 -159
- package/v3/@swarmdo/testing/dist/fixtures/memory-entries.js +0 -262
- package/v3/@swarmdo/testing/dist/fixtures/memory-fixtures.d.ts +0 -290
- package/v3/@swarmdo/testing/dist/fixtures/memory-fixtures.js +0 -547
- package/v3/@swarmdo/testing/dist/fixtures/swarm-fixtures.d.ts +0 -289
- package/v3/@swarmdo/testing/dist/fixtures/swarm-fixtures.js +0 -534
- package/v3/@swarmdo/testing/dist/fixtures/tasks.d.ts +0 -106
- package/v3/@swarmdo/testing/dist/fixtures/tasks.js +0 -229
- package/v3/@swarmdo/testing/dist/helpers/assertion-helpers.d.ts +0 -213
- package/v3/@swarmdo/testing/dist/helpers/assertion-helpers.js +0 -435
- package/v3/@swarmdo/testing/dist/helpers/assertions.d.ts +0 -135
- package/v3/@swarmdo/testing/dist/helpers/assertions.js +0 -217
- package/v3/@swarmdo/testing/dist/helpers/create-mock.d.ts +0 -96
- package/v3/@swarmdo/testing/dist/helpers/create-mock.js +0 -164
- package/v3/@swarmdo/testing/dist/helpers/index.d.ts +0 -14
- package/v3/@swarmdo/testing/dist/helpers/index.js +0 -22
- package/v3/@swarmdo/testing/dist/helpers/mock-factory.d.ts +0 -323
- package/v3/@swarmdo/testing/dist/helpers/mock-factory.js +0 -350
- package/v3/@swarmdo/testing/dist/helpers/setup-teardown.d.ts +0 -271
- package/v3/@swarmdo/testing/dist/helpers/setup-teardown.js +0 -446
- package/v3/@swarmdo/testing/dist/helpers/swarm-instance.d.ts +0 -142
- package/v3/@swarmdo/testing/dist/helpers/swarm-instance.js +0 -205
- package/v3/@swarmdo/testing/dist/helpers/test-application.d.ts +0 -190
- package/v3/@swarmdo/testing/dist/helpers/test-application.js +0 -138
- package/v3/@swarmdo/testing/dist/helpers/test-utils.d.ts +0 -274
- package/v3/@swarmdo/testing/dist/helpers/test-utils.js +0 -456
- package/v3/@swarmdo/testing/dist/index.d.ts +0 -42
- package/v3/@swarmdo/testing/dist/index.js +0 -66
- package/v3/@swarmdo/testing/dist/mocks/index.d.ts +0 -8
- package/v3/@swarmdo/testing/dist/mocks/index.js +0 -10
- package/v3/@swarmdo/testing/dist/mocks/mock-mcp-client.d.ts +0 -206
- package/v3/@swarmdo/testing/dist/mocks/mock-mcp-client.js +0 -575
- package/v3/@swarmdo/testing/dist/mocks/mock-services.d.ts +0 -287
- package/v3/@swarmdo/testing/dist/mocks/mock-services.js +0 -563
- package/v3/@swarmdo/testing/dist/regression/api-contract.d.ts +0 -109
- package/v3/@swarmdo/testing/dist/regression/api-contract.js +0 -374
- package/v3/@swarmdo/testing/dist/regression/index.d.ts +0 -18
- package/v3/@swarmdo/testing/dist/regression/index.js +0 -18
- package/v3/@swarmdo/testing/dist/regression/integration-regression.d.ts +0 -67
- package/v3/@swarmdo/testing/dist/regression/integration-regression.js +0 -334
- package/v3/@swarmdo/testing/dist/regression/performance-baseline.d.ts +0 -106
- package/v3/@swarmdo/testing/dist/regression/performance-baseline.js +0 -268
- package/v3/@swarmdo/testing/dist/regression/regression-runner.d.ts +0 -124
- package/v3/@swarmdo/testing/dist/regression/regression-runner.js +0 -227
- package/v3/@swarmdo/testing/dist/regression/security-regression.d.ts +0 -73
- package/v3/@swarmdo/testing/dist/regression/security-regression.js +0 -258
- package/v3/@swarmdo/testing/dist/setup.d.ts +0 -43
- package/v3/@swarmdo/testing/dist/setup.js +0 -91
- package/v3/@swarmdo/testing/dist/v2-compat/api-compat.test.d.ts +0 -10
- package/v3/@swarmdo/testing/dist/v2-compat/api-compat.test.js +0 -433
- package/v3/@swarmdo/testing/dist/v2-compat/cli-compat.test.d.ts +0 -10
- package/v3/@swarmdo/testing/dist/v2-compat/cli-compat.test.js +0 -352
- package/v3/@swarmdo/testing/dist/v2-compat/compatibility-validator.d.ts +0 -206
- package/v3/@swarmdo/testing/dist/v2-compat/compatibility-validator.js +0 -839
- package/v3/@swarmdo/testing/dist/v2-compat/hooks-compat.test.d.ts +0 -10
- package/v3/@swarmdo/testing/dist/v2-compat/hooks-compat.test.js +0 -428
- package/v3/@swarmdo/testing/dist/v2-compat/index.d.ts +0 -38
- package/v3/@swarmdo/testing/dist/v2-compat/index.js +0 -41
- package/v3/@swarmdo/testing/dist/v2-compat/mcp-compat.test.d.ts +0 -10
- package/v3/@swarmdo/testing/dist/v2-compat/mcp-compat.test.js +0 -419
- package/v3/@swarmdo/testing/dist/v2-compat/report-generator.d.ts +0 -34
- package/v3/@swarmdo/testing/dist/v2-compat/report-generator.js +0 -372
|
@@ -1,456 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @swarmdo/testing - Test Utilities
|
|
3
|
-
*
|
|
4
|
-
* Common test utilities for async operations, timing, retries, and more.
|
|
5
|
-
* Designed for robust V3 module testing.
|
|
6
|
-
*/
|
|
7
|
-
import { vi } from 'vitest';
|
|
8
|
-
/**
|
|
9
|
-
* Wait for a condition to be true with timeout
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* await waitFor(() => element.isVisible(), { timeout: 5000 });
|
|
13
|
-
*/
|
|
14
|
-
export async function waitFor(condition, options = {}) {
|
|
15
|
-
const { timeout = 5000, interval = 50, timeoutMessage = 'Condition not met within timeout', } = options;
|
|
16
|
-
const startTime = Date.now();
|
|
17
|
-
while (true) {
|
|
18
|
-
try {
|
|
19
|
-
const result = await condition();
|
|
20
|
-
if (result) {
|
|
21
|
-
return result;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
// Condition threw, continue waiting
|
|
26
|
-
}
|
|
27
|
-
if (Date.now() - startTime >= timeout) {
|
|
28
|
-
throw new Error(timeoutMessage);
|
|
29
|
-
}
|
|
30
|
-
await sleep(interval);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Wait until a value changes
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* await waitUntilChanged(() => counter.value, { from: 0 });
|
|
38
|
-
*/
|
|
39
|
-
export async function waitUntilChanged(getValue, options = {}) {
|
|
40
|
-
const { from, timeout = 5000, interval = 50 } = options;
|
|
41
|
-
const initialValue = from ?? await getValue();
|
|
42
|
-
const startTime = Date.now();
|
|
43
|
-
while (true) {
|
|
44
|
-
const currentValue = await getValue();
|
|
45
|
-
if (currentValue !== initialValue) {
|
|
46
|
-
return currentValue;
|
|
47
|
-
}
|
|
48
|
-
if (Date.now() - startTime >= timeout) {
|
|
49
|
-
throw new Error(`Value did not change from ${String(initialValue)} within timeout`);
|
|
50
|
-
}
|
|
51
|
-
await sleep(interval);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Retry an operation with exponential backoff
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* const result = await retry(
|
|
59
|
-
* async () => await fetchData(),
|
|
60
|
-
* { maxAttempts: 3, backoff: 100 }
|
|
61
|
-
* );
|
|
62
|
-
*/
|
|
63
|
-
export async function retry(operation, options = {}) {
|
|
64
|
-
const { maxAttempts = 3, backoff = 100, maxBackoff = 10000, exponential = true, onError, shouldRetry = () => true, } = options;
|
|
65
|
-
let lastError;
|
|
66
|
-
let currentBackoff = backoff;
|
|
67
|
-
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
68
|
-
try {
|
|
69
|
-
return await operation();
|
|
70
|
-
}
|
|
71
|
-
catch (error) {
|
|
72
|
-
lastError = error;
|
|
73
|
-
if (attempt === maxAttempts || !shouldRetry(lastError, attempt)) {
|
|
74
|
-
throw lastError;
|
|
75
|
-
}
|
|
76
|
-
onError?.(lastError, attempt);
|
|
77
|
-
await sleep(currentBackoff);
|
|
78
|
-
if (exponential) {
|
|
79
|
-
currentBackoff = Math.min(currentBackoff * 2, maxBackoff);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
throw lastError;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Wrap an operation with a timeout
|
|
87
|
-
*
|
|
88
|
-
* @example
|
|
89
|
-
* const result = await withTimeout(
|
|
90
|
-
* async () => await longRunningOperation(),
|
|
91
|
-
* 5000
|
|
92
|
-
* );
|
|
93
|
-
*/
|
|
94
|
-
export async function withTimeout(operation, timeoutMs, timeoutMessage) {
|
|
95
|
-
const timeoutPromise = new Promise((_, reject) => {
|
|
96
|
-
const timer = setTimeout(() => {
|
|
97
|
-
reject(new TimeoutError(timeoutMessage ?? `Operation timed out after ${timeoutMs}ms`));
|
|
98
|
-
}, timeoutMs);
|
|
99
|
-
// Cleanup timer if operation completes first
|
|
100
|
-
operation().finally(() => clearTimeout(timer));
|
|
101
|
-
});
|
|
102
|
-
return Promise.race([operation(), timeoutPromise]);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Custom timeout error
|
|
106
|
-
*/
|
|
107
|
-
export class TimeoutError extends Error {
|
|
108
|
-
constructor(message) {
|
|
109
|
-
super(message);
|
|
110
|
-
this.name = 'TimeoutError';
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Sleep for a specified duration
|
|
115
|
-
*
|
|
116
|
-
* @example
|
|
117
|
-
* await sleep(1000); // Sleep for 1 second
|
|
118
|
-
*/
|
|
119
|
-
export function sleep(ms) {
|
|
120
|
-
return new Promise(resolve => setTimeout(resolve, ms));
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Create a deferred promise that can be resolved/rejected externally
|
|
124
|
-
*
|
|
125
|
-
* @example
|
|
126
|
-
* const deferred = createDeferred<string>();
|
|
127
|
-
* setTimeout(() => deferred.resolve('done'), 1000);
|
|
128
|
-
* const result = await deferred.promise;
|
|
129
|
-
*/
|
|
130
|
-
export function createDeferred() {
|
|
131
|
-
let resolve;
|
|
132
|
-
let reject;
|
|
133
|
-
const promise = new Promise((res, rej) => {
|
|
134
|
-
resolve = res;
|
|
135
|
-
reject = rej;
|
|
136
|
-
});
|
|
137
|
-
return { promise, resolve, reject };
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Run operations in parallel with concurrency limit
|
|
141
|
-
*
|
|
142
|
-
* @example
|
|
143
|
-
* const results = await parallelLimit(
|
|
144
|
-
* items.map(item => () => processItem(item)),
|
|
145
|
-
* 5 // max 5 concurrent operations
|
|
146
|
-
* );
|
|
147
|
-
*/
|
|
148
|
-
export async function parallelLimit(operations, limit) {
|
|
149
|
-
const results = [];
|
|
150
|
-
const executing = new Set();
|
|
151
|
-
for (const operation of operations) {
|
|
152
|
-
const promise = (async () => {
|
|
153
|
-
const result = await operation();
|
|
154
|
-
results.push(result);
|
|
155
|
-
})();
|
|
156
|
-
executing.add(promise);
|
|
157
|
-
promise.finally(() => executing.delete(promise));
|
|
158
|
-
if (executing.size >= limit) {
|
|
159
|
-
await Promise.race(executing);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
await Promise.all(executing);
|
|
163
|
-
return results;
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Measure execution time of an operation
|
|
167
|
-
*
|
|
168
|
-
* @example
|
|
169
|
-
* const { result, duration } = await measureTime(async () => {
|
|
170
|
-
* return await expensiveOperation();
|
|
171
|
-
* });
|
|
172
|
-
*/
|
|
173
|
-
export async function measureTime(operation) {
|
|
174
|
-
const start = performance.now();
|
|
175
|
-
const result = await operation();
|
|
176
|
-
const duration = performance.now() - start;
|
|
177
|
-
return { result, duration };
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Create a mock clock for time-dependent tests
|
|
181
|
-
*
|
|
182
|
-
* @example
|
|
183
|
-
* const clock = createMockClock();
|
|
184
|
-
* clock.install();
|
|
185
|
-
* // ... tests with controlled time
|
|
186
|
-
* clock.uninstall();
|
|
187
|
-
*/
|
|
188
|
-
export function createMockClock() {
|
|
189
|
-
let installed = false;
|
|
190
|
-
let currentTime = Date.now();
|
|
191
|
-
return {
|
|
192
|
-
install() {
|
|
193
|
-
if (installed)
|
|
194
|
-
return;
|
|
195
|
-
vi.useFakeTimers();
|
|
196
|
-
vi.setSystemTime(currentTime);
|
|
197
|
-
installed = true;
|
|
198
|
-
},
|
|
199
|
-
uninstall() {
|
|
200
|
-
if (!installed)
|
|
201
|
-
return;
|
|
202
|
-
vi.useRealTimers();
|
|
203
|
-
installed = false;
|
|
204
|
-
},
|
|
205
|
-
tick(ms) {
|
|
206
|
-
if (!installed) {
|
|
207
|
-
throw new Error('Clock not installed. Call install() first.');
|
|
208
|
-
}
|
|
209
|
-
currentTime += ms;
|
|
210
|
-
vi.advanceTimersByTime(ms);
|
|
211
|
-
},
|
|
212
|
-
setTime(time) {
|
|
213
|
-
currentTime = typeof time === 'number' ? time : time.getTime();
|
|
214
|
-
if (installed) {
|
|
215
|
-
vi.setSystemTime(currentTime);
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
getTime() {
|
|
219
|
-
return currentTime;
|
|
220
|
-
},
|
|
221
|
-
runAllTimers() {
|
|
222
|
-
if (!installed) {
|
|
223
|
-
throw new Error('Clock not installed. Call install() first.');
|
|
224
|
-
}
|
|
225
|
-
vi.runAllTimers();
|
|
226
|
-
},
|
|
227
|
-
runPendingTimers() {
|
|
228
|
-
if (!installed) {
|
|
229
|
-
throw new Error('Clock not installed. Call install() first.');
|
|
230
|
-
}
|
|
231
|
-
vi.runOnlyPendingTimers();
|
|
232
|
-
},
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* Create an event emitter for testing
|
|
237
|
-
*
|
|
238
|
-
* @example
|
|
239
|
-
* const emitter = createTestEmitter<{ message: string }>();
|
|
240
|
-
* const handler = vi.fn();
|
|
241
|
-
* emitter.on('message', handler);
|
|
242
|
-
* emitter.emit('message', 'hello');
|
|
243
|
-
*/
|
|
244
|
-
export function createTestEmitter() {
|
|
245
|
-
const listeners = new Map();
|
|
246
|
-
return {
|
|
247
|
-
on(event, handler) {
|
|
248
|
-
if (!listeners.has(event)) {
|
|
249
|
-
listeners.set(event, new Set());
|
|
250
|
-
}
|
|
251
|
-
listeners.get(event).add(handler);
|
|
252
|
-
return () => {
|
|
253
|
-
listeners.get(event)?.delete(handler);
|
|
254
|
-
};
|
|
255
|
-
},
|
|
256
|
-
once(event, handler) {
|
|
257
|
-
const wrappedHandler = (data) => {
|
|
258
|
-
this.off(event, wrappedHandler);
|
|
259
|
-
handler(data);
|
|
260
|
-
};
|
|
261
|
-
return this.on(event, wrappedHandler);
|
|
262
|
-
},
|
|
263
|
-
off(event, handler) {
|
|
264
|
-
listeners.get(event)?.delete(handler);
|
|
265
|
-
},
|
|
266
|
-
emit(event, data) {
|
|
267
|
-
listeners.get(event)?.forEach(handler => handler(data));
|
|
268
|
-
},
|
|
269
|
-
removeAllListeners(event) {
|
|
270
|
-
if (event) {
|
|
271
|
-
listeners.delete(event);
|
|
272
|
-
}
|
|
273
|
-
else {
|
|
274
|
-
listeners.clear();
|
|
275
|
-
}
|
|
276
|
-
},
|
|
277
|
-
listenerCount(event) {
|
|
278
|
-
return listeners.get(event)?.size ?? 0;
|
|
279
|
-
},
|
|
280
|
-
};
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Create a test spy that records all calls
|
|
284
|
-
*
|
|
285
|
-
* @example
|
|
286
|
-
* const spy = createCallSpy();
|
|
287
|
-
* myFunction = spy.wrap(myFunction);
|
|
288
|
-
* // ... use myFunction
|
|
289
|
-
* expect(spy.calls).toHaveLength(3);
|
|
290
|
-
*/
|
|
291
|
-
export function createCallSpy() {
|
|
292
|
-
const calls = [];
|
|
293
|
-
return {
|
|
294
|
-
calls,
|
|
295
|
-
wrap(fn) {
|
|
296
|
-
return ((...args) => {
|
|
297
|
-
const call = { args, timestamp: Date.now() };
|
|
298
|
-
calls.push(call);
|
|
299
|
-
try {
|
|
300
|
-
const result = fn(...args);
|
|
301
|
-
call.result = result;
|
|
302
|
-
return result;
|
|
303
|
-
}
|
|
304
|
-
catch (error) {
|
|
305
|
-
call.error = error;
|
|
306
|
-
throw error;
|
|
307
|
-
}
|
|
308
|
-
});
|
|
309
|
-
},
|
|
310
|
-
clear() {
|
|
311
|
-
calls.length = 0;
|
|
312
|
-
},
|
|
313
|
-
getLastCall() {
|
|
314
|
-
return calls[calls.length - 1];
|
|
315
|
-
},
|
|
316
|
-
getCallCount() {
|
|
317
|
-
return calls.length;
|
|
318
|
-
},
|
|
319
|
-
wasCalledWith(...args) {
|
|
320
|
-
return calls.some(call => args.every((arg, i) => arg === undefined || call.args[i] === arg));
|
|
321
|
-
},
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Create a mock stream for testing streaming operations
|
|
326
|
-
*
|
|
327
|
-
* @example
|
|
328
|
-
* const stream = createMockStream(['chunk1', 'chunk2', 'chunk3']);
|
|
329
|
-
* for await (const chunk of stream) {
|
|
330
|
-
* console.log(chunk);
|
|
331
|
-
* }
|
|
332
|
-
*/
|
|
333
|
-
export function createMockStream(chunks, options = {}) {
|
|
334
|
-
const { delayMs = 0, errorAt, errorMessage = 'Stream error' } = options;
|
|
335
|
-
return {
|
|
336
|
-
async *[Symbol.asyncIterator]() {
|
|
337
|
-
for (let i = 0; i < chunks.length; i++) {
|
|
338
|
-
if (errorAt !== undefined && i === errorAt) {
|
|
339
|
-
throw new Error(errorMessage);
|
|
340
|
-
}
|
|
341
|
-
if (delayMs > 0) {
|
|
342
|
-
await sleep(delayMs);
|
|
343
|
-
}
|
|
344
|
-
yield chunks[i];
|
|
345
|
-
}
|
|
346
|
-
},
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* Collect all items from an async iterable
|
|
351
|
-
*
|
|
352
|
-
* @example
|
|
353
|
-
* const items = await collectStream(asyncGenerator());
|
|
354
|
-
*/
|
|
355
|
-
export async function collectStream(stream) {
|
|
356
|
-
const items = [];
|
|
357
|
-
for await (const item of stream) {
|
|
358
|
-
items.push(item);
|
|
359
|
-
}
|
|
360
|
-
return items;
|
|
361
|
-
}
|
|
362
|
-
/**
|
|
363
|
-
* Generate a unique ID for testing
|
|
364
|
-
*/
|
|
365
|
-
export function generateTestId(prefix = 'test') {
|
|
366
|
-
return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
367
|
-
}
|
|
368
|
-
/**
|
|
369
|
-
* Create a test context that provides isolated test data
|
|
370
|
-
*
|
|
371
|
-
* @example
|
|
372
|
-
* const ctx = createTestContext();
|
|
373
|
-
* ctx.set('user', { id: 1, name: 'Test' });
|
|
374
|
-
* const user = ctx.get('user');
|
|
375
|
-
*/
|
|
376
|
-
export function createTestContext() {
|
|
377
|
-
const data = new Map();
|
|
378
|
-
return {
|
|
379
|
-
set(key, value) {
|
|
380
|
-
data.set(key, value);
|
|
381
|
-
},
|
|
382
|
-
get(key) {
|
|
383
|
-
return data.get(key);
|
|
384
|
-
},
|
|
385
|
-
has(key) {
|
|
386
|
-
return data.has(key);
|
|
387
|
-
},
|
|
388
|
-
delete(key) {
|
|
389
|
-
return data.delete(key);
|
|
390
|
-
},
|
|
391
|
-
clear() {
|
|
392
|
-
data.clear();
|
|
393
|
-
},
|
|
394
|
-
keys() {
|
|
395
|
-
return Array.from(data.keys());
|
|
396
|
-
},
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
/**
|
|
400
|
-
* Assert that a promise rejects with a specific error type
|
|
401
|
-
*
|
|
402
|
-
* @example
|
|
403
|
-
* await expectToReject(
|
|
404
|
-
* async () => await riskyOperation(),
|
|
405
|
-
* ValidationError
|
|
406
|
-
* );
|
|
407
|
-
*/
|
|
408
|
-
export async function expectToReject(operation, ErrorClass) {
|
|
409
|
-
try {
|
|
410
|
-
await operation();
|
|
411
|
-
throw new Error('Expected operation to reject, but it resolved');
|
|
412
|
-
}
|
|
413
|
-
catch (error) {
|
|
414
|
-
if (ErrorClass && !(error instanceof ErrorClass)) {
|
|
415
|
-
throw new Error(`Expected error to be instance of ${ErrorClass.name}, but got ${error.constructor.name}`);
|
|
416
|
-
}
|
|
417
|
-
return error;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
/**
|
|
421
|
-
* Create a mock function with tracking capabilities
|
|
422
|
-
*/
|
|
423
|
-
export function createTrackedMock(implementation) {
|
|
424
|
-
// Use type assertion to handle the optional implementation
|
|
425
|
-
const mock = implementation ? vi.fn(implementation) : vi.fn();
|
|
426
|
-
const calls = [];
|
|
427
|
-
const tracked = ((...args) => {
|
|
428
|
-
const start = performance.now();
|
|
429
|
-
const call = { args, duration: 0 };
|
|
430
|
-
calls.push(call);
|
|
431
|
-
try {
|
|
432
|
-
const result = mock(...args);
|
|
433
|
-
call.result = result;
|
|
434
|
-
call.duration = performance.now() - start;
|
|
435
|
-
return result;
|
|
436
|
-
}
|
|
437
|
-
catch (error) {
|
|
438
|
-
call.error = error;
|
|
439
|
-
call.duration = performance.now() - start;
|
|
440
|
-
throw error;
|
|
441
|
-
}
|
|
442
|
-
});
|
|
443
|
-
Object.assign(tracked, {
|
|
444
|
-
mock,
|
|
445
|
-
calls,
|
|
446
|
-
getAverageDuration: () => {
|
|
447
|
-
if (calls.length === 0)
|
|
448
|
-
return 0;
|
|
449
|
-
return calls.reduce((sum, c) => sum + c.duration, 0) / calls.length;
|
|
450
|
-
},
|
|
451
|
-
getTotalDuration: () => calls.reduce((sum, c) => sum + c.duration, 0),
|
|
452
|
-
getErrors: () => calls.filter(c => c.error).map(c => c.error),
|
|
453
|
-
});
|
|
454
|
-
return tracked;
|
|
455
|
-
}
|
|
456
|
-
//# sourceMappingURL=test-utils.js.map
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @swarmdo/testing - Testing Module
|
|
3
|
-
* TDD London School framework and test utilities for V3 Swarmdo
|
|
4
|
-
*
|
|
5
|
-
* Based on ADR-008 (Vitest over Jest)
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* // Basic test setup
|
|
9
|
-
* import {
|
|
10
|
-
* setupV3Tests,
|
|
11
|
-
* createMockApplication,
|
|
12
|
-
* agentConfigs,
|
|
13
|
-
* swarmConfigs,
|
|
14
|
-
* } from '@swarmdo/testing';
|
|
15
|
-
*
|
|
16
|
-
* setupV3Tests();
|
|
17
|
-
*
|
|
18
|
-
* describe('MyModule', () => {
|
|
19
|
-
* const app = createMockApplication();
|
|
20
|
-
*
|
|
21
|
-
* it('should work', async () => {
|
|
22
|
-
* const agent = await app.agentLifecycle.spawn(agentConfigs.queenCoordinator);
|
|
23
|
-
* expect(agent.success).toBe(true);
|
|
24
|
-
* });
|
|
25
|
-
* });
|
|
26
|
-
*/
|
|
27
|
-
export * from './setup.js';
|
|
28
|
-
export { createMock, createDeepMock, createSpyMock, createMockWithBehavior, createRetryMock, createSequenceMock, InteractionRecorder, type MockedInterface, } from './helpers/create-mock.js';
|
|
29
|
-
export { createTestApplication, type TestApplication, type IEventBus, type ITaskManager, type IAgentLifecycle, type IMemoryService, type ISecurityService, type ISwarmCoordinator, } from './helpers/test-application.js';
|
|
30
|
-
export { createSwarmTestInstance, SwarmTestInstance, type SwarmAgent, } from './helpers/swarm-instance.js';
|
|
31
|
-
export { assertCallSequence, assertNotCalledWith, assertInteractionCount, assertAllCalled, assertNoneCalled, assertContractCompliance, assertTimingWithin, assertTimingRange, assertThrowsWithMessage, assertEventPublished, assertMockSequence, assertNoSensitiveDataLogged, assertPerformanceTarget, } from './helpers/assertions.js';
|
|
32
|
-
export { waitFor, waitUntilChanged, retry, withTimeout, sleep, createDeferred, parallelLimit, measureTime, createMockClock, createTestEmitter, createCallSpy, createMockStream, collectStream, generateTestId, createTestContext, expectToReject, createTrackedMock, TimeoutError, type WaitForOptions, type WaitUntilChangedOptions, type RetryOptions, type Deferred, type MockClock, type TestEmitter, type CallSpy, type MockStreamOptions, type TestContext, type TrackedMock, } from './helpers/test-utils.js';
|
|
33
|
-
export { createMockEventBus, createMockTaskManager, createMockAgentLifecycle, createMockMemoryService, createMockSecurityService, createMockSwarmCoordinator, createMockMCPClient, createMockLogger, createMockApplication, resetMockApplication, type MockApplication, type ILogger, type IMCPClient, type DomainEvent, type EventHandler, type Task, type TaskFilters, type TerminateOptions, type AgentFilters, type AgentHealthCheck, type MemoryStats, type IndexConfig, type InputValidationOptions, type ExecuteOptions, type ExecuteResult, } from './helpers/mock-factory.js';
|
|
34
|
-
export { assertCalledWithPattern, assertEventOrder, assertEventNotPublished, assertMocksCalledInOrder, assertCalledNTimesWith, assertCompletesWithin, assertThrowsError, assertNoSensitiveData, assertMatchesSnapshot, assertV3PerformanceTargets, assertValidDomainObject, assertOnlyCalledWithAllowed, assertPartialOrder, assertAllPass, assertNonePass, assertSameElements, assertMockReturnsSequence, assertValidStateTransition, assertRetryPattern, assertDependencyInjected, registerCustomMatchers, type SnapshotOptions, type V3PerformanceMetrics, type RetryPatternOptions, } from './helpers/assertion-helpers.js';
|
|
35
|
-
export { createSetupContext, getGlobalContext, resetGlobalContext, configureTestEnvironment, createTestSuite, createTestScope, createInMemoryDatabaseHelper, createNetworkTestHelper, createInMemoryFileSystemHelper, createPerformanceTestHelper, setupV3Tests, flushPromises, withTestTimeout, type SetupContext, type CleanupFunction, type Disposable, type TestEnvironmentConfig, type TestSuiteHelpers, type TestScope, type DatabaseTestHelper, type NetworkTestHelper, type MockFetchResponse, type FileSystemTestHelper, type PerformanceTestHelper, type V3TestConfig, } from './helpers/setup-teardown.js';
|
|
36
|
-
export * from './fixtures/index.js';
|
|
37
|
-
export { MockAgentDB, MockSwarmCoordinator, MockSwarmAgent, MockMemoryService, MockEventBus, MockSecurityService, createMockServices, resetMockServices, type MockServiceBundle, } from './mocks/mock-services.js';
|
|
38
|
-
export { MockMCPClient, MockMCPServer, MockMCPConnection, MCPClientError, createStandardMockMCPClient, createFailingMockMCPClient, createSlowMockMCPClient, } from './mocks/mock-mcp-client.js';
|
|
39
|
-
export * from './regression/index.js';
|
|
40
|
-
export * from './v2-compat/index.js';
|
|
41
|
-
export { vi, expect, describe, it, test, beforeEach, afterEach, beforeAll, afterAll } from 'vitest';
|
|
42
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @swarmdo/testing - Testing Module
|
|
3
|
-
* TDD London School framework and test utilities for V3 Swarmdo
|
|
4
|
-
*
|
|
5
|
-
* Based on ADR-008 (Vitest over Jest)
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* // Basic test setup
|
|
9
|
-
* import {
|
|
10
|
-
* setupV3Tests,
|
|
11
|
-
* createMockApplication,
|
|
12
|
-
* agentConfigs,
|
|
13
|
-
* swarmConfigs,
|
|
14
|
-
* } from '@swarmdo/testing';
|
|
15
|
-
*
|
|
16
|
-
* setupV3Tests();
|
|
17
|
-
*
|
|
18
|
-
* describe('MyModule', () => {
|
|
19
|
-
* const app = createMockApplication();
|
|
20
|
-
*
|
|
21
|
-
* it('should work', async () => {
|
|
22
|
-
* const agent = await app.agentLifecycle.spawn(agentConfigs.queenCoordinator);
|
|
23
|
-
* expect(agent.success).toBe(true);
|
|
24
|
-
* });
|
|
25
|
-
* });
|
|
26
|
-
*/
|
|
27
|
-
// Test setup - Global configuration and custom matchers
|
|
28
|
-
export * from './setup.js';
|
|
29
|
-
// Helpers - Mock factories, utilities, and assertions
|
|
30
|
-
// Explicitly export to avoid duplicates with fixtures
|
|
31
|
-
export {
|
|
32
|
-
// create-mock.js
|
|
33
|
-
createMock, createDeepMock, createSpyMock, createMockWithBehavior, createRetryMock, createSequenceMock, InteractionRecorder, } from './helpers/create-mock.js';
|
|
34
|
-
export {
|
|
35
|
-
// test-application.js
|
|
36
|
-
createTestApplication, } from './helpers/test-application.js';
|
|
37
|
-
export {
|
|
38
|
-
// swarm-instance.js - Only export what's not in fixtures
|
|
39
|
-
createSwarmTestInstance, SwarmTestInstance, } from './helpers/swarm-instance.js';
|
|
40
|
-
export {
|
|
41
|
-
// assertions.js
|
|
42
|
-
assertCallSequence, assertNotCalledWith, assertInteractionCount, assertAllCalled, assertNoneCalled, assertContractCompliance, assertTimingWithin, assertTimingRange, assertThrowsWithMessage, assertEventPublished, assertMockSequence, assertNoSensitiveDataLogged, assertPerformanceTarget, } from './helpers/assertions.js';
|
|
43
|
-
export {
|
|
44
|
-
// test-utils.js
|
|
45
|
-
waitFor, waitUntilChanged, retry, withTimeout, sleep, createDeferred, parallelLimit, measureTime, createMockClock, createTestEmitter, createCallSpy, createMockStream, collectStream, generateTestId, createTestContext, expectToReject, createTrackedMock, TimeoutError, } from './helpers/test-utils.js';
|
|
46
|
-
export {
|
|
47
|
-
// mock-factory.js - Only non-duplicate exports
|
|
48
|
-
createMockEventBus, createMockTaskManager, createMockAgentLifecycle, createMockMemoryService, createMockSecurityService, createMockSwarmCoordinator, createMockMCPClient, createMockLogger, createMockApplication, resetMockApplication, } from './helpers/mock-factory.js';
|
|
49
|
-
export {
|
|
50
|
-
// assertion-helpers.js
|
|
51
|
-
assertCalledWithPattern, assertEventOrder, assertEventNotPublished, assertMocksCalledInOrder, assertCalledNTimesWith, assertCompletesWithin, assertThrowsError, assertNoSensitiveData, assertMatchesSnapshot, assertV3PerformanceTargets, assertValidDomainObject, assertOnlyCalledWithAllowed, assertPartialOrder, assertAllPass, assertNonePass, assertSameElements, assertMockReturnsSequence, assertValidStateTransition, assertRetryPattern, assertDependencyInjected, registerCustomMatchers, } from './helpers/assertion-helpers.js';
|
|
52
|
-
export {
|
|
53
|
-
// setup-teardown.js
|
|
54
|
-
createSetupContext, getGlobalContext, resetGlobalContext, configureTestEnvironment, createTestSuite, createTestScope, createInMemoryDatabaseHelper, createNetworkTestHelper, createInMemoryFileSystemHelper, createPerformanceTestHelper, setupV3Tests, flushPromises, withTestTimeout, } from './helpers/setup-teardown.js';
|
|
55
|
-
// Fixtures - Pre-defined test data (canonical source for shared types)
|
|
56
|
-
export * from './fixtures/index.js';
|
|
57
|
-
// Mocks - Service mock implementations (explicit to avoid duplicates)
|
|
58
|
-
export { MockAgentDB, MockSwarmCoordinator, MockSwarmAgent, MockMemoryService, MockEventBus, MockSecurityService, createMockServices, resetMockServices, } from './mocks/mock-services.js';
|
|
59
|
-
export { MockMCPClient, MockMCPServer, MockMCPConnection, MCPClientError, createStandardMockMCPClient, createFailingMockMCPClient, createSlowMockMCPClient, } from './mocks/mock-mcp-client.js';
|
|
60
|
-
// Regression Testing - Prevent capability degradation
|
|
61
|
-
export * from './regression/index.js';
|
|
62
|
-
// V2 Compatibility Testing - Validate backward compatibility
|
|
63
|
-
export * from './v2-compat/index.js';
|
|
64
|
-
// Re-export commonly used Vitest utilities
|
|
65
|
-
export { vi, expect, describe, it, test, beforeEach, afterEach, beforeAll, afterAll } from 'vitest';
|
|
66
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @swarmdo/testing - Mocks Index
|
|
3
|
-
*
|
|
4
|
-
* Central export for all mock implementations
|
|
5
|
-
*/
|
|
6
|
-
export { MockAgentDB, MockSwarmCoordinator, MockSwarmAgent, MockMemoryService, MockEventBus, MockSecurityService, createMockServices, resetMockServices, type MockServiceBundle, } from './mock-services.js';
|
|
7
|
-
export { MockMCPClient, MockMCPServer, MockMCPConnection, MCPClientError, createStandardMockMCPClient, createFailingMockMCPClient, createSlowMockMCPClient, } from './mock-mcp-client.js';
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @swarmdo/testing - Mocks Index
|
|
3
|
-
*
|
|
4
|
-
* Central export for all mock implementations
|
|
5
|
-
*/
|
|
6
|
-
// Mock services
|
|
7
|
-
export { MockAgentDB, MockSwarmCoordinator, MockSwarmAgent, MockMemoryService, MockEventBus, MockSecurityService, createMockServices, resetMockServices, } from './mock-services.js';
|
|
8
|
-
// Mock MCP client and server
|
|
9
|
-
export { MockMCPClient, MockMCPServer, MockMCPConnection, MCPClientError, createStandardMockMCPClient, createFailingMockMCPClient, createSlowMockMCPClient, } from './mock-mcp-client.js';
|
|
10
|
-
//# sourceMappingURL=index.js.map
|