Skip to content

Commit

Permalink
test: add unit test coverage to codecov
Browse files Browse the repository at this point in the history
  • Loading branch information
SgtPooki committed Sep 12, 2022
1 parent 08ab462 commit 9b521ee
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:

test-unit:
name: 'test:unit'
needs: build
uses: ./.github/workflows/test-unit.yml

publishPreview:
Expand Down
15 changes: 13 additions & 2 deletions .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,16 @@ jobs:
- name: Install dependencies
run: npm ci --prefer-offline --no-audit --progress=false --cache ${{ github.workspace }}/.cache/npm

- name: Run unit tests
run: npm run test:unit
- name: Run unit tests with coverage
run: npm run test:unit:coverage

- name: Generate nyc coverage report
id: coverage
run: npx nyc report --reporter=lcov

- uses: codecov/codecov-action@v3
with:
flags: unit_tests # optional
name: unit-coverage # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"build:icons": "svgr -d src/icons node_modules/ipfs-css/icons && standard --fix src/icons/*",
"test": "run-s -cl test:unit test:build test:e2e",
"test:unit": "react-app-rewired test --env=jsdom --runInBand --watchAll=false",
"test:unit:coverage": "react-app-rewired test --env=jsdom --runInBand --watchAll=false --coverageDirectory='./.nyc_output' --coverage",
"test:unit:watch": "react-app-rewired test --env=jsdom",
"test:e2e": "cross-env REACT_APP_ENV=test npx playwright test -c ./test/e2e",
"test:build": "cross-env REACT_APP_ENV=test run-s build",
Expand Down

0 comments on commit 9b521ee

Please sign in to comment.