Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 6 additions & 29 deletions TUnit.Engine/Extensions/TestExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@
using TUnit.Core;
using TUnit.Core.Extensions;
using TUnit.Engine.Capabilities;
using TUnit.Engine.Services;
#pragma warning disable TPEXP

namespace TUnit.Engine.Extensions;

internal static class TestExtensions
{
private static bool? _cachedIsTrxEnabled;
private static bool? _cachedIsDetailedOutput;

private static readonly ConcurrentDictionary<Assembly, string> AssemblyFullNameCache = new();
private static readonly ConcurrentDictionary<string, CachedTestNodeProperties> TestNodePropertiesCache = new();
Expand All @@ -34,7 +32,6 @@ internal static void ClearCaches()
AssemblyFullNameCache.Clear();
TestNodePropertiesCache.Clear();
_cachedIsTrxEnabled = null;
_cachedIsDetailedOutput = null;
}

private static string GetCachedAssemblyFullName(Assembly assembly)
Expand Down Expand Up @@ -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));
}
}

Expand Down Expand Up @@ -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<VerbosityService>() 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))
Expand Down
Loading