Different outputs when running coverlet.console on windows powershell/macOS terminal
See original GitHub issueI’m running coverlet.console on macOS and no coverage is generated for my project which actually does cover the dll it aims to test.
IT011972:heartbeat dpaz$ coverlet test/Application.Tests/bin/Debug/netcoreapp2.2/Application.Tests.dll --target "dotnet" --targetargs "test test/Application.Tests/Application.Tests.csproj --no-build -l trx -r ./TestResults" -o "./TestResults/coverage/coverage" --format json
Test run for /Users/dpaz/Documents/projects/heartbeat/test/Application.Tests/bin/Debug/netcoreapp2.2/Application.Tests.dll(.NETCoreApp,Version=v2.2)
Microsoft (R) Test Execution Command Line Tool Version 15.9.0
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
Results File: /Users/dpaz/Documents/projects/heartbeat/test/Application.Tests/TestResults/_IT011972_2018-12-12_10_41_00.trx
Total tests: 1. Passed: 1. Failed: 0. Skipped: 0.
Test Run Successful.
Test execution time: 1.6534 Seconds
Calculating coverage result...
Generating report './TestResults/coverage/coverage.json'
+--------+--------+--------+--------+
| Module | Line | Branch | Method |
+--------+--------+--------+--------+
Total Line: 100%
Total Branch: 100%
Total Method: 100%
I tried to see if I got the same on windows powershell, but surprisingly, it does show coverage there for the exact same file and command
PS C:\Users\dpaz\Documents\projects\heartbeat> coverlet test/Application.Tests/bin/Debug/netcoreapp2.2/Application.Tests.dll --target "dotnet" --targetargs "test test/Application.Tests/Application.Tests.csproj --no-build -l trx -r ./TestResults" -o "./TestResults/coverage/coverage" --format json
Test run for C:\Users\dpaz\Documents\projects\heartbeat\test\Application.Tests\bin\Debug\netcoreapp2.2\Application.Tests.dll(.NETCoreApp,Version=v2.2)
Microsoft (R) Test Execution Command Line Tool Version 15.9.0
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
Results File: C:\Users\dpaz\Documents\projects\heartbeat\test\Application.Tests\TestResults\dpaz_DESKTOP-MQE7N20_2018-12-12_10_27_48.trx
Total tests: 1. Passed: 1. Failed: 0. Skipped: 0.
Test Run Successful.
Test execution time: 2.1279 Seconds
Calculating coverage result...
Generating report '.\TestResults\coverage\coverage.json'
+---------------------------+--------+--------+--------+
| Module | Line | Branch | Method |
+---------------------------+--------+--------+--------+
| Application | 100% | 0% | 100% |
+---------------------------+--------+--------+--------+
Total Line: 100%
Total Branch: 0%
Total Method: 100%
The content of the test and the application proj itself it’s super simple:
test:
public class HeartbeatIntervalProviderTests
{
[Fact]
public void Provide01()
{
var options = Options.Create(new HeartbeatIntervalConfig
{
IntervalInSeconds = 10
});
var provider = new HeartbeatIntervalProvider(options);
Assert.Equal(10, provider.Provide());
}
}
project has 2 classes:
public class HeartbeatIntervalProvider : IHeartbeatIntervalProvider
{
private readonly HeartbeatIntervalConfig _config;
public HeartbeatIntervalProvider(IOptions<HeartbeatIntervalConfig> config)
{
_config = config.Value;
}
public int Provide()
{
return _config.IntervalInSeconds;
}
}
public class HeartbeatIntervalConfig
{
[Range(1, 1000000)]
public int IntervalInSeconds { get; set; }
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (1 by maintainers)
Top Results From Across the Web
dotnet test command - .NET CLI
The dotnet test command is used to execute unit tests in a given project. ... This option works on Windows, macOS, and Linux....
Read more >about ANSI terminals - PowerShell
Describes the features of PowerShell that use ANSI escape sequences and the terminal hosts that support them.
Read more >Change from VS Debug Console to Powershell for running ...
Is there any way to change the 'run' behavior so that my code outputs with powershell as the terminal, not the built in...
Read more >Use code coverage for unit testing - .NET
Code coverage is a measurement of the amount of code that is run by unit tests - either lines, branches, or methods. As...
Read more >coverlet.console 1.0.0
Coverlet is a cross platform code coverage tool for .NET Core, with support for line, branch and method coverage.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Still a problem for us who use the console version of the tool, right?
I have the same problems.
.NET Core SDK (reflecting any global.json): Version: 2.2.101 Commit: 236713b0b7
Runtime Environment: OS Name: ubuntu OS Version: 18.04 OS Platform: Linux RID: ubuntu.18.04-x64 Base Path: /usr/share/dotnet/sdk/2.2.101/