-
Notifications
You must be signed in to change notification settings - Fork 12
Add coverage reports for UNIT tests #174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
CodeAnt AI is reviewing your PR. |
WalkthroughAdds CI artifacts and coverage collection across platforms: GitHub Actions now publishes RN, iOS, and Android coverage; Android Gradle integrates Kotlin Kover and a debug buildType; package.json enables Jest coverage collection and reporters. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||
|
PR Summary: Add CI coverage collection and upload for unit tests across JS, iOS and Android; enable Jest coverage locally and configure Android Kover plugin.
|
|
CodeAnt AI finished reviewing your PR. |
.github/workflows/ci.yml
Outdated
| working-directory: ./sample/android | ||
| run: ./gradlew :react-native-usercentrics:test | ||
| run: ./gradlew :react-native-usercentrics:koverXmlReport |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[CRITICAL_BUG] You replaced the existing Gradle test invocation (./gradlew :react-native-usercentrics:test) with :react-native-usercentrics:koverXmlReport. If the Kover plugin is not applied to the same Gradle project that contains the :react-native-usercentrics module, this task will not exist and the job will fail. Ensure the kover plugin is applied to the module that contains the unit tests (or the sample/android composite project) or run the tests first (test) and then run the kover reporting task. Example: run ./gradlew :react-native-usercentrics:test :react-native-usercentrics:koverXmlReport or apply kover to the correct build.gradle in sample/android/react-native-usercentrics.
| - name: Upload Android coverage | ||
| if: always() | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: android-coverage | ||
| path: android/build/reports/kover/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[CRITICAL_BUG] The upload path for Android coverage is 'android/build/reports/kover/' which is likely incorrect given the workflow's working-directory is ./sample/android. The kover reports will usually be produced under sample/android//build/reports/kover or sample/android/build/reports/kover depending on module layout. Make the path explicit or use a glob to capture the generated report(s), e.g. path: 'sample/android//build/reports/kover/' or the exact module path 'sample/android/react-native-usercentrics/build/reports/kover/'. Otherwise the artifact will be empty and CI will appear to succeed but produce no coverage.
|
Reviewed up to commit:cbb15cb6e46096ca01c36e3711e8b7739694c48c Additional Suggestion.github/workflows/ci.yml, line:109-110You added -enableCodeCoverage YES and -resultBundlePath TestResults.xcresult to the xcodebuild invocation. That's appropriate to generate an .xcresult bundle, but uploading the full .xcresult can be large and not directly consumable by many coverage tools. Consider extracting coverage in a CI-friendly format (e.g. using xcrun xccov or xcresulttool to export cobertura/lcov) and upload that file instead, or compress the .xcresult before uploading to reduce artifact size. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.github/workflows/ci.yml(3 hunks)android/build.gradle.kts(2 hunks)package.json(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: test-ios
- GitHub Check: test-android
🔇 Additional comments (5)
android/build.gradle.kts (2)
14-14: Kover plugin integration looks good.The Kover plugin is appropriately placed and versioned. Ensure Kover 0.9.1 remains compatible with your minimum SDK version (24) and Kotlin version.
41-44: Clarify the purpose of the empty debug buildType block.Adding an explicit empty configuration for a buildType that already exists with defaults provides no functional change. Verify whether this is required for Kover to function or if it can be removed.
.github/workflows/ci.yml (3)
35-40: RN coverage artifact upload looks good.The path
coverage/aligns with Jest configuration, and thealways()condition ensures diagnostics are captured even if tests fail.
109-119: iOS coverage collection configured correctly.The
-enableCodeCoverage YESflag and-resultBundlePathare standard Xcode coverage practices, and the upload path is consistent with the result bundle path.
153-160: Kover v0.9.1 automatically depends on and executes test tasks—no changes needed.The
koverXmlReporttask in Kover 0.9.1 is configured by default to depend on all test tasks in the project and will automatically trigger test execution when invoked. The artifact upload pathandroid/build/reports/kover/is the correct default output location for Kover reports. The configuration inandroid/build.gradle.ktsapplies the Kover plugin with no custom overrides, so the standard behavior applies: running./gradlew :react-native-usercentrics:koverXmlReportwill compile, run tests, and generate coverage reports.
|
CodeAnt AI is running Incremental review |
|
CodeAnt AI is running Incremental review Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
User description
PR Type
Enhancement, Tests
Description
Add Kover plugin for Android code coverage reporting
Configure Jest to collect TypeScript coverage reports
Upload coverage artifacts in CI/CD workflows
Enable code coverage for iOS and Android tests
Diagram Walkthrough
File Walkthrough
build.gradle.kts
Add Kover plugin for Android coverageandroid/build.gradle.kts
ci.yml
Configure coverage uploads in CI workflows.github/workflows/ci.yml
-enableCodeCoverage YESpackage.json
Configure Jest coverage collection settingspackage.json
coverageCodeAnt-AI Description
Enable unified coverage reporting for JavaScript, Android, and iOS tests in CI
What Changed
Impact
✅ Easier access to coverage reports in CI✅ Clearer gaps in test coverage✅ Fewer untested changes reaching release💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.