Skip to content

DO NOT MERGE: native iOS coverage setup (local harness fork)#247

Draft
mfazekas wants to merge 1 commit intofeat/rive-ios-experimentalfrom
setup/native-ios-coverage
Draft

DO NOT MERGE: native iOS coverage setup (local harness fork)#247
mfazekas wants to merge 1 commit intofeat/rive-ios-experimentalfrom
setup/native-ios-coverage

Conversation

@mfazekas
Copy link
Copy Markdown
Collaborator

@mfazekas mfazekas commented May 8, 2026

Do not merge — this PR contains local file: and portal: references to the react-native-harness fork.

What this does

Sets up native iOS code coverage collection using @react-native-harness/coverage-ios from the mfazekas/react-native-harness fork (feat/native-ios-coverage branch).

How to use

Prerequisites: clone the harness fork at /Users/boga/Work/Margelo/react-native-harness and check out feat/native-ios-coverage.

yarn install
cd example/ios && pod install  # should print [HarnessCoverage] Instrumenting pods
cd ..

# Build with Xcode 16.4 (not Xcode 26 beta)
DEVELOPER_DIR=/Applications/Xcode16.4.app/Contents/Developer xcodebuild build \
  -workspace ios/RiveExample.xcworkspace -scheme RiveExample \
  -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 16 Pro,OS=18.6" \
  -derivedDataPath ios/build

# Install on the correct simulator
xcrun simctl install "iPhone 16 Pro" ios/build/Build/Products/Debug-iphonesimulator/RiveExample.app

# Run tests
yarn test:harness:ios:coverage

# Collect native coverage manually
xcrun llvm-profdata merge -sparse /tmp/harness-coverage/*.profraw -o coverage/native-ios.profdata
xcrun llvm-cov export --format=lcov \
  --instr-profile=coverage/native-ios.profdata \
  ios/build/Build/Products/Debug-iphonesimulator/RiveExample.app/RiveExample.debug.dylib \
  > coverage/native-ios.lcov

# HTML report
genhtml coverage/native-ios.lcov -o coverage/native-ios-html \
  --ignore-errors inconsistent,corrupt,unsupported
open coverage/native-ios-html/index.html

Known issue

The resolve-coverage-pods.mjs script needs NODE_OPTIONS="--preserve-symlinks" when using portal resolutions. After yarn install, manually patch node_modules/@react-native-harness/coverage-ios/scripts/harness_coverage_hook.rb line 19 to add this. This will be fixed upstream.

See NATIVE_IOS_COVERAGE_INTEGRATION.md for full details.

Adds coverage-ios dependency and portal resolutions pointing to the local
react-native-harness fork (feat/native-ios-coverage branch).
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.

1 participant