Skip to content

Commit 06ca53d

Browse files
test: compare coverage (#1077)
* test: compare coverage * test: update test coverage * test: skip coverage for main and release-please * ci: fix match * ci: fix match * test: bump npxie * test: update test coverage * test: bump npxie * test: update test coverage * test: bump npxie * test: update test coverage * test: bump npxie * test: update test coverage * test: bump npxie * test: update test coverage --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent a246fda commit 06ca53d

3 files changed

Lines changed: 89 additions & 2 deletions

File tree

.github/workflows/tests.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,23 @@ jobs:
5757
run: echo "JEST_EXTERNAL_BATCH_ID=$(swarm-cli stamp buy --depth 20 --amount 1b --quiet)" >> $GITHUB_ENV
5858

5959
- name: Tests
60+
id: tests
6061
env:
6162
JEST_BEE_URL: http://localhost:1633
6263
JEST_BEE_SIGNER: '566058308ad5fa3888173c741a1fb902c9f1f19559b11fc2738dfc53637ce4e9'
6364
JEST_WITHDRAW_ADDRESS: '0x0000000000000000000000000000000000000000'
64-
run: npm test
65+
run: |
66+
set +e
67+
npm test
68+
echo "exit_code=$?" >> $GITHUB_OUTPUT
69+
set -e
70+
71+
- name: Compare coverage
72+
if: github.ref != 'refs/heads/master'
73+
run:
74+
npx npxie@2.6.1-rc.5 coverage-comparison "${{ github.repository }}" "master" "${{ github.head_ref }}"
75+
"test/coverage/coverage-summary.json" "${{ github.event.pull_request.number }}" "${{ secrets.GITHUB_TOKEN }}"
76+
77+
- name: Fail if tests failed
78+
if: steps.tests.outputs.exit_code != '0'
79+
run: exit 1

jest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default async (): Promise<Config.InitialOptions> => {
3030
return {
3131
collectCoverage: true,
3232
coverageDirectory: 'coverage',
33-
coverageReporters: ['lcov'],
33+
coverageReporters: ['lcov', 'json-summary'],
3434
collectCoverageFrom: ['src/**/*.ts'],
3535
moduleDirectories: ['node_modules'],
3636
projects: [

0 commit comments

Comments
 (0)