Xcode doesn't gather code coverage for local Swift package targets

My app setup is similar to https://forums.developer.apple.com/thread/133495 - I have an app target, some frameworks and local Swift packages. I added the package tests to the test plan.


Now, when "gather code coverage" is just "on" in the test plan, I get code coverage from the package targets. But when I selectively add only the targets I want (including the package targets), the package targets don't show up in the code coverage results at all.


Gathering code coverage for all targets isn't really what I want, because that includes a lot of third-party code that I'm not interested in.

Replies

This is a known issue and is under active investigation. If you'd like, you can submit a report using Feedback Assistant to stay updated on the status of this issue. Thank you for your patience!
  • Given that's a year since you answered, how is "active investigation" defined?

Add a Comment
Thank you for responding! I have already filed a feedback for this: FB7724987
Hey, has there been any progress on this? The feedback assistant report hasn't seen any activity, but since nobody replied to the number, I suppose it might have been overlooked...

Is there any update on this? Seems like this is still an issue with the latest Xcode (12.5.1)

This is still an issue a year later, can we get an update on this?

This really stinks. I'm having to do exhausting work arounds, like working with 2 projects just to get coverage for 1.

This continues to be a problem running Xcode Version 13.1 (13A1030d).

Would love to get this fixed before the end of 2022

Apple asleep at the wheel. What else is new.

Given that's a year since you answered, how is "active investigation" defined?

I had a look at the above-mentioned bug (FB7724987) and it’s definitely in the right place. It’s not fixed in any currently released or seeded version of Xcode [1] and, alas, I can’t talk about anything beyond that.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] At the time of this post the released version of Xcode is 13.3.1 and there are no Xcode betas being seeded.

I can confirm this is working on Xcode 14 beta 2

It is not working for me with Xcode 14.0 beta 4.

I think that it is working only for Intel-based macs. @carlosmejia083 @Blaubeere Can you tell us what processors your macs have, please?

I have an M1 Pro and it is not working with Xcode 14.0 beta 4.

I can confirm that as of Xcode 14.1b2 that coverage for selected targets on an SPM package library is now working as expected on my Intel iMac Pro but continues to show no coverage on my M1 Max MBP.