chore(04-01): install and configure Vitest test infrastructure for apps/web

- Add vitest, @testing-library/react, @testing-library/jest-dom, jsdom, @vitejs/plugin-react as dev deps
- Create vitest.config.ts with jsdom environment and @ path alias
- Create test setup file importing jest-dom/vitest matchers
- Add test scripts to apps/web and root package.json
- Add test task to turbo.json pipeline
This commit is contained in:
2026-06-22 14:45:54 +02:00
parent fb6e90d78e
commit e50b3c76c5
6 changed files with 1052 additions and 6 deletions
+8 -1
View File
@@ -6,6 +6,7 @@
"dev": "next dev --turbopack", "dev": "next dev --turbopack",
"build": "next build", "build": "next build",
"start": "next start", "start": "next start",
"test": "vitest run",
"type-check": "tsc --noEmit" "type-check": "tsc --noEmit"
}, },
"dependencies": { "dependencies": {
@@ -20,10 +21,16 @@
}, },
"devDependencies": { "devDependencies": {
"@tailwindcss/postcss": "^4.0.0", "@tailwindcss/postcss": "^4.0.0",
"@testing-library/jest-dom": "^6.9.1",
"@testing-library/react": "^16.3.2",
"@testing-library/user-event": "^14.6.1",
"@types/react": "^19.0.0", "@types/react": "^19.0.0",
"@types/react-dom": "^19.0.0", "@types/react-dom": "^19.0.0",
"@vitejs/plugin-react": "^6.0.2",
"jsdom": "^29.1.1",
"postcss": "^8.0.0", "postcss": "^8.0.0",
"tailwindcss": "^4.0.0", "tailwindcss": "^4.0.0",
"typescript": "^5.5.0" "typescript": "^5.5.0",
"vitest": "^4.1.9"
} }
} }
+1
View File
@@ -0,0 +1 @@
import '@testing-library/jest-dom/vitest';
+17
View File
@@ -0,0 +1,17 @@
import react from '@vitejs/plugin-react';
import { resolve } from 'node:path';
import { defineConfig } from 'vitest/config';
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
'@': resolve(__dirname, './src'),
},
},
test: {
environment: 'jsdom',
globals: true,
setupFiles: ['./src/test/setup.ts'],
},
});
+1
View File
@@ -6,6 +6,7 @@
"dev": "turbo dev", "dev": "turbo dev",
"build": "turbo build", "build": "turbo build",
"lint": "turbo lint", "lint": "turbo lint",
"test": "turbo test",
"type-check": "turbo type-check" "type-check": "turbo type-check"
}, },
"devDependencies": { "devDependencies": {
+1022 -5
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -13,6 +13,9 @@
"lint": { "lint": {
"outputs": [] "outputs": []
}, },
"test": {
"outputs": []
},
"type-check": { "type-check": {
"dependsOn": ["^build"], "dependsOn": ["^build"],
"outputs": [] "outputs": []