Skip to content

Vitest Config

@theholocron/vitest-config provides Vitest configuration presets that cover the common testing environments used across theholocron projects.

Terminal window
pnpm add -D @theholocron/vitest-config vitest

For Node.js packages. Uses the node environment and emits coverage with v8.

vitest.config.ts
import { node } from "@theholocron/vitest-config/presets/node";
export default node();

For React component libraries. Uses jsdom environment and adds React Testing Library globals.

import { react } from "@theholocron/vitest-config/presets/react";
export default react();

For Storybook interaction tests.

import { storybook } from "@theholocron/vitest-config/presets/storybook";
export default storybook();

Pre-composed config for npm packages: node preset + coverage thresholds at 80%.

vitest.config.ts
import { library } from "@theholocron/vitest-config/bundles/library";
export default library();