一键导入
test-discovery
Explains the prescribed __test__/ directory layout, test file naming conventions, and how source coverage is derived from the adjacent src/ folder.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Explains the prescribed __test__/ directory layout, test file naming conventions, and how source coverage is derived from the adjacent src/ folder.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | test-discovery |
| description | Explains the prescribed __test__/ directory layout, test file naming conventions, and how source coverage is derived from the adjacent src/ folder. |
| paths | ["**/__test__/**/*","**/__fixtures__/**/*","**/__snapshots__/**/*"] |
__test__/ ConventionsProjects using this layout place tests in a __test__/ directory that sits adjacent to src/. Coverage is calculated from that src/ directory. Auto-discovery tools (like AgentPlugin.discover()) may generate Vitest projects from this structure automatically, but custom project configurations are also possible.
<project-root>/
├── src/ source code — coverage is calculated from here
└── __test__/ tests and test support files
__test__/ Directory StructureTest files sit flat at the top level of __test__/; helper files go in reserved subdirectories organised by test kind.
__test__/
├── *.test.ts | *.test.unit unit test files
├── fixtures/ static files needed by unit tests
├── snapshots/ Vitest snapshot files for unit tests
├── utils/ shared helpers for unit tests
├── integration/
│ ├── *.int.test.ts integration test files
│ ├── fixtures/ static files needed by integration tests
│ ├── snapshots/ Vitest snapshot files for integration tests
│ └── utils/ shared helpers for integration tests
└── e2e/
├── *.e2e.test.ts e2e test files
├── fixtures/ static files needed by e2e tests
├── snapshots/ Vitest snapshot files for e2e tests
└── utils/ shared helpers for e2e tests
| Subdirectory | Coverage | Lint | Typecheck | Purpose |
|---|---|---|---|---|
fixtures/ | excluded | excluded | excluded | Static files consumed by tests (JSON, TOML, binary, etc.) |
snapshots/ | excluded | excluded | excluded | Vitest snapshot output (managed automatically) |
utils/ | excluded | required | required | Shared helpers — mocks, extended expect, shared types |
Fixtures and snapshots are fully excluded; place arbitrary static content there without concern for linting or types. Utils files must be valid TypeScript and pass the linter — treat them as first-class support code, just not counted toward coverage.
__fixtures__ and __snapshots__ AnywhereDirectories named __fixtures__ or __snapshots__ (double-underscore wrapping) are recognised and excluded from coverage, linting, and typechecking wherever they appear inside a project — not just under __test__/. This can be useful when a fixture needs to live close to the source file it supports.
Prefer the prescribed locations (__test__/fixtures/, __test__/integration/fixtures/, etc.) over this escape hatch. Scattering __fixtures__ directories through src/ makes test support files harder to find and the project harder to navigate.
The scanner classifies files by suffix; first match wins:
| Suffix | Kind | Lives in |
|---|---|---|
*.e2e.test.ts | e2e | __test__/e2e/ |
*.int.test.ts | int | __test__/integration/ |
*.test.ts or *.unit.test.ts | unit | __test__/ (top level) |
Use when starting any TDD cycle, before writing any test file, editing any production file, running tests, or advancing a phase — required before any of those actions.
How to drive the vitest-agent MCP tools correctly — the non-obvious operational facts (run_tests scoping, why subset runs "fail" coverage, the consoleLeaks signal, the VITEST_AGENT_CONSOLE escape hatch, auto-recovered attribution) that otherwise cost trial-and-error.
Guide @vitest-agent/plugin configuration including thresholds, targets, output format, and plugin options. Use when setting up or modifying the plugin configuration.
Required before any production-code edit during the red phase. Forces externalization of "why I think this fix will work" with cited test_error_id and stack_frame_id evidence.
Use when starting a dogfood session for the vitest-agent plugin in this repo, when continuing one from an existing handoff at docs/superpowers/dogfood/<chain>/, or after the TDD orchestrator subagent completes a dogfood task. Repo-internal — does not apply to projects that consume vitest-agent as a dependency.
Use when reaching any TDD phase transition — spike close, red→green, green→refactor, or discard — required before exiting the phase so each cycle lands as a discrete, greppable commit in git history.