65 lines
1.3 KiB
TypeScript
65 lines
1.3 KiB
TypeScript
import { defineConfig } from 'vitest/config';
|
|
import { playwright } from '@vitest/browser-playwright';
|
|
import tailwindcss from '@tailwindcss/vite';
|
|
import { sveltekit } from '@sveltejs/kit/vite';
|
|
|
|
const backendTarget = process.env.BACKEND_URL ?? 'http://localhost:3000';
|
|
|
|
const proxiedPaths = [
|
|
'/api',
|
|
'/devices',
|
|
'/device-links',
|
|
'/streams',
|
|
'/events',
|
|
'/recordings',
|
|
'/videos',
|
|
'/push-notifications',
|
|
'/socket.io'
|
|
] as const;
|
|
|
|
const proxy = Object.fromEntries(
|
|
proxiedPaths.map((path) => [
|
|
path,
|
|
{
|
|
target: backendTarget,
|
|
changeOrigin: true,
|
|
ws: path === '/socket.io'
|
|
}
|
|
])
|
|
);
|
|
|
|
export default defineConfig({
|
|
plugins: [tailwindcss(), sveltekit()],
|
|
server: {
|
|
proxy
|
|
},
|
|
test: {
|
|
expect: { requireAssertions: true },
|
|
projects: [
|
|
{
|
|
extends: './vite.config.ts',
|
|
test: {
|
|
name: 'client',
|
|
browser: {
|
|
enabled: true,
|
|
provider: playwright(),
|
|
instances: [{ browser: 'chromium', headless: true }]
|
|
},
|
|
include: ['src/**/*.svelte.{test,spec}.{js,ts}'],
|
|
exclude: ['src/lib/server/**']
|
|
}
|
|
},
|
|
|
|
{
|
|
extends: './vite.config.ts',
|
|
test: {
|
|
name: 'server',
|
|
environment: 'node',
|
|
include: ['src/**/*.{test,spec}.{js,ts}'],
|
|
exclude: ['src/**/*.svelte.{test,spec}.{js,ts}']
|
|
}
|
|
}
|
|
]
|
|
}
|
|
});
|