log errors when there are test setup failures

This commit is contained in:
E M 2026-05-01 11:07:34 +10:00
parent 23da2c36ec
commit ba9822d0e2
No known key found for this signature in database
2 changed files with 6 additions and 2 deletions

View File

@ -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}");
}
}

View File

@ -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;
}
}