Is there a way to exclude Pods from Code Coverage?
I would like to see Code Coverage only for the code I've written.
Not that it should matter, but I'm using Xcode 8.
To measure and visualize code coverage for a project, follow these steps: Enable code coverage date gathering. To do this, go to Product › Scheme › Edit Scheme... , and select Test from the left hand side menu. Under the Info section, check the Gather coverage data box.
The Podfile is located in the root of the Pods project. An easy way to open it is via "Open Quickly" (Shift Cmd O) typing Podfile. Show activity on this post. If it's been added to the project, you can just click on it.
The Podfile is a specification that describes the dependencies of the targets of one or more Xcode projects. The file should simply be named Podfile . All the examples in the guides are based on CocoaPods version 1.0 and onwards.
These steps will help:
1. add these lines to Podfile
# Disable Code Coverage for Pods projects post_install do |installer_representation| installer_representation.pods_project.targets.each do |target| target.build_configurations.each do |config| config.build_settings['CLANG_ENABLE_CODE_COVERAGE'] = 'NO' end end end
2. run pod install
Now you won't see pods in test coverage.
Note: It only excludes Objective-c pods but not Swift
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With