RFC: Native iOS code coverage support#83
Draft
mfazekas wants to merge 5 commits intocallstackincubator:mainfrom
Draft
RFC: Native iOS code coverage support#83mfazekas wants to merge 5 commits intocallstackincubator:mainfrom
mfazekas wants to merge 5 commits intocallstackincubator:mainfrom
Conversation
|
@mfazekas is attempting to deploy a commit to the Callstack Team on Vercel. A member of the Team first needs to authorize it. |
6a33bbf to
8cd29d8
Compare
Contributor
Author
|
@V3RON any feedback on this PR adding native code coverage?! |
Contributor
|
Hey @mfazekas 👋 |
V3RON
reviewed
Mar 30, 2026
Comment on lines
+17
to
+30
| def resolve_coverage_pods | ||
| project_dir = Dir.pwd | ||
| config_json = `node -e " | ||
| import('#{project_dir}/rn-harness.config.mjs') | ||
| .then(m => console.log(JSON.stringify( | ||
| m.default?.coverage?.native?.ios?.pods || [] | ||
| ))) | ||
| .catch(() => console.log('[]')) | ||
| "`.strip | ||
| JSON.parse(config_json) | ||
| rescue => e | ||
| Pod::UI.warn "[HarnessCoverage] Failed to read config: #{e.message}" | ||
| [] | ||
| end |
Contributor
There was a problem hiding this comment.
I wonder whether we can do something about this. It doesn't seem right to assume the structure of the config file. Maybe we should create a separate reac-config.ts file, include the types from the config package there, and run that instead of using this inlined script?
Add LLVM source-based profiling for native Swift/ObjC code via a new @react-native-harness/coverage-ios package. Users specify pods to instrument in rn-harness.config.mjs and coverage flags are injected automatically at pod install time via Module.prepend on Pod::Installer.
Fix repo URLs (margelo -> callstackincubator) and extract config loading into a separate script using @react-native-harness/config.
8cd29d8 to
4035c23
Compare
- Guard podspec require_relative and install_modules_dependencies - Add @objc name annotation to prevent Swift name mangling - Defer +load class lookup to main queue for Xcode 16+ dylib compat - Read config directly instead of through Zod-validated schema - Patch app xcconfig with -force_load and -fprofile-instr-generate
The harness reinstalls the app between test files, wiping the app container. Move profraw output to /tmp/harness-coverage/ which persists across app reinstalls on the simulator. Clean the directory at test run start and after collection.
The direct config reading was a workaround for testing with the old published config package. Since this PR updates the config schema, they'll be published together and getConfig() will work correctly.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds native iOS code coverage (LLVM profiling) for Swift/ObjC code exercised by harness tests. Users specify which pods to instrument in
rn-harness.config.mjs— no Podfile changes required.Tested end-to-end with rive-nitro-react-native (RNRive + RiveRuntime pods), producing valid lcov output covering 37 source files.
Changes
@react-native-harness/coverage-iospackage with auto-linked pod and CocoaPods post-install hook-force_loadand-fprofile-instr-generatecoverage-collector.tsin platform-ios handles profraw merge and lcov export, including Xcode 16+ debug dylib binaries