Added NoStackTrace to ExceptionFormats (#1489)

This commit is contained in:
Gerardo Grignoli
2024-03-08 12:26:45 -03:00
committed by GitHub
parent d921ac6f02
commit e66d3aab2e
4 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,2 @@
System.InvalidOperationException: Something threw!
System.InvalidOperationException: Throwing!

View File

@ -108,6 +108,21 @@ public sealed class ExceptionTests
return Verifier.Verify(result);
}
[Fact]
[Expectation("NoStackTrace")]
public Task Should_Write_Exception_With_No_StackTrace()
{
// Given
var console = new TestConsole().Width(1024);
var dex = GetException(() => TestExceptions.ThrowWithInnerException());
// When
var result = console.WriteNormalizedException(dex, ExceptionFormats.NoStackTrace);
// Then
return Verifier.Verify(result);
}
public static Exception GetException(Action action)
{
try