在Xcode 7中,cocoapods库包含代码覆盖范围的排除项。
In Xcode 7, the library for cocoapods library with exclude for the code coverage.
但是在Xcode 8中,该库将包含代码覆盖范围。
But In Xcode 8, the library will include for code coverage.
我是否可以在代码覆盖范围内排除该库?
Can I had anyway to exclude the library in the code coverage?
示例:安装pod'TPKeyboardAvoiding ' TPKeyboardAvoidingScrollView.m包含在代码覆盖范围内。
Example: Install pod 'TPKeyboardAvoiding' TPKeyboardAvoidingScrollView.m is include in the code coverage.
推荐答案您应禁用目标代码覆盖范围你不想被覆盖。如果您不希望所有Pod都包含在代码覆盖范围内,则可以在Podfile中添加
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这将禁用Pod目标的代码覆盖率,如这张图片
This will disable the Code Coverage for the target of your Pods like in this image
如果您现在使用 command + U
我在我的一个项目中尝试使用此吊舱,它对我有用。我正在使用Xcode版本8.1(8B62)
I tried with this pod in one of my project and it worked for me. I'm using Xcode Version 8.1 (8B62)
无论如何,我仍在为地图。有一个特殊的设置(我尚未发现),它似乎覆盖了 CLANG_ENABLE_CODE_COVERAGE ,并且测试仍然会为此生成代码覆盖率。
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.
更多推荐
cocoapods库的代码覆盖率
发布评论