# 16-testing

The 16-testing prompt wires up Vitest in the claude-code project and writes tests for shims, tools, commands and context. It fires when the leaked-and-rebuilt source has no test suite at all.

- prompt · `type=prompt` · Claude Code, ChatGPT · ★ 3444 repo stars
- Author: codeaashu
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/codeaashu/claude-code/tree/HEAD/prompts/16-testing.md
- Updated: 2026-10-14
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/prompts/16-testing

## What it does

The prompt walks through installing `vitest` and `@types/node` with `bun add -d`, writing a `vitest.config.ts` that aliases `bun:bundle` to `src/shims/bun-bundle.ts`, and a `tests/setup.ts` that loads `src/shims/preload.js`. It then lists the files to create: unit tests for `bun-bundle.test.ts` and `macro.test.ts`, smoke tests for `tools.test.ts`, `commands.test.ts`, `context.test.ts` and `prompt.test.ts`, integration tests for the API and MCP, and a build check on `dist/cli.mjs`.

The integration tests in `tests/integration/api.test.ts` and `mcp.test.ts` are meant to skip automatically when `ANTHROPIC_API_KEY` is absent and run the real checks once the key is set. An optional pre-commit hook chains `bun run typecheck && bun run test`, but only if the project already uses git hooks.

The whole plan assumes the claude-code sources already sit at `/workspaces/claude-code` and that functions like `getTools()`, `getCommands()`, `getSystemContext()` and `getSystemPrompt()` exist under those exact names, so it's tied to that specific reconstructed codebase rather than a generic project.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/commands/16-testing.md`

### ChatGPT

**How to use**
- Paste the text at the start of a chat or into project instructions

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/codeaashu/claude-code/tree/HEAD/prompts/16-testing.md

## When to use it
- bootstrap Vitest in a project that ships with zero tests
- check that `feature()` in `bun-bundle` returns correct flag values
- write smoke tests that confirm tools, commands and the system prompt load
- skip API integration tests when `ANTHROPIC_API_KEY` is missing
- verify the built `dist/cli.mjs` runs and answers `--version`

## Example prompts
- Run the 16-testing prompt and set up Vitest in /workspaces/claude-code
- Write the tools.test.ts and commands.test.ts smoke tests from the 16-testing plan
- Add the MCP integration tests from part D of the 16-testing prompt

## Similar
- [angular-testing](https://affpapa.org/en/nevibecode/skills/angular-testing.md) — skill · 6700 installs
- [capacitor-testing](https://affpapa.org/en/nevibecode/skills/capacitor-testing.md) — skill · 1400 installs
- [vitest-testing](https://affpapa.org/en/nevibecode/skills/vitest-testing.md) — skill · 1300 installs
- [testing-best-practices](https://affpapa.org/en/nevibecode/skills/testing-best-practices.md) — skill · 975 installs
- [testing-livekit-agents](https://affpapa.org/en/nevibecode/skills/testing-livekit-agents.md) — skill · 516 installs
- [javascript-testing-patterns](https://affpapa.org/en/nevibecode/skills/javascript-testing-patterns.md) — skill · 20472 installs

From the same set: [codeaashu/claude-code](https://affpapa.org/en/nevibecode/by/codeaashu/claude-code.md) — 17 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
