import { fileURLToPath } from 'node:url' import { defineConfig } from 'vitest/config' // Unit tests of the layer in Node: the pure modules of app/lib (bm's chat // tests sit next to their ports there) and the client, store and embed // tests in tests/. The alias ~ resolves to app/, as in Nuxt, so modules // that import through it run outside Nuxt, and bm's @/api/http to the // ApiError of tests/support. Components are covered by the // consuming app's browser checks. export default defineConfig({ resolve: { alias: [ // bm's ApiError, which the ported realtime test rejects the token // route with. { find: /^@\/api\/http$/, replacement: fileURLToPath(new URL('./tests/support/http.ts', import.meta.url)) }, { find: /^~\//, replacement: fileURLToPath(new URL('./app/', import.meta.url)) }, ], }, test: { environment: 'node', include: ['app/**/*.test.ts', 'tests/**/*.test.ts'], }, })