This has to be used in project with React + Vite
- Installation
pnpm install vitest happy-dom @testing-library/react @testing-library/user-event --save-dev
- Go to file vite.config.ts and add this code
/// <reference types="vite/client" />
export default defineConfig({
plugins: [react()],
test: {
environment: 'happy-dom'
}
})
- Go to file package.json and add this code
"scripts": {
"test": "vitest"
},