Skip to content

Commit 94c2e2d

Browse files
committed
ci: add coverage tracking
1 parent 8699d47 commit 94c2e2d

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

.github/workflows/ci.yaml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,22 @@ jobs:
3939
- name: Run tests
4040
run: pnpm coverage
4141

42+
- name: Upload coverage
43+
uses: coverallsapp/github-action@f350da2c033043742f89e8c0b7b5145a1616da6d
44+
with:
45+
flag-name: node-${{ matrix.node-version }}-os-${{ matrix.os }}
46+
parallel: true
47+
48+
coverage:
49+
name: Coverage finished
50+
runs-on: ubuntu-latest
51+
needs: test
52+
53+
steps:
54+
- uses: coverallsapp/github-action@f350da2c033043742f89e8c0b7b5145a1616da6d
55+
with:
56+
parallel-finished: true
57+
4258
build:
4359
name: Build
4460
runs-on: ubuntu-latest
@@ -74,13 +90,12 @@ jobs:
7490
if: ${{ github.repository == 'mcous/vitest-when' && startsWith(github.ref, 'refs/tags/v') }}
7591
name: Deploy
7692
runs-on: ubuntu-latest
93+
needs: [test, build]
7794

7895
permissions:
7996
contents: read
8097
id-token: write
8198

82-
needs: [test, build]
83-
8499
steps:
85100
- name: Checkout source
86101
uses: actions/checkout@v3

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# vitest-when
22

3+
[![npm badge][]][npm]
4+
[![ci badge][]][ci]
5+
[![coverage badge][]][coverage]
6+
37
Stub behaviors of [vitest][] mocks based on how they are called with a small, readable, and opinionated API. Inspired by [testdouble.js][] and [jest-when][].
48

59
```shell
@@ -9,6 +13,12 @@ npm install --save-dev vitest-when
913
[vitest]: https://vitest.dev/
1014
[testdouble.js]: https://github.com/testdouble/testdouble.js/
1115
[jest-when]: https://github.com/timkindberg/jest-when
16+
[npm]: https://npmjs.org/vitest-when
17+
[npm badge]: https://img.shields.io/npm/v/vitest-when.svg?style=flat-square
18+
[ci]: https://github.com/mcous/vitest-when/actions
19+
[ci badge]: https://img.shields.io/github/actions/workflow/status/mcous/vitest-when/ci.yaml?style=flat-square
20+
[coverage]: https://coveralls.io/github/mcous/vitest-when
21+
[coverage badge]: https://img.shields.io/coverallsCoverage/github/mcous/vitest-when?style=flat-square
1222

1323
## Why?
1424

vitest.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export default defineConfig({
55
coverage: {
66
provider: 'istanbul',
77
exclude: ['example'],
8+
reporter: ['text', 'html', 'lcovonly'],
89
},
910
},
1011
});

0 commit comments

Comments
 (0)