Skip to content

Commit

Permalink
add vitest coverage (#175)
Browse files Browse the repository at this point in the history
  • Loading branch information
charkour authored Jun 1, 2024
1 parent 4e0ab80 commit 0ecd37a
Show file tree
Hide file tree
Showing 9 changed files with 2,645 additions and 2,127 deletions.
20 changes: 3 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
node-version: [16.x, 20.x]
zustand: [latest, 4.2.0, 4.0.0, 5.0.0-alpha.6]
zustand: [latest, 4.2.0, 4.0.0, next]

steps:
- uses: actions/checkout@v4
Expand All @@ -20,27 +20,13 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- uses: pnpm/action-setup@v3
- uses: pnpm/action-setup@v4
name: Install pnpm
id: pnpm-install
with:
version: latest
version: 8
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-${{ matrix.node-version }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-pnpm-store-
- name: Install Dependencies
run: pnpm install

Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: 'Test'
on:
pull_request:

jobs:
test:
runs-on: ubuntu-latest

permissions:
# Required to checkout the code
contents: read
# Required to put a comment into the pull-request
pull-requests: write

steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 8
run_install: false
- name: Install Node
uses: actions/setup-node@v4
- name: Install Deps
run: pnpm install
- name: Test
run: pnpm test
- name: Report Coverage
# Set if: always() to also generate the report if tests are failing
# Only works if you set `reportOnFailure: true` in your vite config as specified above
if: always()
uses: davelosert/vitest-coverage-report-action@v2
with:
working-directory: ./tests
14 changes: 7 additions & 7 deletions examples/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@
"lodash.merge": "4.6.2",
"lodash.throttle": "4.1.1",
"microdiff": "1.4.0",
"next": "14.1.4",
"react": "18.2.0",
"react-dom": "18.2.0",
"next": "14.2.3",
"react": "18.3.1",
"react-dom": "18.3.1",
"zundo": "workspace:*",
"zustand": "4.5.2"
},
"devDependencies": {
"@types/lodash.merge": "4.6.9",
"@types/lodash.throttle": "4.1.9",
"@types/node": "20.12.5",
"@types/react": "18.2.74",
"eslint": "9.0.0",
"typescript": "5.4.4"
"@types/node": "20.13.0",
"@types/react": "18.3.3",
"eslint": "9.4.0",
"typescript": "5.4.5"
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"devDependencies": {
"prettier": "3.2.5",
"tsup": "8.0.2",
"typescript": "5.4.4",
"typescript": "5.4.5",
"zustand": "4.5.2"
},
"peerDependencies": {
Expand Down
Loading

0 comments on commit 0ecd37a

Please sign in to comment.