I am developing a Swift package in Xcode and I would like to see code coverage for my tests.
Package.swift looks like this:
// swift-tools-version:5.3 import PackageDescription let package = Package( name: "MyPackage", products: [ .library( name: "MyPackage", targets: ["MyPackage"] ), ], dependencies: , targets: [ .target( name: "MyPackage", dependencies:  ), .testTarget( name: "MyPackageTests", dependencies: ["MyPackage"] ), ] )
I open it in Xcode, and I have "Gather coverage for all targets" selected in build scheme.
My tests run and succeed without an issue. However, the code coverage is not gathered. In logs I see such warning:
Failed to generate coverage for target 'MyPackageTests' at paths ( "/Users/[...]/Library/Developer/Xcode/DerivedData/MyPackage-cfufflstgcguakceoeffzdilbbjq/Build/Products/Debug-iphonesimulator/MyPackageTests.xctest/MyPackageTests" ): No object file for requested architecture
- MacBook Pro M1
- Xcode 12.4 (12D4e)
I tried to run tests on my old MacBook Pro (Late 2016) with Intel processor and the code coverage was gathered without an issue, so it looks like the problem is related to Apple Silicon architecture.
Is there something I can do to make the code coverage gathering work on M1 Mac?
Here is a link to zipped Swift package as a reference: http://darrarski.pl/files/MyPackage.zip.