Add vitest 4.1, jsdom 25, and @testing-library/preact as devDeps so the widget gets a real test surface for the upcoming Shadow DOM mount work. - vitest.config.ts mirrors the build aliases (preact/compat) and uses jsdom for DOM-touching tests. - tests/setup.ts is the place to add polyfills as the surface grows. - tests/unit/smoke.test.ts confirms vitest runs, jsdom is wired, and Shadow DOM API is available. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
21 lines
497 B
TypeScript
21 lines
497 B
TypeScript
import { defineConfig } from 'vitest/config';
|
|
import { resolve } from 'path';
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias: {
|
|
react: 'preact/compat',
|
|
'react-dom': 'preact/compat',
|
|
'react-dom/test-utils': 'preact/test-utils',
|
|
'react/jsx-runtime': 'preact/jsx-runtime',
|
|
'@': resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
test: {
|
|
environment: 'jsdom',
|
|
globals: true,
|
|
setupFiles: ['./tests/setup.ts'],
|
|
include: ['tests/unit/**/*.test.ts'],
|
|
},
|
|
});
|