Exclude assembly/module in Docker build


We've been testing dotCover from within Docker build and for basic scenario it works fine.

RUN /root/.dotnet/tools/dotnet-dotCover cover-dotnet --Filters=+:module=Cover* --output=codecoverage.dotcover.xml --ReportType=DetailedXML -- test CoverTest/CoverTest.csproj

However on trying to EXCLUDE a module (test project)

RUN /root/.dotnet/tools/dotnet-dotCover cover-dotnet --Filters=+:module=Cover*;-:module=CoverTest --output=codecoverage.dotcover.xml --ReportType=DetailedXML -- test CoverTest/CoverTest.csproj

that seems to mess up how /bin/sh treats the parameters

 => ERROR [buildtest 10/11] RUN /root/.dotnet/tools/dotnet-dotCover cover-dotnet --Filters=+:module=Cover*;-:module=CoverTest --output=codecoverage.dotcover.xml --ReportType=DetailedXML -- test CoverTest/CoverT  4.8s
> [buildtest 10/11] RUN /root/.dotnet/tools/dotnet-dotCover cover-dotnet --Filters=+:module=Cover*;-:module=CoverTest --output=codecoverage.dotcover.xml --ReportType=DetailedXML -- test CoverTest/CoverTest.csproj:
3.481 JetBrains dotCover Console Runner 2024.1. Build 20240408.85029 (linux-arm64)
3.482 Copyright (c) 2009–2024 JetBrains s.r.o. All rights reserved.
4.653 'Output' parameter is not specified
4.654 Type 'dotCover help' for usage.
4.763 /bin/sh: 1: -:module=CoverTest: not found

How to properly define a multi-chain coverage filter?

1 comment

Looks like it's the ; that's causing sh to misinterpret. Have to encapsulate Filters parameter in quotes to get sh to ignore it.


Please sign in to leave a comment.