Skip to content

Commit

Permalink
chore: track test coverage (#6)
Browse files Browse the repository at this point in the history
* chore: track test coverage

* chore: add json summary reporter

* Update unit-test.yml
  • Loading branch information
Sachin-chaurasiya authored Aug 12, 2023
1 parent 6dfdf03 commit 78ef6d3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Unit Tests
name: Unit Tests + Coverage

on:
pull_request:
Expand All @@ -7,6 +7,9 @@ on:
push:
branches:
- main
permissions:
contents: read
pull-requests: write # Required for Providing Jest Coverage Comment

jobs:
test:
Expand All @@ -26,3 +29,11 @@ jobs:

- name: Run Jest tests
run: yarn run test

- name: Jest coverage comment
uses: MishaKav/[email protected]
with:
coverage-summary-path: coverage/coverage-summary.json
title: Jest Test Coverage
summary-title: Tests summary
badge-title: Coverage
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
*.keys
*.keys
coverage/
2 changes: 2 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
testRegex: '__tests__/.*\\.test\\.ts$',
collectCoverage: true,
coverageReporters: ['text-summary', 'json-summary'],
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"build": "npx tsc",
"prepare": "yarn run build",
"test": "jest --passWithNoTests --maxWorkers=3 --silent"
"test": "jest --passWithNoTests --maxWorkers=3 --silent --coverage"
},
"repository": {
"type": "git",
Expand Down

0 comments on commit 78ef6d3

Please sign in to comment.