Skip to content

--coverage reports 0% in create-react-native-library setups #58

@mfazekas

Description

@mfazekas

Describe the bug

When running harness tests with --coverage in a create-react-native-library project, coverage always reports 0% for library source files even though tests pass and execute the code.

System Info

% npx react-native info               
info Fetching system and libraries information...
System:
  OS: macOS 15.7.3
  CPU: (12) arm64 Apple M2 Max
  Memory: 200.47 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 22.16.0
    path: /Users/boga/.nvm/versions/node/v22.16.0/bin/node
  Yarn:
    version: 3.6.1
    path: /Users/boga/.local/bin/yarn
  npm:
    version: 11.5.2
    path: /Users/boga/.nvm/versions/node/v22.16.0/bin/npm
  Watchman:
    version: 2025.06.30.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /Users/boga/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.5
      - iOS 18.5
      - macOS 15.5
      - tvOS 18.5
      - visionOS 2.5
      - watchOS 11.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2025.1 AI-251.27812.49.2514.14217341
  Xcode:
    version: 16.4/16F6
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 20.0.1
    path: /usr/bin/javac
  Ruby:
    version: 2.7.8
    path: /Users/boga/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 18.0.0
    wanted: 18.0.0
  react:
    installed: 19.0.0
    wanted: 19.0.0
  react-native:
    installed: 0.79.2
    wanted: 0.79.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

React Native Harness Version

1.0.0-canary.1766225407244

Reproduction

https://github.com/rive-app/rive-nitro-react-native/tree/repro/harness-coverage-zero

Steps to reproduce

git clone https://github.com/rive-app/rive-nitro-react-native
cd rive-nitro-react-native
git checkout repro/harness-coverage-zero
yarn install
cd example/ios
pod install
cd ..
yarn test:harness:ios --coverage

Shows 0% coverage

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions