Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/coverage-ios/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,7 @@
"devDependencies": {
"react-native": "*"
},
"license": "MIT"
"license": "MIT",
"author": "Callstack",
"homepage": "https://github.com/callstackincubator/react-native-harness"
}
13 changes: 13 additions & 0 deletions packages/platform-ios/src/coverage-collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,24 @@ export const generateLcov = async (options: {
}): Promise<void> => {
const { profdataPath, binaryPath, outputPath, sourceFilters } = options;

// llvm-cov needs an explicit -arch for universal/fat binaries (e.g. Xcode 26
// debug.dylib). The profile data was produced by the simulator's execution
// arch, which matches the host: arm64 on Apple Silicon, x86_64 on Intel.
const { stdout: archs } = await spawn('lipo', ['-archs', binaryPath]);
const archList = archs.trim().split(/\s+/);
let archFlag: string[] = [];
if (archList.length > 1) {
const { stdout: hostArch } = await spawn('uname', ['-m']);
const arch = hostArch.trim();
archFlag = ['-arch', archList.includes(arch) ? arch : archList[0]];
}

const args = [
'llvm-cov',
'export',
'-format=lcov',
`-instr-profile=${profdataPath}`,
...archFlag,
binaryPath,
];

Expand Down
Loading