a7ex / xcresultparser

Parse the binary xcresult bundle from Xcode builds and testruns
MIT License
83 stars 24 forks source link

Ignore directories/files? #10

Closed jcabreram closed 1 year ago

jcabreram commented 1 year ago

Is it possible to ignore specific directories/files? I'm currently using the parser for a Swift package and the parser is including in the results the files in ~/Library/Developer/Xcode/DerivedData which are coming from other package dependencies for which I'm not interested in their code coverage.

Thank you for this awesome project, it's been really useful.

a7ex commented 1 year ago

Hello Jonathan, sorry for the late response. Is it enough to specify the targets which you are interested in? There is an option to specify the targets, for which the code coverage report is generated. You should also be able to specify the targets for the coverage for your test run, so that the data doesn't even appear in the xcresult file.

But meanwhile you may want to look into the option "t":

-t, --coverage-targets Specify which targets to calculate coverage from

Would that help your problem?

jcabreram commented 1 year ago

Hi @a7ex, thank you very much for your reply. I've tried to specify the targets so that the data doesn't even appear in the .xcresult file but because it's a Swift package that I'm testing without converting it into an .xcodeproj, it doesn't seem to be possible to do that, as I've also read on this Swift forum thread.

I'm generating the .xcresult file with the command xcodebuild -scheme MyScheme test -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13,OS=15.2' -enableCodeCoverage YES

I've tried the -t option of xcresultparser as you've suggested but it's still showing the dependencies in its output starting with Users.runner.Library.Developer.Xcode.DerivedData.s-budpulsgqbxhygedafjqfylpodyj.SourcePackages.checkouts.

This is the command I'm using for parsing: xcresultparser -t MyScheme -o cobertura coverage.xcresult > cobertura.xml

Am I doing something incorrectly?

Thanks again!

a7ex commented 1 year ago

The targets option should do what you want. Could you send me an example xcarchive so I can check why the targets filter doesn't work?

a7ex commented 1 year ago

Hi @jcabreram thanks for the example file. It turned out, that the -t option was not yet used in the coverage methods. Please try the new version 1.3 I just released.

Hope it fixes your issue. Sorry for the delay.

jcabreram commented 1 year ago

@a7ex thank you so so much! That worked. I'm only seeing the code coverage for the target now.