spawn/packages/cli/src/__tests__
A 433708709c
test: Remove 5 duplicate and theatrical test files (#1943)
* test: remove 5 duplicate and theatrical test files

Remove test files that are fully duplicated by more comprehensive
counterparts, plus one theatrical test that only grep-checks shell
script text without testing behavior.

Duplicates removed:
- manifest-validation.test.ts (subset of manifest-cache-lifecycle.test.ts)
- matrix-compact-footer.test.ts (subset of commands-exported-utils.test.ts)
- commands-output.test.ts (subset of commands-display.test.ts)
- cloud-info.test.ts (subset of commands-cloud-info.test.ts)

Theatrical test removed:
- install-script-validation.test.ts (reads install.sh as string, checks
  substring presence -- tests that functions "exist" not that they work)

All 1657 remaining tests pass. Zero regressions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test: Fix always-pass pattern and stale comments

- integration.test.ts: remove conditional `if (cacheExists)` block that
  silently skipped the cache-file assertion when the file wasn't written;
  the second loadManifest() call already exercises in-memory caching
  without needing the conditional; remove now-unused readFileSync/existsSync
  imports
- commands.test.ts: remove stale references to cloud-info.test.ts and
  commands-output.test.ts (deleted in prior commit) from inline comment;
  remove unused createMockManifest import

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: spawn-qa-bot <qa@openrouter.ai>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-26 00:54:15 -08:00
..
aws.test.ts feat: Result monad in shared + Claude Code fixtures + SPA Result adoption (#1858) 2026-02-23 22:48:51 -08:00
check-entity-messages.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
check-entity.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
clear-history.test.ts style: enforce separated type imports via biome (#1870) 2026-02-24 00:16:03 -08:00
cloud-credentials.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
cmd-interactive.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
cmd-listing-output.test.ts style: enforce separated type imports via biome (#1870) 2026-02-24 00:16:03 -08:00
cmdlast.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
cmdlist-integration.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
cmdrun-duplicate-detection.test.ts fix: remove broken clone_cli() — go straight to pre-built binary (#1873) 2026-02-24 01:19:30 -08:00
cmdrun-happy-path.test.ts fix: use spawnSync for script execution to eliminate fd 0 competition (#1942) 2026-02-26 02:50:59 -05:00
commands-cloud-info.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
commands-display.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
commands-error-paths.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
commands-exported-utils.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
commands-name-suggestions.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
commands-resolve-run.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
commands-swap-resolve.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
commands-update-download.test.ts fix: use spawnSync for script execution to eliminate fd 0 competition (#1942) 2026-02-26 02:50:59 -05:00
commands.test.ts test: Remove 5 duplicate and theatrical test files (#1943) 2026-02-26 00:54:15 -08:00
credential-hints.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
custom-flag.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
do-oauth.test.ts test: fix inline source copies — import real isValidManifest instead of stale replica (#1900) 2026-02-24 22:04:03 -08:00
download-and-failure.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
fly.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
fuzzy-key-matching.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
history-trimming.test.ts style: enforce separated type imports via biome (#1870) 2026-02-24 00:16:03 -08:00
history.test.ts fix: replace 9 CommonJS require() calls with ESM import in history test (#1871) 2026-02-24 00:16:22 -08:00
integration.test.ts test: Remove 5 duplicate and theatrical test files (#1943) 2026-02-26 00:54:15 -08:00
manifest-cache-lifecycle.test.ts test: fix inline source copies — import real isValidManifest instead of stale replica (#1900) 2026-02-24 22:04:03 -08:00
manifest-helpers.test.ts style: enforce separated type imports via biome (#1870) 2026-02-24 00:16:03 -08:00
manifest-integrity.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
manifest-type-contracts.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
manifest.test.ts style: enforce separated type imports via biome (#1870) 2026-02-24 00:16:03 -08:00
parse.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
preflight-credentials.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
preload.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
prompt-file-security.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
README.md feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
run-path-credential-display.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
script-failure-guidance.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
security-connection-validation.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
security-edge-cases.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
security-encoding.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
security.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
ssh-keys.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
test-helpers.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
unknown-flags.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
update-check.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00
with-retry-result.test.ts feat: Bun workspace monorepo — packages/cli + packages/shared (#1853) 2026-02-23 22:07:05 -08:00

CLI Tests

This directory contains comprehensive tests for the Spawn CLI TypeScript implementation.

Test Files

manifest.test.ts

Tests for manifest loading, caching, and parsing:

  • Network fetching and fallback behavior
  • Disk cache TTL and invalidation
  • Offline mode with stale cache
  • Agent/cloud key extraction
  • Matrix status checking
  • Implemented combination counting

commands.test.ts

Tests for CLI command handlers:

  • cmdHelp - Help text display
  • cmdList - Matrix table rendering
  • cmdAgents - Agent listing
  • cmdClouds - Cloud provider listing
  • cmdAgentInfo - Agent details with available clouds
  • cmdRun - Script execution with validation and fallback

integration.test.ts

Integration tests for end-to-end workflows:

  • Version command
  • Manifest caching across loads
  • Offline scenarios
  • Agent/cloud key extraction
  • Matrix validation
  • Implementation counting

Running Tests

# Run all tests once
npm test

# Run tests in watch mode
npm run test:watch

# Run with coverage (requires coverage provider)
npm test -- --coverage

Test Coverage

Current coverage targets critical paths:

  • manifest.ts: ~80% coverage of caching, fetching, and parsing logic
  • commands.ts: ~70% coverage of command handlers and validation
  • integration: Basic end-to-end scenarios

Notes

  • Tests use vitest for fast execution with Bun/Node compatibility
  • Mock manifest data is used to avoid network dependencies
  • Cache directory is isolated per test to prevent interference
  • Some tests account for local manifest.json fallback in project directory