No test runner existed in the repo. Add vitest (node env, *.spec.ts discovery) with a minimal config mirroring only the `@`→src alias, plus `test`/`test:watch` scripts and a smoke test as a known-good baseline. Precursor for the nostr-patterns review fixes (events store coordinate keying #121, monotonic created_at #122), which ship with unit tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
23 lines
865 B
TypeScript
23 lines
865 B
TypeScript
import { fileURLToPath, URL } from 'node:url'
|
|
import { defineConfig } from 'vitest/config'
|
|
|
|
// Minimal test runner config. Unit tests live next to the code they
|
|
// cover as `*.spec.ts`. The default `node` environment is enough for
|
|
// the pure logic + Pinia/Vue-reactivity tests we run today (no DOM);
|
|
// switch a given file to jsdom via a per-file `// @vitest-environment`
|
|
// pragma if a component test ever needs it.
|
|
//
|
|
// Only the bare `@` → src alias is mirrored from vite.config.ts. The
|
|
// brand-kit aliases (@brand-*) are build-time asset shims that unit
|
|
// tests don't touch, so they're deliberately omitted to keep this lean.
|
|
export default defineConfig({
|
|
test: {
|
|
environment: 'node',
|
|
include: ['src/**/*.spec.ts'],
|
|
},
|
|
resolve: {
|
|
alias: [
|
|
{ find: '@', replacement: fileURLToPath(new URL('./src', import.meta.url)) },
|
|
],
|
|
},
|
|
})
|