chore: add vitest testing infrastructure
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
6
.env.test.example
Normal file
6
.env.test.example
Normal file
@@ -0,0 +1,6 @@
|
||||
DATABASE_URL=mysql://user:password@127.0.0.1:3306/app_test
|
||||
JWT_SECRET=test-jwt-secret-do-not-use-in-production
|
||||
TOTP_ENCRYPTION_KEY=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef
|
||||
APP_ENV=local
|
||||
PORT=3099
|
||||
HOST=127.0.0.1
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,7 @@
|
||||
node_modules/
|
||||
dist/
|
||||
.env
|
||||
.env.test
|
||||
*.log
|
||||
dist-client/
|
||||
*.css.map
|
||||
|
||||
971
package-lock.json
generated
971
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,9 @@
|
||||
"db:generate": "prisma generate",
|
||||
"db:pull": "prisma db pull",
|
||||
"db:push": "prisma db push",
|
||||
"db:studio": "prisma studio"
|
||||
"db:studio": "prisma studio",
|
||||
"test": "vitest run",
|
||||
"test:watch": "vitest"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
@@ -53,10 +55,13 @@
|
||||
"@types/nodemailer": "^7.0.11",
|
||||
"@types/react": "^19.2.14",
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@types/supertest": "^7.2.0",
|
||||
"@vitejs/plugin-react": "^6.0.1",
|
||||
"concurrently": "^9.2.1",
|
||||
"supertest": "^7.2.2",
|
||||
"tsx": "^4.21.0",
|
||||
"typescript": "^5.9.3",
|
||||
"vite": "^8.0.0"
|
||||
"vite": "^8.0.0",
|
||||
"vitest": "^4.1.0"
|
||||
}
|
||||
}
|
||||
|
||||
2
src/__tests__/setup.ts
Normal file
2
src/__tests__/setup.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
import dotenv from 'dotenv';
|
||||
dotenv.config({ path: '.env.test' });
|
||||
11
vitest.config.ts
Normal file
11
vitest.config.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { defineConfig } from 'vitest/config';
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
globals: true,
|
||||
environment: 'node',
|
||||
setupFiles: ['./src/__tests__/setup.ts'],
|
||||
testTimeout: 15000,
|
||||
hookTimeout: 15000,
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user