Skip to content

Commit

Permalink
ci: add coverage tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
mcous committed May 11, 2023
1 parent 8699d47 commit 94c2e2d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,22 @@ jobs:
- name: Run tests
run: pnpm coverage

- name: Upload coverage
uses: coverallsapp/github-action@f350da2c033043742f89e8c0b7b5145a1616da6d
with:
flag-name: node-${{ matrix.node-version }}-os-${{ matrix.os }}
parallel: true

coverage:
name: Coverage finished
runs-on: ubuntu-latest
needs: test

steps:
- uses: coverallsapp/github-action@f350da2c033043742f89e8c0b7b5145a1616da6d
with:
parallel-finished: true

build:
name: Build
runs-on: ubuntu-latest
Expand Down Expand Up @@ -74,13 +90,12 @@ jobs:
if: ${{ github.repository == 'mcous/vitest-when' && startsWith(github.ref, 'refs/tags/v') }}
name: Deploy
runs-on: ubuntu-latest
needs: [test, build]

permissions:
contents: read
id-token: write

needs: [test, build]

steps:
- name: Checkout source
uses: actions/checkout@v3
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# vitest-when

[![npm badge][]][npm]
[![ci badge][]][ci]
[![coverage badge][]][coverage]

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][].

```shell
Expand All @@ -9,6 +13,12 @@ npm install --save-dev vitest-when
[vitest]: https://vitest.dev/
[testdouble.js]: https://github.com/testdouble/testdouble.js/
[jest-when]: https://github.com/timkindberg/jest-when
[npm]: https://npmjs.org/vitest-when
[npm badge]: https://img.shields.io/npm/v/vitest-when.svg?style=flat-square
[ci]: https://github.com/mcous/vitest-when/actions
[ci badge]: https://img.shields.io/github/actions/workflow/status/mcous/vitest-when/ci.yaml?style=flat-square
[coverage]: https://coveralls.io/github/mcous/vitest-when
[coverage badge]: https://img.shields.io/coverallsCoverage/github/mcous/vitest-when?style=flat-square

## Why?

Expand Down
1 change: 1 addition & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default defineConfig({
coverage: {
provider: 'istanbul',
exclude: ['example'],
reporter: ['text', 'html', 'lcovonly'],
},
},
});

0 comments on commit 94c2e2d

Please sign in to comment.