Skip to content

Commit

Permalink
chore: Update test coverage settings
Browse files Browse the repository at this point in the history
  • Loading branch information
rajdip-b committed Nov 6, 2024
1 parent 59e4280 commit 5b27e32
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/validate-api-client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ jobs:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
flags: api-client
files: /coverage/packages/api-client/coverage-final.json
2 changes: 1 addition & 1 deletion .github/workflows/validate-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ jobs:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
flags: api-e2e-tests
files: /coverage-e2e/api/coverage-final.json
files: /coverage/apps/api/coverage-final.json
1 change: 1 addition & 0 deletions .github/workflows/validate-schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,4 @@ jobs:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
flags: schema
files: /coverage/packages/schema/coverage-final.json
4 changes: 3 additions & 1 deletion apps/api/jest.e2e-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@ export default {
'^@/(.*)$': '<rootDir>/src/$1'
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/apps/api'
coverageDirectory: '../../coverage/apps/api',
coverageReporters: ['json'],
collectCoverage: true
}
2 changes: 1 addition & 1 deletion apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"db:reset": "pnpm dlx dotenv-cli -e ../../.env -- pnpm dlx prisma migrate reset --force --schema=src/prisma/schema.prisma",
"sourcemaps": "sentry-cli sourcemaps inject ./dist && sentry-cli sourcemaps upload ./dist || echo 'Failed to upload source maps to Sentry'",
"e2e:prepare": "cd ../../ && docker compose down && docker compose -f docker-compose-test.yml up -d && sleep 3 && cd apps/api && pnpm db:generate-types && cross-env NODE_ENV='e2e' DATABASE_URL='postgresql://prisma:prisma@localhost:5432/tests' pnpm run db:deploy-migrations",
"e2e": "pnpm run e2e:prepare && cross-env NODE_ENV='e2e' DATABASE_URL='postgresql://prisma:prisma@localhost:5432/tests' jest --runInBand --config=jest.e2e-config.ts --coverage --coverageDirectory=../../coverage-e2e/api --coverageReporters=json && pnpm run e2e:teardown",
"e2e": "pnpm run e2e:prepare && cross-env NODE_ENV='e2e' DATABASE_URL='postgresql://prisma:prisma@localhost:5432/tests' jest --runInBand --config=jest.e2e-config.ts && pnpm run e2e:teardown",
"e2e:teardown": "cd ../../ && docker compose -f docker-compose-test.yml down",
"unit": "pnpm db:generate-types && jest --config=jest.config.ts"
},
Expand Down
18 changes: 18 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,21 @@ flag_management:
target: 85%
- type: patch
target: 98%
- name: api-client
paths:
- packages/api-client/
carryforward: true
statuses:
- type: project
target: 80%
- type: patch
target: 98%
- name: schema
paths:
- packages/schema/
carryforward: true
statuses:
- type: project
target: 80%
- type: patch
target: 98%
6 changes: 4 additions & 2 deletions packages/api-client/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ const config: Config = {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }]
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/packages/api-client',
globalSetup: './tests/config/setup.ts',
globalTeardown: './tests/config/teardown.ts',
preset: 'ts-jest',
testEnvironment: 'node',
moduleNameMapper: {
'^@api-client/(.*)$': '<rootDir>/src/$1'
}
},
coverageDirectory: '../../coverage/packages/api-client',
coverageReporters: ['json'],
collectCoverage: true
}

export default config
6 changes: 4 additions & 2 deletions packages/schema/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ const config: Config = {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }]
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/packages/schema',
preset: 'ts-jest',
testEnvironment: 'node',
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1'
}
},
coverageDirectory: '../../coverage/packages/schema',
coverageReporters: ['json'],
collectCoverage: true
}

export default config

0 comments on commit 5b27e32

Please sign in to comment.