Skip to content

RFC: Native iOS code coverage support#83

Draft
mfazekas wants to merge 1 commit intocallstackincubator:mainfrom
mfazekas:feat/native-ios-coverage
Draft

RFC: Native iOS code coverage support#83
mfazekas wants to merge 1 commit intocallstackincubator:mainfrom
mfazekas:feat/native-ios-coverage

Conversation

@mfazekas
Copy link
Copy Markdown
Contributor

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.

  • New @react-native-harness/coverage-ios package: ships HarnessCoverageHelper.swift + HarnessCoverageSetup.m as an auto-linked pod, plus a Module.prepend hook on Pod::Installer that reads the config and injects coverage compilation flags at pod install time
  • Config schema extended with coverage.native.ios.pods: string[]
  • Coverage collector in platform-ios pulls .profraw files from the simulator, merges via llvm-profdata, and generates native-coverage.lcov
  • Collection runs automatically during harness dispose (before the app is fully torn down)

Inspired by rive-app/rive-nitro-react-native#190

Test plan

  • Add coverage.native.ios.pods to playground config, run pod install, verify coverage flags on target pods
  • Run harness tests with --coverage, verify .profraw files in simulator Documents dir
  • Verify native-coverage.lcov output
  • Verify no-op when config has no coverage.native.ios

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 25, 2026

@mfazekas is attempting to deploy a commit to the Callstack Team on Vercel.

A member of the Team first needs to authorize it.

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.
@mfazekas mfazekas force-pushed the feat/native-ios-coverage branch from 6a33bbf to 8cd29d8 Compare March 25, 2026 13:23
@mfazekas
Copy link
Copy Markdown
Contributor Author

@V3RON any feedback on this PR adding native code coverage?!

@V3RON
Copy link
Copy Markdown
Contributor

V3RON commented Mar 27, 2026

Hey @mfazekas 👋
I had to finish some other tasks first, but I'll try to go through it over the weekend and get back to you on Sunday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants