Skip to content

test(scripts): add test coverage for critical automation scripts#54

Merged
PAMulligan merged 5 commits intomainfrom
44-add-test-coverage-for-critical-automation-scripts
Apr 2, 2026
Merged

test(scripts): add test coverage for critical automation scripts#54
PAMulligan merged 5 commits intomainfrom
44-add-test-coverage-for-critical-automation-scripts

Conversation

@PAMulligan
Copy link
Copy Markdown
Collaborator

@PAMulligan PAMulligan commented Apr 2, 2026

Summary

  • Add 15 new test files with 226 tests covering all P0-P3 priority automation scripts
  • Previously only 2 of 25+ scripts had tests; now 17 scripts have comprehensive test coverage
  • Add vitest.config.js for sequential execution of tests that share state files

Test Coverage by Priority

P0 — Pipeline Infrastructure (5 scripts)

  • pipeline-cache.js — hash, check, update, invalidate, status, clean, hit/miss commands
  • stage-profiler.js — start/end timing, complete, report, history, analyze
  • metrics-dashboard.js — summary, trends, compare, generate (HTML/MD/JSON)
  • incremental-build.sh — help, phase validation, configuration display
  • sync-tokens.sh — drift detection, JSON output, missing lockfile handling

P1 — Quality Gate Scripts (4 scripts)

  • verify-tokens.sh — hex colors, arbitrary Tailwind values, inline styles, CSS colors, token-ok exceptions
  • verify-test-coverage.sh — component-test mapping, imports, orphan tests, RTL queries, empty tests
  • check-dead-code.sh — config toggle, JSON output, help/flag parsing
  • check-security.sh — audit output, --no-fail, JSON output, --level flag

P2 — Generation Scripts (3 scripts)

  • generate-stories.sh — story generation, dry-run, force, skip logic, summary counts
  • generate-component-docs.sh — MDX output, index generation, custom output dir
  • generate-api-client.sh — spec detection, missing spec, flag parsing

P3 — Verification Scripts (3 scripts)

  • check-responsive.sh — help flag, breakpoint config
  • audit-cross-browser-css.sh — webkit prefixes, backdrop-filter, :focus-visible
  • regression-test.sh — help flag parsing

Test plan

  • All 226 tests pass locally (npx vitest run --config scripts/__tests__/vitest.config.js scripts/__tests__/)
  • Existing tests (visual-diff, canva-pipeline) still pass
  • Tests run without external dependencies (MCP servers, browsers) where possible
  • Shell script tests use temp fixture directories for isolation
  • JS script tests use backup/restore for shared state files

🤖 Generated with Claude Code

Cover all CLI commands (hash, check, update, invalidate, clean, status,
hit, miss) with 40 tests verifying JSON output, exit codes, manifest
persistence, cache roundtrips, and error handling via subprocess execution.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@PAMulligan PAMulligan linked an issue Apr 2, 2026 that may be closed by this pull request
4 tasks
44 subprocess-based tests covering summary, trends, compare, and generate
commands with controlled fixture data, error cases, and edge cases.
Documents a parseArgs quirk where the second positional arg in compare
is lost due to eager target assignment before the loop.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@PAMulligan PAMulligan self-assigned this Apr 2, 2026
@PAMulligan PAMulligan added the enhancement New feature or request label Apr 2, 2026
@PAMulligan PAMulligan added this to the v1.1.0 milestone Apr 2, 2026
@PAMulligan PAMulligan changed the title test(scripts): add comprehensive tests for pipeline-cache.js test(scripts): add test coverage for critical automation scripts Apr 2, 2026
Paul Mulligan and others added 2 commits April 2, 2026 14:45
- Fix ESLint errors: replace require() with ESM import in verify-tokens test,
  remove unused imports (afterEach, existsSync, unlinkSync, extname, basename,
  execSync, readdirSync, statSync, METRICS_FILE, REPORT_DIR)
- Fix Prettier formatting on 8 files (6 test files + 2 source scripts)
- Fix CI workflow: use --config scripts/__tests__/vitest.config.js to enforce
  fileParallelism:false, preventing shared state corruption between
  pipeline-cache, stage-profiler, and metrics-dashboard tests

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The script's find command excludes */__tests__/* paths, which silently
hid all fixture files when they lived under scripts/__tests__/fixtures/.
Moving fixtures to os.tmpdir() avoids the exclusion pattern.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@PAMulligan PAMulligan merged commit 57bbaa6 into main Apr 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Development

Successfully merging this pull request may close these issues.

Add test coverage for critical automation scripts

1 participant