test-file-split

Splits oversized test files exceeding the 500-line FR-006 cap into focused modules.

Updated Sep 14, 2026
One-click install
npx skills add https://github.com/pandejesal/drone-nav-sar --skill test-file-split-pandejesal
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: test-file-split
Source: https://github.com/pandejesal/drone-nav-sar/tree/main/.swarm/bundled-skills/test-file-split
Command: npx skills add https://github.com/pandejesal/drone-nav-sar --skill test-file-split-pandejesal

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Test files that grow past the 500-line FR-006 limit fail CI quality gates and block PR merges, forcing developers to manually reorganize large test suites without breaking mock isolation or coverage. ## Core Features & Use Cases - Boundary Identification: Locates natural describe-block boundaries and groups tests by functional area for clean extraction. - Shared Helper Management: Provides three strategies for handling shared imports, fixtures, and mock factories across split files. - Mock Isolation Verification: Includes co-run testing commands to detect mock.module leakage that causes failures only when files run together. - Use Case: A 640-line release-notes test file fails CI. Use this protocol to split it into two focused files under 500 lines each, extract shared helpers, and verify both pass isolated and co-run execution. ## Quick Start Split the oversized test file tests/unit/scripts/my-module.test.ts into smaller files that each pass the 500-line CI check.

Frequently Asked Questions about test-file-split

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I split a test file that exceeds 500 lines?

Identify natural describe-block boundaries, group them by functional area, then move each group into a new file named with a suffix like module-area.test.ts. Extract shared fixtures into a tests/helpers utility, then verify both files pass isolated and co-run execution.

How to fix CI failures from the FR-006 test file size limit?

The check-test-file-cap.ts script fails PRs containing new or growing test files over 500 lines. Split the file using describe-block extraction, or set TEST_CAP_ENFORCE=0 to soft-warn temporarily while you reorganize.

Why do split test files fail when run together but pass individually?

Bun shares a single process across test files, so mock.module calls leak between files and cause co-run failures. Check for unmocked module leaks and use the _internals dependency-injection seam pattern to isolate mocks per file.

When should I stop splitting a test file and reorganize instead?

If a previously split file exceeds 500 lines again, the suite is structurally too large for one module. Reorganize tests by source module boundaries rather than splitting a third time, which produces fragmented, hard-to-navigate suites.

What naming convention should split test files use?

Use module-area.test.ts for functional-area splits, such as release-notes-fragments-sha.test.ts, or module-area.adversarial.test.ts when separating adversarial test cases into their own file.