-
Notifications
You must be signed in to change notification settings - Fork 386
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exclude argument is not working for dotnet test command #613
Comments
Exclude works on assembly names, which wwwroot is probably not a part of, if you need to exclude based on path you should look at ExcludeByFile according to the docs: |
Also you need to use last version to be sure that exclude by file works correctly 2.7.0 #524 |
Thanks much for your inputs on this issue. if you have installation link to 2.7.0 for coverlet ..please proide me that i can use it. |
I got the package installation command ..will try and let you guys know.. dotnet add package coverlet.msbuild --version 2.7.0 |
I have installed the latest version of coverlet-2.7.0 and tried to exclude the source folder wwwroot from the dot-net command and able to exclude from coverage. dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:ExcludeByFile="../BSH.MES.CloudGateway/wwwroot/.html,../Constants/**/.cs,../Contollers//*.cs,../Exceptions//.cs,../BSH.MES.CloudGateway/wwwroot/css/.css,../BSH.MES.CloudGateway/wwwroot/js/*.js" INFO: Excluded sources: I could see sonar.exclusions property in the sonar-project file . sonar.exclusions="../BSH.MES.CloudGateway/wwwroot/.html,../Constants//.cs,../Contollers//.cs,../Exceptions//.cs,../BSH.MES.CloudGateway/wwwroot/css/.css,../BSH.MES.CloudGateway/wwwroot/js/.js" But After pushing end analysis to sonar dashboard , i could see wwwroot folder which should not push which having 45000 lines of code which dev team is not covering. could you please suggest on it why wwwroot folder is pushing though we ignored.. code structure: root@ip-172-31-5-249:/home/MES-FETCH/services/BSH.MES.CloudGateway# ls -ltr |
@venkikonda can you enable coverlet logging so we can check if the parameter are correct. |
@MarcoRossignoli - I have gone through the links provided by you but i am unable to see any exclusions in generated msbuild.binlog file. I have used the below command , dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:ExcludeByFile="../BSH.MES.CloudGateway/wwwroot/.html,../Constants/**/.cs,../Contollers//*.cs,../Exceptions//.cs,../BSH.MES.CloudGateway/wwwroot/css/.css,../BSH.MES.CloudGateway/wwwroot/js/*.js" -verbosity:diagnostic -bl:msbuild.binlog -noconsolelogger please find the below attached reference link .. Could you please let me know if you need any other information. |
Try with
The filter should be one of https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.filesystemglobbing.matcher?view=dotnet-plat-ext-3.0 and from your log I don't see any file filtered, seem that filter is not correct. |
@MarcoRossignoli I used the below filter command in the dotnet test command. dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:ExcludeByFile="**/BSH.MES.CloudGateway/wwwroot/.html%2c **/BSH.MES.CloudGateway/wwwroot/css/.css%2c **/BSH.MES.CloudGateway/wwwroot/js/*.js" -verbosity:diagnostic -bl:msbuild.binlog -noconsolelogger I am able to excluded files filter in log file..please see attached log file.. But still while doing sonar end analysis for dotnet .Core wwwroot whole folder pushing to sonar dashboard.. Please find below sonar dashboard image.. Please give your inputs on this.. |
@venkikonda sorry for the delay, bit busy, So seem the filter is not correct...try with |
@venkikonda any news? |
Close for stale conversation, feel free to re-open if needed! |
if you put notation according to https://github.com/coverlet-coverage/coverlet/blob/master/Documentation/MSBuildIntegration.md#source-files, it should work - escape " by backslash - |
Hi Team,
Greetings For The Day!!
we are using coverlet.Msbuild package to get the code coverage for .NetCore.
when i executed the dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[wwwroot.]" command from test folder able to retrieve the coverage.xml for code module ( Models ..controllers etc) ..i am not able to exclude some folders which are having more lines of code ..
used pattern : dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude=[BSH.MES.CloudGateway.*.wwwroot]
need to exclude whole wwwroot folder from ../home/MES/mes-platform/services/BSH.MES.CloudGateway/wwwroot path which has 460000 lines of code
Could you please kindly assist on this how to exclude not required folders fro project?
Your help would be more appreciable here.
Thanks
Venkat
+91-8886710001
The text was updated successfully, but these errors were encountered: