64 lines
1.8 KiB
TypeScript
Executable file
64 lines
1.8 KiB
TypeScript
Executable file
/**
|
|
* Vitest Configuration Presets
|
|
*
|
|
* Composable vitest configurations to reduce duplication across packages.
|
|
*
|
|
* ## Available Presets
|
|
*
|
|
* - **nestPreset** - For NestJS backends (SWC + decorator metadata)
|
|
* - **nodePreset** - For Node.js packages (no DOM)
|
|
* - **jsdomPreset** - For browser packages (DOM, no React)
|
|
* - **reactPreset** - For React applications (DOM + React)
|
|
*
|
|
* ## Quick Start
|
|
*
|
|
* ```typescript
|
|
* // NestJS backend (marketplace, messaging, etc.)
|
|
* import { nestPreset } from '@lilith/test-utils/vitest-presets'
|
|
* export default nestPreset()
|
|
*
|
|
* // Node package (algorithms, crypto-tools, etc.)
|
|
* import { nodePreset } from '@lilith/test-utils/vitest-presets'
|
|
* export default nodePreset()
|
|
*
|
|
* // React app (platform-user, storefront, etc.)
|
|
* import { reactPreset } from '@lilith/test-utils/vitest-presets'
|
|
* export default reactPreset()
|
|
* ```
|
|
*
|
|
* ## Customization
|
|
*
|
|
* All presets accept custom configuration that will be merged with defaults:
|
|
*
|
|
* ```typescript
|
|
* import { nestPreset } from '@lilith/test-utils/vitest-presets'
|
|
* import path from 'path'
|
|
*
|
|
* export default nestPreset({
|
|
* test: {
|
|
* setupFiles: ['./test/setup.ts'],
|
|
* },
|
|
* resolve: {
|
|
* alias: {
|
|
* '@': path.resolve(__dirname, './src'),
|
|
* }
|
|
* }
|
|
* })
|
|
* ```
|
|
*
|
|
* ## Base Configuration
|
|
*
|
|
* All presets inherit from `baseConfig` which provides:
|
|
* - Global test utilities (describe, it, expect)
|
|
* - 10s timeout
|
|
* - v8 coverage provider
|
|
* - Standard file exclusions
|
|
*
|
|
* @packageDocumentation
|
|
*/
|
|
|
|
export { baseConfig, createPreset } from './base.preset.ts'
|
|
export { nodePreset } from './node.preset.ts'
|
|
export { jsdomPreset } from './jsdom.preset.ts'
|
|
export { reactPreset } from './react.preset.ts'
|
|
export { nestPreset } from './nest.preset.ts'
|