diff --git a/ReleaseNotes.md b/ReleaseNotes.md index 8374231..4111d45 100644 --- a/ReleaseNotes.md +++ b/ReleaseNotes.md @@ -1,5 +1,11 @@ # Release Notes +## Unreleased + +* Fix running `dotnet test` with extra properties. +* Add `DotNetTestSettings.GetLogger` to support custom loggers. +* Don't send `-maxcpucount` argument when calling `dotnet test` with a dll. + ## 5.21.1 * Send verbosity argument to `dotnet test`. diff --git a/src/Faithlife.Build/DotNetBuild.cs b/src/Faithlife.Build/DotNetBuild.cs index 0ece440..2c40b07 100644 --- a/src/Faithlife.Build/DotNetBuild.cs +++ b/src/Faithlife.Build/DotNetBuild.cs @@ -979,6 +979,7 @@ public static void RunTests(this DotNetBuildSettings settings, string? path) } else { + var loggerArgs = settings.TestSettings?.GetLogger?.Invoke(path) is { } logger ? new[] { "--logger", logger } : []; if (Path.GetExtension(path)?.ToLowerInvariant() is ".dll" or ".exe") { RunDotNet(new AppRunnerSettings @@ -988,7 +989,7 @@ public static void RunTests(this DotNetBuildSettings settings, string? path) "test", Path.GetFileName(path), settings.GetVerbosityArg(), - settings.GetMaxCpuCountArg(), + .. loggerArgs, "--", "RunConfiguration.TreatNoTestsAsError=true", ], @@ -997,8 +998,7 @@ public static void RunTests(this DotNetBuildSettings settings, string? path) } else { - RunDotNet(new[] - { + RunDotNet([ "test", path, "-c", @@ -1008,9 +1008,11 @@ public static void RunTests(this DotNetBuildSettings settings, string? path) "--no-build", settings.GetVerbosityArg(), settings.GetMaxCpuCountArg(), + .. settings.GetExtraPropertyArgs("test"), + .. loggerArgs, "--", "RunConfiguration.TreatNoTestsAsError=true", - }.Concat(settings.GetExtraPropertyArgs("test"))); + ]); } } } diff --git a/src/Faithlife.Build/DotNetTestSettings.cs b/src/Faithlife.Build/DotNetTestSettings.cs index 2be30cb..f10c7fd 100644 --- a/src/Faithlife.Build/DotNetTestSettings.cs +++ b/src/Faithlife.Build/DotNetTestSettings.cs @@ -31,6 +31,11 @@ public sealed class DotNetTestSettings /// public bool? UseParallel { get; set; } + /// + /// Get the logger for the specified project. + /// + public Func? GetLogger { get; set; } + /// /// Clones the settings. ///