Skip to content

chore: added jest coverage setup #16

chore: added jest coverage setup

chore: added jest coverage setup #16

Workflow file for this run

name: Jest Coverage Check
on:
pull_request:
branches:
- develop
- main
- release/v*
jobs:
jest_coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install dependencies
run: cd frontend && yarn install
# - name: Run Jest with Coverage
# run: |
# cd frontend && npm test --silent --coverageReporters text --coverageReporters json-summary --changedSince=origin/develop --passWithNoTests --maxWorkers=5 --ci --testResultsProcessor="jest-junit"
# yarn custom-coverage --verbose
- name: Get Changed Files
id: get_changed_files
run: echo "::set-output name=files::$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '\.jsx\?$' || true)"
- name: Run Jest with Coverage for Changed Files
run: npm test -- --coverage --findRelatedTests ${{ steps.get_changed_files.outputs.files }}
- name: Upload Coverage Results
uses: actions/upload-artifact@v2
with:
name: coverage
path: ./frontend/coverage
- name: Display Coverage Summary
run: |
echo "Coverage Summary:"
cat coverage/lcov-report/index.html | grep -oP '(?<=<span class="strong">).*(?=%</span>)' | tail -n 1