31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { fileURLToPath } from 'node:url'
|
|
|
|
import { defineConfig } from 'vitest/config'
|
|
|
|
/**
|
|
* Test configuration, kept separate from vite.config.ts so that the test options
|
|
* are not part of the production build configuration. The type definitions of the
|
|
* two tools overlap but are not identical, and mixing them produces confusing
|
|
* errors about the `test` key.
|
|
*/
|
|
export default defineConfig({
|
|
// The integration tests import the actual shipped SDK modules (sdk/src/*) to drive
|
|
// the real custom elements. Those live one directory up, outside the web package
|
|
// root, so Vite's default filesystem allow-list has to be widened to the repository
|
|
// root for the cross-package import to resolve.
|
|
server: {
|
|
fs: {
|
|
allow: [fileURLToPath(new URL('..', import.meta.url))],
|
|
},
|
|
},
|
|
test: {
|
|
// The admin interface is a browser application: components touch the DOM,
|
|
// localStorage and matchMedia, so jsdom is required rather than merely useful.
|
|
environment: 'jsdom',
|
|
globals: true,
|
|
setupFiles: ['./src/test/setup.ts'],
|
|
css: false,
|
|
// Tests live next to what they test.
|
|
include: ['src/**/*.test.{ts,tsx}'],
|
|
},
|
|
})
|