Skip to content

test: Remove duplicate and theatrical tests#3064

Merged
louisgv merged 2 commits intomainfrom
qa/dedup-scanner
Mar 27, 2026
Merged

test: Remove duplicate and theatrical tests#3064
louisgv merged 2 commits intomainfrom
qa/dedup-scanner

Conversation

@la14-1
Copy link
Copy Markdown
Member

@la14-1 la14-1 commented Mar 27, 2026

Summary

  • Scanned all 101 test files in packages/cli/src/__tests__/ for duplicate describe blocks, theatrical tests, always-pass patterns, and excessive subprocess spawning
  • Found one clear anti-pattern: 5 nearly-identical it() blocks each asserting a single env var for one agent (openclaw, zeroclaw, hermes, kilocode, opencode)
  • Consolidated into a single data-driven table test with descriptive per-assertion messages

Findings

No true duplicates found: No function is tested by identical describe blocks across multiple files. The *-cov.test.ts files add coverage for different code paths.

No bash-grep tests found: All subprocess usages (spawnSync, Bun.spawn) in tests are mocked with spyOn, not actually spawned.

No silently-skipping conditionals: The if (!result.ok) { expect(...) } pattern in orchestrate.test.ts is legitimate TypeScript narrowing — the outer expect(result.ok).toBe(false) always asserts, so the branch never silently skips.

One anti-pattern fixed in agent-setup-cov.test.ts: 5 → 1 test, same coverage, clearer failure messages.

Test plan

  • bun test in worktree: 1951 pass, 0 fail (was 1955 — net -4 from consolidation)
  • bunx @biomejs/biome check src/: 0 errors

-- qa/dedup-scanner

Five separate it() blocks each checking one agent's env vars (openclaw,
zeroclaw, hermes, kilocode, opencode) were collapsed into a single
data-driven table test. The new test checks all 8 env-var expectations
in one loop with clear per-assertion failure messages.

Tests removed: 5 individual envVars tests
Tests added: 1 consolidated table test
Net: -4 tests (1951 vs 1955), same coverage

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@louisgv louisgv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Security Review

Verdict: APPROVED
Commit: 2b589b6

Findings

No security issues found.

Changes

  • Consolidated 5 duplicate agent envVars tests into a single data-driven test
  • Removed theatrical individual tests for openclaw, zeroclaw, hermes, kilocode, and opencode
  • Replaced with table-driven test covering all 5 agents

Tests

  • bash -n: N/A (no shell scripts)
  • bun test: PASS (1951 tests pass, 0 fail)
  • curl|bash: N/A (no shell scripts)
  • macOS compat: N/A (no shell scripts)

-- security/pr-reviewer

@louisgv louisgv merged commit d666ab1 into main Mar 27, 2026
5 checks passed
@louisgv louisgv deleted the qa/dedup-scanner branch March 27, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants