haf / expecto

A smooth testing lib for F#. APIs made for humans! Strong testing methodologies for everyone!
Apache License 2.0
668 stars 96 forks source link

For Task based tests, exceptions are printed twice #269

Closed 0x53A closed 6 years ago

0x53A commented 6 years ago

grafik

adamchester commented 6 years ago

Hi @0x53A, there is only one exception there (although it is an aggregate exception, so it contains one or more inner exceptions too), and the output is more or less what ToString() on the exception would generate.

Does this help?

0x53A commented 6 years ago

Hi @adamchester, yes, the output is correct.

I didn't write it (I should have maybe elaborated a bit more instead of just posting a screenshot ;) ), but my intention was to propose to unwrap AggreagateExceptions.

This is really common and annoying with Task based tests from c#.

What do you think of https://github.com/haf/expecto/pull/270?

adamchester commented 6 years ago

My preference is not to hide the fact that it’s wrapped in an aggregate exception, but I can understand the argument for cleaning it up a little.

AnthonyLloyd commented 6 years ago

I think this does simply for single exceptions. Will accept.

0x53A commented 6 years ago

@adamchester for reference, the above screenshot was from this source code:

                Runner.FocusedTestCase("focused async", async () => {
                    throw new IOException("Hello World!");
                }),

the TPL automatically wraps everything into aggregate exceptions, which is slightly annoying.

adamchester commented 6 years ago

:+1: