Migrate tests from Jest to Vitest, updating setup and test files accordingly.

- Replace Jest imports and mocks with Vitest equivalents in setup and unit tests.
- Adjust test cases to use async imports and reset modules with Vitest.
- Add Vitest configuration file for test environment setup and coverage reporting.
This commit is contained in:
Max Kowalski
2025-06-27 19:14:05 +02:00
parent 5c1ced5900
commit 49a75f5ede
7 changed files with 1094 additions and 2230 deletions

View File

@ -18,9 +18,9 @@
"prisma:push:force": "prisma db push --force-reset",
"prisma:studio": "prisma studio",
"start": "node server.mjs",
"test": "jest",
"test:watch": "jest --watch",
"test:coverage": "jest --coverage",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage",
"lint:md": "markdownlint-cli2 \"**/*.md\" \"!.trunk/**\" \"!.venv/**\" \"!node_modules/**\"",
"lint:md:fix": "markdownlint-cli2 --fix \"**/*.md\" \"!.trunk/**\" \"!.venv/**\" \"!node_modules/**\""
},
@ -57,31 +57,33 @@
"devDependencies": {
"@eslint/eslintrc": "^3.3.1",
"@eslint/js": "^9.27.0",
"@jest/globals": "^30.0.3",
"@playwright/test": "^1.52.0",
"@tailwindcss/postcss": "^4.1.7",
"@testing-library/dom": "^10.4.0",
"@testing-library/react": "^16.3.0",
"@types/bcryptjs": "^2.4.2",
"@types/jest": "^30.0.0",
"@types/node": "^22.15.21",
"@types/node-cron": "^3.0.8",
"@types/react": "^19.1.5",
"@types/react-dom": "^19.1.5",
"@typescript-eslint/eslint-plugin": "^8.32.1",
"@typescript-eslint/parser": "^8.32.1",
"@vitejs/plugin-react": "^4.6.0",
"eslint": "^9.27.0",
"eslint-config-next": "^15.3.2",
"eslint-plugin-prettier": "^5.4.0",
"jest": "^30.0.3",
"jsdom": "^26.1.0",
"markdownlint-cli2": "^0.18.1",
"postcss": "^8.5.3",
"prettier": "^3.5.3",
"prettier-plugin-jinja-template": "^2.1.0",
"prisma": "^6.10.1",
"tailwindcss": "^4.1.7",
"ts-jest": "^29.4.0",
"ts-node": "^10.9.2",
"tsx": "^4.20.3",
"typescript": "^5.0.0"
"typescript": "^5.0.0",
"vite-tsconfig-paths": "^5.1.4",
"vitest": "^3.2.4"
},
"prettier": {
"bracketSpacing": true,