Skip to content

Commit cc6f642

Browse files
committed
Remove custom output device; use platform config for output
Removed CoverageSessionHandler and CoverletOutputDevice, eliminating custom output display and session messaging. Updated CoverletExtensionCollector to determine the coverage report output directory using the Microsoft Testing Platform configuration, and removed the OutputDirectory property from CoverletExtensionConfiguration. These changes streamline integration with the platform and ensure reports are written to the correct test result directory.
1 parent 6e0e190 commit cc6f642

File tree

4 files changed

+8
-114
lines changed

4 files changed

+8
-114
lines changed

src/coverlet.MTP/CoverageSessionHandler.cs

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/coverlet.MTP/CoverletExtensionCollector.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
using Coverlet.Core.Reporters;
1010
using Coverlet.Core.Symbols;
1111
using Coverlet.MTP.CommandLine;
12+
using Microsoft.Testing.Platform.Configurations;
13+
using Microsoft.Testing.Platform.Logging;
14+
using Microsoft.Testing.Platform.CommandLine;
1215
using Microsoft.Extensions.DependencyInjection;
1316
using Microsoft.Testing.Platform.Extensions;
1417
using Microsoft.Testing.Platform.Extensions.TestHostControllers;
@@ -25,10 +28,10 @@ internal sealed class CoverletExtensionCollector : ITestHostProcessLifetimeHandl
2528
private readonly CoverletLoggerAdapter _logger;
2629
private readonly CoverletExtensionConfiguration _configuration;
2730
private IServiceProvider? _serviceProvider;
28-
private readonly Microsoft.Testing.Platform.Configurations.IConfiguration? _platformConfiguration;
31+
private readonly IConfiguration? _platformConfiguration;
2932
private Coverage? _coverage;
30-
private readonly Microsoft.Testing.Platform.Logging.ILoggerFactory _loggerFactory;
31-
private readonly Microsoft.Testing.Platform.CommandLine.ICommandLineOptions _commandLineOptions;
33+
private readonly ILoggerFactory _loggerFactory;
34+
private readonly ICommandLineOptions _commandLineOptions;
3235
private bool _coverageEnabled;
3336
private string? _testModulePath;
3437
private string? _coverageIdentifier;
@@ -55,7 +58,7 @@ public CoverletExtensionCollector(
5558
{
5659
_loggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory));
5760
_commandLineOptions = commandLineOptions ?? throw new ArgumentNullException(nameof(commandLineOptions));
58-
_platformConfiguration = configuration;
61+
_platformConfiguration = configuration ?? throw new ArgumentNullException(nameof(loggerFactory));
5962
_configuration = new CoverletExtensionConfiguration();
6063
_logger = new CoverletLoggerAdapter(_loggerFactory);
6164

@@ -282,7 +285,7 @@ private void InitializeCoverage()
282285

283286
private async Task GenerateReportsAsync(CoverageResult result, CancellationToken cancellation)
284287
{
285-
string outputDirectory = _configuration.OutputDirectory ??
288+
string outputDirectory = _platformConfiguration!.GetTestResultDirectory() ??
286289
Path.GetDirectoryName(_testModulePath) + Path.DirectorySeparatorChar;
287290

288291
string directory = Path.GetDirectoryName(outputDirectory)!;

src/coverlet.MTP/CoverletExtensionConfiguration.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ namespace coverlet.Extension.Collector
99
internal class CoverletExtensionConfiguration
1010
{
1111
public string[] formats { get; set; } = ["json"];
12-
public string? OutputDirectory { get; set; }
1312

1413
// Coverage parameters
1514
public string[]? IncludeFilters { get; set; }

src/coverlet.MTP/Output/CoverletOutputDevice.cs

Lines changed: 0 additions & 80 deletions
This file was deleted.

0 commit comments

Comments
 (0)