plugins/typescript-expert/skills/ts-testing/SKILL.md
Use when writing or configuring TypeScript tests and choosing between bun test and Vitest. Covers runner selection, config, mocks, snapshots, and coverage. Do NOT use for framework-specific testing (React components → react-expert react-testing, Laravel → laravel-testing) or browser E2E suites.
npx skillsauth add fusengine/agents ts-testingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Pick the right runner, then write tests with a shared Jest-compatible API.
Before ANY implementation, use TeamCreate to spawn 3 agents:
After implementation, run fuse-ai-pilot:sniper for validation.
Both runners share a Jest-like API (describe/it/expect, lifecycle hooks,
snapshots, mocks). They differ on speed, coverage maturity, and CI scaling.
| Runner | Strength | Weakness |
|--------|----------|----------|
| bun test | Fastest cold start, zero-config TS/JSX, built-in | Single process, experimental coverage, mock limits |
| Vitest | V8/Istanbul coverage, multi-worker CI scaling, ~Jest parity, browser mode | Needs Vite + config, slower cold start |
bun:test and vitest importsbun run test, not bun test, when the runner is Vitest - Else Bun runs its own--randomize (Bun) to catch order bugsChoosing a runner?
├── Greenfield, Bun runtime, fast local TDD → bun test
├── Large suite / heavy CI parallelism → Vitest (multi-worker)
├── Migrating from Jest / need full coverage → Vitest (V8 + Istanbul)
├── Component/DOM in real browser → Vitest browser mode (Playwright)
└── Zero-dependency script or CLI → bun test
→ See references/choosing-runner.md for the full matrix
| Topic | Reference | Load when |
|-------|-----------|-----------|
| Runner selection | references/choosing-runner.md | Deciding bun test vs Vitest |
| Bun test runner | references/bun-test.md | Using bun test |
| Vitest | references/vitest.md | Using Vitest |
| Shared API | references/common-patterns.md | Writing describe/it/mock/snapshot |
| Template | Use Case |
|----------|----------|
| references/templates/bun-setup.md | bunfig.toml + first Bun tests |
| references/templates/vitest-setup.md | vitest.config.ts + coverage + CI |
import { test, expect } from "bun:test";
test("2 + 2", () => {
expect(2 + 2).toBe(4);
});
bun test --coverage
→ See references/templates/bun-setup.md
import { test, expect } from "vitest";
test("adds 1 + 2", () => {
expect(1 + 2).toBe(3);
});
npx vitest run --coverage
→ See references/templates/vitest-setup.md
*.test.ts next to sourcewaitFor/async blocktesting
Copy self-audit and ban-lists — filler verbs/hype adjectives, slop placeholder names, fake-precise numbers, Title Case headlines, humor in error copy ('Oops!'), em-dash crutch, one copy register per page.
development
Logged-in web apps — dashboards, auth flows, settings, onboarding, data tables, command palettes, modals, toasts. Register `product`: density and glance-speed over marketing polish, no hero/CTA-tricks, every data surface covers empty/loading/error explicitly, tables and dataviz follow preattentive-processing rules.
development
Marketing sites, landing pages, campaign pages — register `brand` (design IS the product). Structure comes from the register's POV + a macrostructure pick, never from copying an inspiration site's section flow. Hero discipline, deviated section order, asymmetric grids, and a silhouette lookalike-test gate before ship.
development
Token-strategy core — OKLCH color rules, neutral tinting, accent-commitment levels, type scale, 8pt spacing grid, touch targets, and the canonical output format of design-system.md (the file the harness gates on). This is routing step 1 of design-method/SKILL.md — read it before design-web/design-webapp/design-ios/design-android, before picking or auditing a single color/type/spacing value.