From ba9822d0e2fce0e7cd8c8ccb8d3e2d6375c10aa0 Mon Sep 17 00:00:00 2001 From: E M <5089238+emizzle@users.noreply.github.com> Date: Fri, 1 May 2026 11:07:34 +1000 Subject: [PATCH] log errors when there are test setup failures --- Tests/DistTestCore/DistTest.cs | 4 ++-- Tests/DistTestCore/Global.cs | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Tests/DistTestCore/DistTest.cs b/Tests/DistTestCore/DistTest.cs index d33e0c7f..34773cf4 100644 --- a/Tests/DistTestCore/DistTest.cs +++ b/Tests/DistTestCore/DistTest.cs @@ -100,9 +100,9 @@ namespace DistTestCore using var raw = new StreamWriter(Console.OpenStandardOutput(), leaveOpen: true) { AutoFlush = true }; raw.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(entry)); } - catch + catch (Exception ex) { - // Best-effort; don't fail the teardown if status emission fails. + Console.Error.WriteLine($"[test-result-emit] Failed: {ex}"); } } diff --git a/Tests/DistTestCore/Global.cs b/Tests/DistTestCore/Global.cs index c35f53d1..ce6746c2 100644 --- a/Tests/DistTestCore/Global.cs +++ b/Tests/DistTestCore/Global.cs @@ -52,6 +52,10 @@ namespace DistTestCore { GlobalTestFailure.HasFailed = true; log.Error($"Global setup cleanup failed with: {ex}"); + // Write directly to raw stderr so this is visible even when NUnit + // captures Console.Out/Console.Error for the fixture setup context. + using var err = new StreamWriter(Console.OpenStandardError(), leaveOpen: true) { AutoFlush = true }; + err.WriteLine($"[global-setup-failure] {ex}"); throw; } }