Skip to content

Commit

Permalink
enable coverage report for unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
codyzu committed Feb 7, 2024
1 parent 82e01ea commit 12d29fd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,21 @@ jobs:
key: emulators-${{ runner.os }}

- name: Integration tests
run: pnpm run test
run: pnpm run coverage
# env:
# VITEST_MAX_THREADS: 1
# VITEST_MIN_THREADS: 1

- uses: codecov/codecov-action@v4
with:
# fail_ci_if_error: true # optional (default = false)
files: ./coverage/lcov.info # optional
# flags: unittests # optional
# name: codecov-umbrella # optional
token: ${{ secrets.CODECOV_TOKEN }} # required
verbose: true # optional (default = false)


deploy:
if: github.ref_name == 'main' || github.ref_name == 'production'
environment: ${{ github.ref_name == 'main' && 'staging' || github.ref_name == 'production' && 'production' }}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"coverage": "pnpm run emulators:exec 'pnpm run test:start --run --coverage'",
"emulators": "firebase emulators:start --project demo-test --only auth,firestore,storage",
"emulators:exec": "firebase emulators:exec --project demo-test --only auth,firestore,storage",
"coverage:report": "nyc report --temp-dir ./coverage/tmp --reporter=text --reporter=html --reporter=lcov --exclude-after-remap false",
"coverage:report": "nyc report --temp-dir ./coverage/tmp --reporter=text --reporter=lcov --reporter=text-summary --exclude-after-remap false",
"test:e2e": "pnpm run emulators:exec --import test-data 'pnpm run test:e2e:start'",
"test:e2e:coverage": "rm -Rf ./coverage && COVERAGE=1 pnpm run emulators:exec --import test-data 'pnpm run test:e2e:start' && pnpm run coverage:report",
"test:e2e:ui": "pnpm run emulators:exec --import test-data 'pnpm run test:e2e:start --ui'",
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default defineConfig(({command, mode}) => {
'**/*.Test.tsx',
'src/test/**',
],
reporter: ['text', 'html', 'clover', 'json', 'text-summary'],
reporter: ['text', 'text-summary', 'lcov'],
},
// You might want to disable it, if you don't have tests that rely on CSS
// since parsing CSS is slow
Expand Down

0 comments on commit 12d29fd

Please sign in to comment.