Files
supabase/apps/studio/vitest.config.ts
Drake CostaandJoshen Lim 57cd26ac77 Move non-layout Storage components to components/interfaces (#37381)
* Update studio testing setup files

Improves API mocking type safety and polyfills browser APIs necessary to run tests with framer-motion components

* fix missing listen call for msw, resolve test type error

* fix imports

* Update studio testing setup files

Improves API mocking type safety and polyfills browser APIs necessary to run tests with framer-motion components

* fix missing listen call for msw, resolve test type error

* fix imports

* Move non-layout Storage related components to `components/interfaces`

* Fix paths

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
2025-07-22 23:48:20 +08:00

40 lines
1.2 KiB
TypeScript

import { resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'
import react from '@vitejs/plugin-react'
import tsconfigPaths from 'vite-tsconfig-paths'
// Some tools like Vitest VSCode extensions, have trouble with resolving relative paths,
// as they use the directory of the test file as `cwd`, which makes them believe that
// `setupFiles` live next to the test file itself. This forces them to always resolve correctly.
const dirname = fileURLToPath(new URL('.', import.meta.url))
export default defineConfig({
plugins: [
react(),
tsconfigPaths({
projects: ['.'],
}),
],
resolve: {
alias: {
'@ui': resolve(__dirname, './../../packages/ui/src'),
},
},
test: {
globals: true,
environment: 'jsdom', // TODO(kamil): This should be set per test via header in .tsx files only
setupFiles: [
resolve(dirname, './tests/vitestSetup.ts'),
resolve(dirname, './tests/setup/polyfills.js'),
resolve(dirname, './tests/setup/radix.js'),
],
reporters: [['default']],
coverage: {
reporter: ['lcov'],
exclude: ['**/*.test.ts', '**/*.test.tsx'],
include: ['lib/**/*.ts'],
},
},
})