feat(tests): last setups

This commit is contained in:
Matthieu Haineault 2025-08-13 10:04:16 -04:00
parent 1949731773
commit 8c201edd95
3 changed files with 42 additions and 1 deletions

33
.github/workflows/e2e.yml vendored Normal file
View File

@ -0,0 +1,33 @@
name: e2e
on:
push:
branches: [main]
pull_request:
jobs:
e2e:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: dev # ou test
ports: ["5432:5432"]
options: >-
--health-cmd="pg_isready -U postgres -d dev"
--health-interval=5s
--health-timeout=5s
--health-retries=20
env:
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/dev?schema=public
TZ: UTC
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: '18' }
- run: npm ci
- run: npx prisma migrate deploy
- run: npm run seed:all
- run: npm run test:e2e:ci

View File

@ -18,6 +18,7 @@
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json",
"test:e2e:ci": "cross-env NODE_ENV=test E2E_RESET_DB=1 jest --config ./test/jest-e2e.json --runInBand --verbose",
"prisma:generate": "prisma generate",
"db:migrate": "prisma migrate dev --name init",
"db:reset": "prisma migrate reset --force",

View File

@ -14,5 +14,12 @@
"setupFilesAfterEnv": ["<rootDir>/test/jest-setup.ts"],
"moduleDirectories": ["node_modules", "<rootDir>"],
"testTimeout": 30000,
"maxWorkers": 1
"maxWorkers": 1,
"collectCoverage": true,
"coverageDirectory": "coverage-e2e",
"coverageReporters": ["text", "lcov"],
"coveragePathIgnorePatterns": ["/node_modules/", "/test/utils/", "/test/factories/"],
"coverageThreshold": {
"global": { "branches": 40, "functions": 50, "lines": 60, "statements": 60 }
}
}