-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tests): enhance test coverage reporting with Jest JUnit integrat…
…ion (#160)
- Loading branch information
Showing
8 changed files
with
82 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: CI - ESLint, Prettier, Jest, and Codecov | ||
on: | ||
push: | ||
branches: [develop, main] | ||
pull_request: | ||
branches: [develop, main] | ||
jobs: | ||
test: | ||
name: Run tests and collect coverage | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Bun | ||
uses: oven-sh/setup-bun@v2 | ||
|
||
- name: Install dependencies | ||
run: bun install --frozen-lockfile | ||
|
||
- name: Run ESLint | ||
run: bunx eslint . --ext .js,.jsx,.ts,.tsx | ||
|
||
- name: Run Prettier | ||
run: bunx prettier . --check | ||
|
||
- name: Run tests | ||
run: bunx jest --coverage --reporters=jest-junit | ||
|
||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v5 | ||
with: | ||
directory: ${{ github.action_path }} | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
slug: getsentry/self-hosted | ||
|
||
- name: Upload test results to Codecov | ||
if: ${{ !cancelled() }} | ||
uses: codecov/test-results-action@v1 | ||
with: | ||
directory: ${{ github.action_path }} | ||
token: ${{ secrets.CODECOV_TOKEN }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
coverage: | ||
status: | ||
project: #add everything under here, more options at https://docs.codecov.com/docs/commit-status | ||
default: | ||
# basic | ||
target: auto #default | ||
threshold: 0% | ||
base: auto | ||
comment: | ||
enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<testsuites name="jest tests" tests="4" failures="0" errors="0" time="0.373"> | ||
<testsuite name="getGroupedTimetable" errors="0" failures="0" skipped="0" timestamp="2025-01-16T19:33:31" time="0.281" tests="4"> | ||
<testcase classname="getGroupedTimetable should correctly group and sort timetable entries and exams by date" name="getGroupedTimetable should correctly group and sort timetable entries and exams by date" time="0.004"> | ||
</testcase> | ||
<testcase classname="generateKey should generate a unique key for a lecture" name="generateKey should generate a unique key for a lecture" time="0.001"> | ||
</testcase> | ||
<testcase classname="isValidRoom should return true for valid room strings" name="isValidRoom should return true for valid room strings" time="0"> | ||
</testcase> | ||
<testcase classname="isValidRoom should return false for invalid room strings" name="isValidRoom should return false for invalid room strings" time="0.001"> | ||
</testcase> | ||
</testsuite> | ||
</testsuites> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -156,6 +156,7 @@ | |
"husky": "^9.1.7", | ||
"jest": "~29.7.0", | ||
"jest-expo": "~52.0.3", | ||
"jest-junit": "^16.0.0", | ||
"lint-staged": "^15.4.0", | ||
"prettier": "3.4.2", | ||
"prop-types": "^15.8.1", | ||
|
@@ -175,19 +176,18 @@ | |
"[email protected]": "patches/[email protected]" | ||
}, | ||
"jest": { | ||
"preset": "jest-expo", | ||
"transformIgnorePatterns": [ | ||
"node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@sentry/react-native|native-base|react-native-svg)" | ||
], | ||
"collectCoverage": true, | ||
"collectCoverageFrom": [ | ||
"**/*.{ts,tsx,js,jsx}", | ||
"!**/coverage/**", | ||
"!**/node_modules/**", | ||
"!**/babel.config.js", | ||
"!**/expo-env.d.ts", | ||
"!**/.expo/**" | ||
] | ||
} | ||
|
||
"preset": "jest-expo", | ||
"transformIgnorePatterns": [ | ||
"node_modules/(?!((jest-)?react-native|@react-native(-community)?)|expo(nent)?|@expo(nent)?/.*|@expo-google-fonts/.*|react-navigation|@react-navigation/.*|@sentry/react-native|native-base|react-native-svg)" | ||
], | ||
"collectCoverage": true, | ||
"collectCoverageFrom": [ | ||
"**/*.{ts,tsx,js,jsx}", | ||
"!**/coverage/**", | ||
"!**/node_modules/**", | ||
"!**/babel.config.js", | ||
"!**/expo-env.d.ts", | ||
"!**/.expo/**" | ||
] | ||
} | ||
} |