Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add unit&storybook coverage to codecov #2023

Merged
merged 3 commits into from
Sep 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
8 changes: 8 additions & 0 deletions .github/workflows/test-storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,11 @@ jobs:

- name: Run test-storybook:ci
run: npm run test-storybook:ci

- uses: codecov/codecov-action@v3
with:
flags: storybook_tests # optional
name: storybook-coverage # optional
file: ./coverage/storybook/coverage-storybook.json
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
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