Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,37 @@ jobs:
fail-fast: true
matrix:
node-version: [20, 22]
services:
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: ajosave
POSTGRES_PASSWORD: ajosave
POSTGRES_DB: ajosave_test
ports: ["5432:5432"]
options: >-
--health-cmd pg_isready
--health-interval 5s
--health-timeout 5s
--health-retries 5
redis:
image: redis:7-alpine
ports: ["6379:6379"]
options: >-
--health-cmd "redis-cli ping"
--health-interval 5s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: postgresql://ajosave:ajosave@localhost:5432/ajosave_test
REDIS_URL: redis://localhost:6379
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with: { node-version: "${{ matrix.node-version }}", cache: npm }
- run: npm ci
- name: Run migrations before tests
run: npm run migrate
- name: Run tests with coverage
run: npm run test:coverage -- --ci
- name: Upload coverage to Codecov
Expand Down
18 changes: 18 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,24 @@ const config = {
statements: 70,
},
},
// Integration tests require the Node environment (no DOM needed for supertest)
testEnvironmentOptions: {},
projects: [
{
displayName: "unit",
testEnvironment: "jest-environment-jsdom",
testPathPattern: "src/(?!__tests__/integration)",
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
moduleNameMapper: { "^@/(.*)$": "<rootDir>/src/$1" },
},
{
displayName: "integration",
testEnvironment: "node",
testPathPattern: "src/__tests__/integration/.*\\.test\\.ts$",
setupFilesAfterEnv: ["<rootDir>/jest.setup.ts"],
moduleNameMapper: { "^@/(.*)$": "<rootDir>/src/$1" },
},
],
};

module.exports = createJestConfig(config);
Loading