spawn/cli/src/__tests__
Sprite dff70afb4b fix: Force CI mode for complete Unicode disabling in CLI
- Set both TERM=linux and CI=true in unicode-detect.ts
- CI env var provides additional Unicode disabling for @clack/prompts
- Fix test imports to use package.json instead of deleted version.ts
- Bump to 0.2.6

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-10 07:35:20 +00:00
..
cli-pipeline.test.ts test: Add 41 tests for CLI flag extraction pipeline (#111) 2026-02-09 19:25:18 -08:00
commands-error-paths.test.ts test: Add 31 tests for commands.ts error/validation paths (#133) 2026-02-09 21:45:39 -08:00
commands-helpers.test.ts fix: Replace Unicode characters with ASCII for terminal compatibility (#107) 2026-02-09 11:19:23 -08:00
commands-logic.test.ts test: Add command logic tests and refactor for testability (#56) 2026-02-08 12:02:43 -08:00
commands-output.test.ts test: Add 34 tests for command output functions (cmdList, cmdAgents, cmdClouds, cmdAgentInfo, cmdHelp) (#128) 2026-02-09 20:22:12 -08:00
commands-untested.test.ts fix: Replace Unicode characters with ASCII for terminal compatibility (#107) 2026-02-09 11:19:23 -08:00
commands-update-download.test.ts fix: Force CI mode for complete Unicode disabling in CLI 2026-02-10 07:35:20 +00:00
commands.test.ts fix: Restore missing imports in test files 2026-02-08 04:47:58 +00:00
index-edge-cases.test.ts test: Add 77 tests covering argument parsing, manifest, and security encoding edge cases (#101) 2026-02-09 10:20:57 -08:00
index-parsing.test.ts test: Add 70 new tests for CLI parsing, manifest validation, and security edge cases (#87) 2026-02-09 09:31:41 -08:00
integration.test.ts fix: Force CI mode for complete Unicode disabling in CLI 2026-02-10 07:35:20 +00:00
manifest-cache-lifecycle.test.ts test: Add 52 tests for manifest cache lifecycle edge cases (#117) 2026-02-09 19:50:13 -08:00
manifest-helpers.test.ts test: Add 77 tests covering argument parsing, manifest, and security encoding edge cases (#101) 2026-02-09 10:20:57 -08:00
manifest-validation.test.ts test: Add 70 new tests for CLI parsing, manifest validation, and security edge cases (#87) 2026-02-09 09:31:41 -08:00
manifest.test.ts fix: Restore missing imports in test files 2026-02-08 04:47:58 +00:00
README.md test: add unit tests for CLI TypeScript implementation 2026-02-08 00:52:12 +00:00
security-edge-cases.test.ts test: Add 70 new tests for CLI parsing, manifest validation, and security edge cases (#87) 2026-02-09 09:31:41 -08:00
security-encoding.test.ts test: Add 77 tests covering argument parsing, manifest, and security encoding edge cases (#101) 2026-02-09 10:20:57 -08:00
security.test.ts refactor: Add validatePrompt tests and improve auth cancellation UX (#61) 2026-02-09 01:24:43 -08:00
test-helpers.ts refactor: security - add input validation and script content checks 2026-02-08 04:46:19 +00:00
update-check.test.ts feat: Check for updates on every run, remove 24-hour cache 2026-02-10 07:13:42 +00: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