Files
vue-chat-layer/vitest.config.ts
Jakub Zych b6d3389e46 test: the SPA's chat tests on the port, client, store and link embeds
- vitest runs app/**/*.test.ts and tests/**/*.test.ts; the SPA's
  chatEvents, chatFormat, chatText, chatUnread and realtime tests sit next
  to their ports with only import paths changed
- linkEmbeds: escaping, http(s) only, rel and target, registry order
- client: every endpoint, refresh-and-retry, unauthorized, 422, upload
- store: bootstrap, anonymous and non-member starts, lazy joins, DMs,
  live messages and unread, threads, pins, reactions, slash commands,
  polling without realtime, onUserEvent, DM-only actions
2026-11-01 19:17:42 +01:00

24 lines
938 B
TypeScript

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'],
},
})