# Frontend Unit Test

> Writes unit tests for JavaScript/TypeScript and frontend projects using Vitest or Jest. Use when writing or running tests.

- Skill: `carlos-algms/frontend-unit-test` (Agent Skill)
- Install (CLI): `npx skillmds@latest add carlos-algms/frontend-unit-test`
- Raw SKILL.md: https://api.skillmd.com/api/skills/carlos-algms/frontend-unit-test/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Web & Frontend
- Author: carlos-algms (https://skillmd.com/u/carlos-algms)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/carlos-algms/frontend-unit-test

---


# Unit Test Protocol

## Framework Detection

Never assume Jest or Vitest. Detect first:

- Check imports in test files
- Check config: `vitest.config.*`, `jest.config.*`
- Check `package.json` dependencies (workspace-specific in monorepos)
- Grep test scripts in package.json

## Running Tests

Run relevant tests only unless explicitly requested:

```bash
pnpm run test path/to/file.test.ts
# monorepo: cd apps/demo-app && pnpm run test path/to/file.test.ts
```

For all tests, use `test` script in closest `package.json`:

```bash
pnpm run test
# monorepo: cd apps/demo-app && pnpm run test
```

