63 lines
1.6 KiB
TypeScript
63 lines
1.6 KiB
TypeScript
import { defineConfig } from 'vitest/config'
|
|
import react from '@vitejs/plugin-react'
|
|
import tsconfigPaths from 'vite-tsconfig-paths'
|
|
import dotenv from 'dotenv'
|
|
import path from 'path'
|
|
import { resolve } from 'node:path'
|
|
const env = dotenv.config({path: './.env'})
|
|
export default defineConfig({
|
|
plugins: [tsconfigPaths(), react()],
|
|
optimizeDeps: {
|
|
include: [
|
|
'@tanstack/react-query-next-experimental',
|
|
],
|
|
},
|
|
ssr: {
|
|
noExternal: [
|
|
'@tanstack/react-query-next-experimental',
|
|
],
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'~/server/db': resolve('./test/aliases/db.ts')
|
|
}
|
|
},
|
|
test: {
|
|
// fileParallelism: false,
|
|
reporters: ['verbose'],
|
|
coverage: { provider: 'v8', reporter: ['html-spa']},
|
|
projects: [
|
|
{
|
|
extends: true,
|
|
test: {
|
|
mockReset: true,
|
|
name: "server",
|
|
setupFiles: [
|
|
'./test/db/setup.ts',
|
|
'./test/mocks/vitest.isAdmin.mock.ts',
|
|
'./test/mocks/vitest.nextnavigation.mock.ts',
|
|
],
|
|
include: ['./src/**/*.server.test.ts'],
|
|
env: env.parsed
|
|
}
|
|
},
|
|
{
|
|
extends: true,
|
|
test: {
|
|
mockReset: true,
|
|
name: "client",
|
|
setupFiles: [
|
|
'./test/trpc/server.ts',
|
|
'./test/db/setup.ts',
|
|
'./test/trpc/GetBaseUrl.mock.ts',
|
|
'./test/mocks/vitest.isAdmin.mock.ts',
|
|
'./test/mocks/vitest.nextnavigation.mock.ts',
|
|
],
|
|
include: ['./src/**/*.client.test.ts','./src/**/*.client.test.tsx'],
|
|
environment: 'jsdom',
|
|
}
|
|
}
|
|
]
|
|
},
|
|
})
|