Skip to content

Commit

Permalink
Add coverage report workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Guy Carmeli committed Apr 5, 2024
1 parent 7e4f26e commit 07b1661
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/collect-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: ci
on: [push]
jobs:
update-code-coverage-badge:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "18"
- name: Install
run: |
yarn
- name: Test and collect coverage
run: yarn test-coverage
- name: Create badge and publish to gh-pages
uses: nolleh/jest-badge-deploy-action@latest
10 changes: 9 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/** @type {import('jest').Config} */
const config = {
resetMocks: true,
resetModules: true,
Expand All @@ -12,7 +13,14 @@ const config = {
'./jest.setup-after-env.js',
'jest-extended/all'
],
testEnvironment: 'jsdom'
testEnvironment: 'jsdom',
coveragePathIgnorePatterns: ['/node_modules/', '/tests/'],
coverageReporters: ["json-summary", "text"],
collectCoverageFrom: [
'src/**/*.{ts,tsx}',
'!dist/**',
],
collectCoverage: true,
};

module.exports = config;
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"lint": "npx eslint src transformers test --ignore-pattern '*.d.ts' --ext .ts,.tsx,.js",
"build-local": "tsc --project tsconfig.json",
"pretest": "tsc --project tsconfig.json",
"test": "npx jest"
"test": "npx jest",
"test-coverage": "npx jest --coverage"
},
"main": "dist/src/index.js",
"directories": {
Expand Down

0 comments on commit 07b1661

Please sign in to comment.