Skip to content

Refactor main.js to include validateRequest middleware #27

Refactor main.js to include validateRequest middleware

Refactor main.js to include validateRequest middleware #27

Workflow file for this run

name: Coverage
on:
push:
branches:
- main
- developer
pull_request:
branches:
- main
- developer
jobs:
coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '20.17.0'
- name: Install dependencies
run: npm install
- name: Generate test coverage
run: npm run coverage | tee coverage_output.txt
- name: Show coverage output
run: cat coverage_output.txt
- name: Check coverage threshold
run: |
COVERAGE=$(grep -oP 'All files\s+\|\s+\K[0-9]+(?=\s+\|)' coverage_output.txt)
echo "Coverage is at $COVERAGE%"
if [ -z "$COVERAGE" ]; then
echo "No coverage value found, failing the job."
exit 1
fi
if [ "$COVERAGE" -lt 80 ]; then
echo "Coverage is below 80%, failing the job."
exit 1
fi