Skip to content

Commit

Permalink
Test scan (#50)
Browse files Browse the repository at this point in the history
* test

* try use node version 18

* trigger test

* Remove package-lock.json

* trigger test

* Update the browsers property to use ChromeHeadless instead of Chrome

* trigger p

* update unit test

* run unit test

* missing fi

* test scan

* change the path of converage-summary

* teigger

* print out the coverage-summary.json

* trigger

* update grep script

* trigger

* modify check code coverage part

* modify check code coverage part
  • Loading branch information
yzlucas authored Sep 18, 2024
1 parent 3638c6a commit f610b92
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run Tests
name: Run Tests

env:
NPMRC: ${{ secrets.NPMRC }}
Expand Down Expand Up @@ -52,12 +52,16 @@ jobs:
working-directory: client/wfprev-war/src/main/angular

# Ensure coverage meets the required threshold
- name: Check code coverage
run: |
if grep -q '"statements":.*"pct": \([8-9][0-9]\|100\)' coverage/wfprev/coverage-summary.json; then
echo "Test passed";
else
echo "Code coverage is less than 80%! Exiting...";
exit 1;
fi
working-directory: client/wfprev-war/src/main/angular
- name: Check code coverage
run: |
# Extract the "pct" value for "statements" using jq
statements_pct=$(jq '.total.statements.pct' coverage/wfprev/coverage-summary.json)
# Check if the percentage is greater than or equal to 80
if (( $(echo "$statements_pct >= 80" | bc -l) )); then
echo "Test passed. Code coverage for statements is $statements_pct%";
else
echo "Code coverage for statements is less than 80%! Exiting... ($statements_pct%)";
exit 1;
fi
working-directory: client/wfprev-war/src/main/angular

0 comments on commit f610b92

Please sign in to comment.