diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a4f150f1..4c472f651 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,6 @@ jobs: test-unit: name: 'test:unit' - needs: build uses: ./.github/workflows/test-unit.yml publishPreview: diff --git a/.github/workflows/test-storybook.yml b/.github/workflows/test-storybook.yml index 664b6a2d1..940d0078a 100644 --- a/.github/workflows/test-storybook.yml +++ b/.github/workflows/test-storybook.yml @@ -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) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index 73b81cfd1..f0331bb5a 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -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) diff --git a/package.json b/package.json index 8834d9726..76c54ca6b 100644 --- a/package.json +++ b/package.json @@ -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",