diff --git a/.github/workflows/validate-api-client.yaml b/.github/workflows/validate-api-client.yaml index 796504a3..4497cd9d 100644 --- a/.github/workflows/validate-api-client.yaml +++ b/.github/workflows/validate-api-client.yaml @@ -66,3 +66,4 @@ jobs: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: flags: api-client + files: /coverage/packages/api-client/coverage-final.json diff --git a/.github/workflows/validate-api.yaml b/.github/workflows/validate-api.yaml index bf7fd7c2..bd251221 100644 --- a/.github/workflows/validate-api.yaml +++ b/.github/workflows/validate-api.yaml @@ -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 diff --git a/.github/workflows/validate-schema.yaml b/.github/workflows/validate-schema.yaml index 2b8d8e30..62cd38b3 100644 --- a/.github/workflows/validate-schema.yaml +++ b/.github/workflows/validate-schema.yaml @@ -64,3 +64,4 @@ jobs: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: flags: schema + files: /coverage/packages/schema/coverage-final.json diff --git a/apps/api/jest.e2e-config.ts b/apps/api/jest.e2e-config.ts index 74bee29e..f576eb72 100644 --- a/apps/api/jest.e2e-config.ts +++ b/apps/api/jest.e2e-config.ts @@ -11,5 +11,7 @@ export default { '^@/(.*)$': '/src/$1' }, moduleFileExtensions: ['ts', 'js', 'html'], - coverageDirectory: '../../coverage/apps/api' + coverageDirectory: '../../coverage/apps/api', + coverageReporters: ['json'], + collectCoverage: true } diff --git a/apps/api/package.json b/apps/api/package.json index b6ab1bfb..4c0002a6 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -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" }, diff --git a/codecov.yml b/codecov.yml index 3d2ddb06..f3f97c65 100644 --- a/codecov.yml +++ b/codecov.yml @@ -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% diff --git a/packages/api-client/jest.config.ts b/packages/api-client/jest.config.ts index 8d90756d..bf8187eb 100644 --- a/packages/api-client/jest.config.ts +++ b/packages/api-client/jest.config.ts @@ -7,14 +7,16 @@ const config: Config = { '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '/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/(.*)$': '/src/$1' - } + }, + coverageDirectory: '../../coverage/packages/api-client', + coverageReporters: ['json'], + collectCoverage: true } export default config diff --git a/packages/schema/jest.config.ts b/packages/schema/jest.config.ts index bd7c0402..91e96af7 100644 --- a/packages/schema/jest.config.ts +++ b/packages/schema/jest.config.ts @@ -7,12 +7,14 @@ const config: Config = { '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '/tsconfig.spec.json' }] }, moduleFileExtensions: ['ts', 'js', 'html'], - coverageDirectory: '../../coverage/packages/schema', preset: 'ts-jest', testEnvironment: 'node', moduleNameMapper: { '^@/(.*)$': '/src/$1' - } + }, + coverageDirectory: '../../coverage/packages/schema', + coverageReporters: ['json'], + collectCoverage: true } export default config