3

In Xcode 7, the library for cocoapods library with exclude for the code coverage.

But In Xcode 8, the library will include for code coverage.

Can I had anyway to exclude the library in the code coverage?

Example: Install pod 'TPKeyboardAvoiding' TPKeyboardAvoidingScrollView.m is include in the code coverage.

1

1 Answer 1

3

You should disable the Code Coverage for the Targets that you don't want to be covered. If you want all of your pods to not be included in the code coverage you can add on your 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

This will disable the Code Coverage for the target of your Pods like in this image

If you now run the test with command + U

I tried with this pod in one of my project and it worked for me. I'm using Xcode Version 8.1 (8B62)

Anyway, I'm still struggling with the same issue for other pods like Cartography. There's a particular setting (which I didn't discover yet) that it seems to override the CLANG_ENABLE_CODE_COVERAGE and the tests still produces the Code Coverage for that.

Let me know if this solve your issue.

Sign up to request clarification or add additional context in comments.

2 Comments

Looks like if the pod is in Swift - it won't be hidden, only ObjC pods are being hidden
don't forget to run pod install

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.