From a9d74ef680beb71fee55f23eabb0a11a06e050e6 Mon Sep 17 00:00:00 2001 From: Tom Longhurst <30480171+thomhurst@users.noreply.github.com> Date: Mon, 12 Jan 2026 20:34:20 +0000 Subject: [PATCH] fix: always include StandardOutputProperty in test nodes for IDE support Fixes #4325 PR #4257 incorrectly skipped adding StandardOutputProperty/StandardErrorProperty to test nodes when in "detailed" output mode. IDEs like Rider are detected as detailed mode but still need these properties to display test output in their results panel. The real-time console output duplication is already handled separately by HideTestOutput in OptimizedConsoleInterceptor, so StandardOutputProperty should always be included for IDE consumption. Co-Authored-By: Claude Opus 4.5 --- TUnit.Engine/Extensions/TestExtensions.cs | 35 ++++------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/TUnit.Engine/Extensions/TestExtensions.cs b/TUnit.Engine/Extensions/TestExtensions.cs index 26bed87851..d8596a3747 100644 --- a/TUnit.Engine/Extensions/TestExtensions.cs +++ b/TUnit.Engine/Extensions/TestExtensions.cs @@ -6,7 +6,6 @@ using TUnit.Core; using TUnit.Core.Extensions; using TUnit.Engine.Capabilities; -using TUnit.Engine.Services; #pragma warning disable TPEXP namespace TUnit.Engine.Extensions; @@ -14,7 +13,6 @@ namespace TUnit.Engine.Extensions; internal static class TestExtensions { private static bool? _cachedIsTrxEnabled; - private static bool? _cachedIsDetailedOutput; private static readonly ConcurrentDictionary AssemblyFullNameCache = new(); private static readonly ConcurrentDictionary TestNodePropertiesCache = new(); @@ -34,7 +32,6 @@ internal static void ClearCaches() AssemblyFullNameCache.Clear(); TestNodePropertiesCache.Clear(); _cachedIsTrxEnabled = null; - _cachedIsDetailedOutput = null; } private static string GetCachedAssemblyFullName(Assembly assembly) @@ -159,17 +156,14 @@ internal static TestNode ToTestNode(this TestContext testContext, TestNodeStateP output = testContext.GetStandardOutput(); error = testContext.GetErrorOutput(); - if (!IsDetailedOutput(testContext)) + if (!string.IsNullOrEmpty(output)) { - if (!string.IsNullOrEmpty(output)) - { - properties.Add(new StandardOutputProperty(output)); - } + properties.Add(new StandardOutputProperty(output)); + } - if (!string.IsNullOrEmpty(error)) - { - properties.Add(new StandardErrorProperty(error)); - } + if (!string.IsNullOrEmpty(error)) + { + properties.Add(new StandardErrorProperty(error)); } } @@ -294,23 +288,6 @@ private static bool IsTrxEnabled(TestContext testContext) return _cachedIsTrxEnabled.Value; } - private static bool IsDetailedOutput(TestContext testContext) - { - if (_cachedIsDetailedOutput.HasValue) - { - return _cachedIsDetailedOutput.Value; - } - - if (testContext.Services.GetService() is not {} verbosityService) - { - _cachedIsDetailedOutput = false; - return false; - } - - _cachedIsDetailedOutput = verbosityService.IsDetailedOutput; - return _cachedIsDetailedOutput.Value; - } - private static TimingProperty GetTimingProperty(TestContext testContext, DateTimeOffset overallStart) { if (overallStart == default(DateTimeOffset))