chore: set up vitest and add zod

This commit is contained in:
Carlos Narro
2026-05-30 12:15:26 +02:00
parent 75de172900
commit 515e9fd7a2
4 changed files with 1454 additions and 6 deletions

1424
mvp/b2c/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -11,7 +11,10 @@
"db:migrate": "drizzle-kit migrate",
"db:push": "drizzle-kit push",
"db:studio": "drizzle-kit studio",
"db:seed": "tsx src/db/seed.ts"
"db:seed": "tsx src/db/seed.ts",
"test": "vitest run",
"test:watch": "vitest",
"test:coverage": "vitest run --coverage"
},
"dependencies": {
"@tailwindcss/postcss": "^4.3.0",
@@ -21,17 +24,20 @@
"postgres": "^3.4.9",
"react": "19.2.4",
"react-dom": "19.2.4",
"tailwindcss": "^4.3.0"
"tailwindcss": "^4.3.0",
"zod": "^4.4.3"
},
"devDependencies": {
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"@vitest/coverage-v8": "^4.1.7",
"dotenv": "^17.4.2",
"drizzle-kit": "^0.31.10",
"eslint": "^9",
"eslint-config-next": "16.2.6",
"tsx": "^4.22.3",
"typescript": "^5"
"typescript": "^5",
"vitest": "^4.1.7"
}
}

View File

@@ -0,0 +1,7 @@
import { describe, it, expect } from 'vitest';
describe('vitest setup', () => {
it('runs', () => {
expect(1 + 1).toBe(2);
});
});

17
mvp/b2c/vitest.config.ts Normal file
View File

@@ -0,0 +1,17 @@
import { defineConfig } from 'vitest/config';
import { fileURLToPath } from 'node:url';
export default defineConfig({
resolve: {
alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) },
},
test: {
environment: 'node',
include: ['tests/**/*.test.ts'],
coverage: {
provider: 'v8',
include: ['src/budget/**'],
thresholds: { lines: 70, functions: 70, statements: 70, branches: 70 },
},
},
});