Files
supabase/apps/studio/vitest.config.mts
Ivan Vasilov 06aa80e9f0 chore: Bump next to non-vulnerable version (#31277)
* Add next to pnpm catalog and use that next version from all apps and packages.

* Remove vite direct dependency.

* Set the @types/node to version 20.

* Stabilize supports-color by adding it in the main package.json. This will make it appear in all packages that have it as optional.

* Use built-in matchers for vitest in @testing-library/jest-dom.

* Add libpg-query as a dependency to docs.

* Remove nextjs-node-loader for the built-in external packages feature on nextjs.

* Clean up extra comment.
2025-01-03 13:25:00 +01:00

39 lines
1.2 KiB
TypeScript

import react from '@vitejs/plugin-react'
import path, { resolve } from 'path'
import { fileURLToPath } from 'url'
import tsconfigPaths from 'vite-tsconfig-paths'
import { defineConfig } from 'vitest/config'
// 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': path.resolve(__dirname, './../../packages/ui/src'),
},
},
test: {
globals: true,
environment: 'jsdom', // TODO(kamil): This should be set per test via header in .tsx files only
include: [
resolve(dirname, './tests/**/*.test.{ts,tsx}'),
resolve(dirname, './components/**/*.test.{ts,tsx}'),
],
restoreMocks: true,
setupFiles: [
resolve(dirname, './tests/vitestSetup.ts'),
resolve(dirname, './tests/setup/polyfills.js'),
resolve(dirname, './tests/setup/radix.js'),
],
},
})