placing-tests

Determines test file placement, vitest project assignment, and coverage floor governance.

Updated Sep 15, 2026
One-click install
npx skills add https://github.com/tomada1114/quick-reply-drill --skill placing-tests-tomada1114
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: placing-tests
Source: https://github.com/tomada1114/quick-reply-drill/tree/main/.agents/skills/placing-tests
Command: npx skills add https://github.com/tomada1114/quick-reply-drill --skill placing-tests-tomada1114

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Deciding where a new test file belongs in a repository with multiple vitest projects and per-glob coverage thresholds is error-prone: a misplaced test can silently inflate coverage, join no project, or run under the wrong environment. This Skill encodes the placement rules so every new test lands in the right location with the right budget and floor. ## Core Features & Use Cases - Location enforcement: All tests live under tests/, never co-located beside source, with four mechanical reasons tied to coverage config, project globs, ESLint scoping, and the Next.js build. - Project selection: Routes a test into one of four vitest projects — unit (default .test.ts), component (.test.tsx under jsdom), automation (explicit list for I/O and subprocesses), or smoke (requires a built app). - Coverage floor governance: Explains the per-glob threshold design, why src/app and src/components carry no floor, and why floors are never lowered or files excluded to move a number. - Use Case: When adding a test that spawns a subprocess against a temp directory, use this Skill to register it in the automationTests list with the 120-second budget instead of leaving it in unit where it would time out. ## Quick Start Ask the AI where a new test file for a given module should go and which vitest project and coverage floor apply to it.

Frequently Asked Questions about placing-tests

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

FAQPage Schema
Where should I put a new test file in a Next.js project?▼

Place every test under tests/ named after the seam it covers, such as tests/home-page.test.tsx, never beside the source module. Co-located tests would inflate coverage, miss the vitest project globs, get the wrong ESLint rules, and become Next.js build input.

How do I choose between vitest unit, component, and automation projects?▼

Selection follows what the test touches: .test.ts files with no I/O default to unit, .test.tsx files join component under jsdom by extension, and anything spawning subprocesses or using temp directories must be registered in the explicit automationTests list with a 120-second budget.

Why does my vitest test time out in the unit project?▼

Unit and component tests have a 5-second budget because they perform no I/O, so a timeout indicates an infinite loop or unresolved promise. If the test legitimately needs filesystem or subprocess access, move it to the automation project's explicit list.

Can I lower a coverage threshold to make CI pass?▼

No. Coverage floors are never lowered and no file is added to coverage.exclude to move a number. When pnpm test:coverage fails on a floor, add real branch coverage for the uncovered code instead of adjusting the threshold or include list.

Why does a module tested via subprocess show 0% coverage?▼

The v8 coverage provider only instruments Vitest worker processes, so code executing solely inside a spawned child process reports 0% regardless of test thoroughness. Keep the child-process code thin and move logic into modules the test can call in-process.

When should a test join the smoke project instead of automation?▼

A test joins smoke only when it cannot run without pnpm build output, such as starting the built app with next start and asserting over fetch. Prefer automation whenever an in-process test could assert the same thing, since smoke is excluded from default runs.