Skip to content

The CoverletOutput property generated report does not use runsettings file exclusions #1695

@fossbrandon

Description

@fossbrandon

Describe the bug
While trying to use coverlet to collect code coverage while ignoring certain files specified in my .runsettings file, these exclusions are not honored if I specify a value for the CoverletOutput property.

To Reproduce

  • A test project with a .runsettings file linked in the csproj that excludes some files. Ex: <ExcludeByFile>**/*.sg.cs,</ExcludeByFile>
  • Run the test command and specify the CoverletOutput property. Ex: dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=TestResults/latest-coverage.xml
  • The command will generate the normal coverage result within a generated GUID subfolder which properly excludes the files specified in the runsettings file. The coverlet output generated file (ex: latest-coverage.xml) will not exclude the same files and produces a different report.

Expected behavior
The output specified in the CoverletOutput property should properly exclude files specified in a runsettings file like the report generated without specifying that value.

Actual behavior
The report generated at the specified value for CoverletOutput produces a report that does not use the runsettings exclusions.

Configuration (please complete the following information):
Please provide more information on your .NET configuration:
* Which coverlet package and version was used?
- coverlet.collect - 6.0.2
- coverlet.msbuild - 6.0.2
* Which version of .NET is the code running on?
- .NET 8
* What OS and version, and what distro if applicable?
- Windows 11 - 10.0.22631 Build 22631
* What is the architecture (x64, x86, ARM, ARM64)?
- X64
* Do you know whether it is specific to that configuration?
- I don't think so

Additional context
If I add the additional property /p:ExcludeByFile=\"**.sg.cs\" it does properly exclude the files I want it to. I would just prefer to exclude in the runsettings file only without having to duplicate them when running the command by hand.

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already existsquestionThis issue is a question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions