/harness-claude:test-vitest-configfrom harness-claude
Configures Vitest with workspaces, environments, coverage, path aliases, setup files, and TypeScript integration for new or existing projects.
Claude never picks this skill on its own
Its frontmatter has no description. Without a description, Claude Code leaves it out of the list Claude chooses from. Typing /harness-claude:test-vitest-config still runs it.
What the skill costs in Claude's context, stage by stage
No description Claude Code can read, so Claude's list leaves it out: only you can start it.
SKILL.md joins the conversation and stays.
Configure Vitest with workspaces, environments, coverage, and TypeScript integration
// vitest.config.ts
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
globals: true,
environment: 'node',
include: ['src/**/*.test.ts'],
exclude: ['node_modules', 'dist', 'e2e'],
setupFiles: ['./test/setup.ts'],
testTimeout: 10_000,
},
});
// vite.config.ts
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
export default defineConfig({
plugins: [react()],
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['./test/setup.ts'],
},
});
// At the top of a test file:
// @vitest-environment jsdom
// Or in config, per glob pattern:
test: {
environmentMatchGlobs: [
['src/components/**', 'jsdom'],
['src/services/**', 'node'],
],
},
// vitest.workspace.ts
export default [
'packages/*/vitest.config.ts',
// Or inline:
{
test: {
name: 'unit',
include: ['src/**/*.test.ts'],
environment: 'node',
},
},
{
test: {
name: 'components',
include: ['src/**/*.test.tsx'],
environment: 'jsdom',
},
},
];
test: {
coverage: {
provider: 'v8',
reporter: ['text', 'html', 'lcov'],
include: ['src/**/*.ts'],
exclude: ['src/**/*.test.ts', 'src/**/*.d.ts'],
thresholds: {
branches: 80,
functions: 80,
lines: 80,
},
},
},
import { defineConfig } from 'vitest/config';
import tsconfigPaths from 'vite-tsconfig-paths';
export default defineConfig({
plugins: [tsconfigPaths()],
test: {
// ...
},
});
// test/setup.ts
import '@testing-library/jest-dom';
import { cleanup } from '@testing-library/react';
import { afterEach } from 'vitest';
afterEach(() => {
cleanup();
});
{
"compilerOptions": {
"types": ["vitest/globals"]
}
}
test: {
pool: 'forks', // 'threads' | 'forks' | 'vmThreads'
poolOptions: {
forks: { maxForks: 4 },
},
fileParallelism: true, // Run test files in parallel
},
test: {
snapshotFormat: {
printBasicPrototype: false,
},
resolveSnapshotPath: (testPath, snapExtension) =>
testPath.replace('src/', '__snapshots__/') + snapExtension,
},
Vitest is a Vite-native test framework that shares Vite's configuration, plugins, and transform pipeline. This means your tests use the same module resolution, path aliases, and transforms as your application code.
Environment options:
node — Node.js runtime. For services, utilities, API testsjsdom — Browser-like DOM via jsdom. For React/Svelte/Vue component testshappy-dom — Faster alternative to jsdom with more Web API supportedge-runtime — Cloudflare Workers/Vercel Edge runtime simulationglobals: true makes describe, it, expect, vi available without imports. Cleaner test files but requires TypeScript types configuration.
Pool options:
threads (default) — worker threads, shared memory, fastest for CPU-bound testsforks — child processes, full isolation, best for tests with global state leaksvmThreads — VM contexts, lighter than forks, good middle groundPerformance tips:
pool: 'threads' for fastest executionfileParallelism: true to run files in parallel--reporter=dot in CI for minimal output--changed flag to run only tests affected by changed filesWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeRead when SKILL.md points to them.
793 skills in this plugin
/a11y-aria-patternsARIA Patterns> Apply ARIA roles, states, and properties correctly to enhance assistive technology support for custom widgets/a11y-color-contrastColor Contrast and Color Independence> Ensure sufficient color contrast ratios and never use color as the sole means of conveying information/a11y-form-patternsAccessible Form Patterns> Build accessible forms with proper labeling, grouped controls, inline validation, and clear error communicationOther plugins' skills for the same job