Files
sortsys-ui/vitest.config.ts
Ludwig Lehnert 0efd3d954b
Some checks failed
CodeQL / Analyze (push) Failing after 1m32s
initial commit
2026-01-11 11:08:48 +01:00

43 lines
1.2 KiB
TypeScript

import { defineConfig } from 'vitest/config'
import solidPlugin from 'vite-plugin-solid'
export default defineConfig(({ mode }) => {
// to test in server environment, run with "--mode ssr" or "--mode test:ssr" flag
// loads only server.test.ts file
const testSSR = mode === 'test:ssr' || mode === 'ssr'
return {
plugins: [
solidPlugin({
// https://github.com/solidjs/solid-refresh/issues/29
hot: false,
// For testing SSR we need to do a SSR JSX transform
solid: { generate: testSSR ? 'ssr' : 'dom' },
}),
],
test: {
watch: false,
isolate: !testSSR,
env: {
NODE_ENV: testSSR ? 'production' : 'development',
DEV: testSSR ? '' : '1',
SSR: testSSR ? '1' : '',
PROD: testSSR ? '1' : '',
},
environment: testSSR ? 'node' : 'jsdom',
transformMode: { web: [/\.[jt]sx$/] },
...(testSSR
? {
include: ['test/server.test.{ts,tsx}'],
}
: {
include: ['test/*.test.{ts,tsx}'],
exclude: ['test/server.test.{ts,tsx}'],
}),
},
resolve: {
conditions: testSSR ? ['node'] : ['browser', 'development'],
},
}
})