-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathvitest.config.ts
More file actions
39 lines (38 loc) · 1.59 KB
/
Copy pathvitest.config.ts
File metadata and controls
39 lines (38 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { svelte } from '@sveltejs/vite-plugin-svelte'
import { resolve } from 'path'
import { defineConfig } from 'vitest/config'
import { json_gz_plugin } from './vite.shared'
export default defineConfig({
plugins: [svelte({ hot: false }), json_gz_plugin(true)],
resolve: {
alias: {
'$lib': resolve(__dirname, 'src/lib'),
'$site': resolve(__dirname, 'src/site'),
'$root': resolve(__dirname, '.'),
'catgo': resolve(__dirname, 'src/lib'),
// SvelteKit's $app/* modules aren't available outside a SvelteKit
// build; route them at the local mocks so unit tests can import code
// that depends on `browser`/`dev`/`building` flags.
'$app/environment': resolve(__dirname, 'src/lib/mocks/environment.ts'),
},
conditions: ['browser'],
},
test: {
environment: 'happy-dom',
// Global setup: localStorage polyfill (Node 25's native stub lacks
// getItem/setItem), ResizeObserver mock, and i18n seeding. Previously only
// applied to files that imported setup.ts for its helpers, leaving suites
// like theme/materials-project with a broken native localStorage on Node 25.
setupFiles: ['./tests/vitest/setup.ts'],
include: ['tests/vitest/**/*.test.ts', 'tests/desktop/**/*.test.ts', 'src/**/__tests__/**/*.test.ts'],
globals: false,
// quickhull3d ships an ESM index.js that imports `./QuickHull` without
// an extension. Node's ESM resolver rejects that — force Vite to
// bundle the package so its module-graph transform fills the extension.
server: {
deps: {
inline: ['quickhull3d'],
},
},
},
})