Files
moeka-project/packages/stage-ui/vitest.config.ts
T
2026-09-06 16:28:01 +00:00

66 lines
1.6 KiB
TypeScript

import { cwd } from 'node:process'
import Vue from '@vitejs/plugin-vue'
import UnoCSS from 'unocss/vite'
import Info from 'unplugin-info/vite'
import { playwright } from '@vitest/browser-playwright'
import { loadEnv } from 'vite'
import { defineConfig } from 'vitest/config'
import { sharedUnoConfig } from '../../uno.config'
export default defineConfig({
root: import.meta.dirname,
plugins: [
Info(),
Vue(),
UnoCSS({
// Browser tests use product styles, not Histoire's hover-preview variants.
...sharedUnoConfig(),
configFile: false,
// Vitest loads components after the stylesheet. Scan their source before
// the initial CSS response instead of relying on Vite's HMR updates.
content: {
filesystem: [
`${import.meta.dirname}/src/**/*.vue`,
`${import.meta.dirname}/../ui/src/**/*.vue`,
],
},
}),
],
test: {
env: loadEnv('test', cwd(), ''),
projects: [
{
extends: true,
test: {
name: 'node',
include: ['src/**/*.test.ts'],
exclude: ['src/**/*.browser.test.ts'],
fileParallelism: false,
hookTimeout: 20_000,
maxWorkers: 1,
testTimeout: 20_000,
},
},
{
extends: true,
test: {
name: 'browser',
include: ['src/**/*.browser.test.ts'],
exclude: ['**/node_modules/**'],
browser: {
enabled: true,
headless: true,
provider: playwright(),
instances: [
{ browser: 'chromium' },
],
},
},
},
],
},
})