diff --git a/vite.config.ts b/vite.config.ts index 540a8eb..6f21d57 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -5,6 +5,8 @@ import react from '@vitejs/plugin-react-swc' export default defineConfig({ plugins: [react()], test: { - environment: 'jsdom' + globals: true, + environment: 'jsdom', + setupFiles: ['./vitest.setup.ts'] } }) diff --git a/vitest.setup.ts b/vitest.setup.ts new file mode 100644 index 0000000..8f2609b --- /dev/null +++ b/vitest.setup.ts @@ -0,0 +1,5 @@ +// jest-dom adds custom jest matchers for asserting on DOM nodes. +// allows you to do things like: +// expect(element).toHaveTextContent(/react/i) +// learn more: https://github.com/testing-library/jest-dom +import '@testing-library/jest-dom';