mirror of
https://github.com/tiennm99/mathmax.git
synced 2026-09-17 20:19:49 +00:00
Adds the svelte plugin and the $lib alias so *.svelte.js modules can be imported by tests. The lesson interaction logic was untestable without it.
21 lines
622 B
JavaScript
21 lines
622 B
JavaScript
import { fileURLToPath } from 'node:url';
|
|
import { defineConfig } from 'vitest/config';
|
|
import { svelte } from '@sveltejs/vite-plugin-svelte';
|
|
|
|
export default defineConfig({
|
|
// The svelte plugin is what lets `*.svelte.js` rune modules be imported by
|
|
// tests; without it the interaction modules are untestable.
|
|
plugins: [svelte()],
|
|
resolve: {
|
|
conditions: ['browser'],
|
|
// SvelteKit normally injects $lib; vitest runs without that layer.
|
|
alias: {
|
|
$lib: fileURLToPath(new URL('./src/lib', import.meta.url)),
|
|
},
|
|
},
|
|
test: {
|
|
include: ['src/**/*.test.js'],
|
|
environment: 'node',
|
|
},
|
|
});
|