haf / expecto

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

Only getting Expectos stack trace #298

Closed inosik closed 5 years ago

inosik commented 5 years ago

Since Expecto 8.2 the stack traces of failing tests contain only stack frames that come from Expecto itself, not my own code. I tried the last versions and 8.1.1 was the last one which contained my code.

This is the output of Expecto 8.6.3:

[10:04:31 INF] EXPECTO? Running tests... <Expecto>
[10:04:31 ERR] Test failed in 00:00:00.0580000.
Never. Actual value was 1 but had expected it to be 2.
  C:\Users\Anthony Lloyd\src\expecto\Expecto\Expect.fs(289,1): Expecto.Expect.equal@289-8.Invoke(String x)
 <Expecto>
[10:04:32 INF] EXPECTO! 1 tests run in 00:00:00.2843505 for Test - 0 passed, 0 ignored, 1 failed, 0 errored.  <Expecto> 

And this is Expecto 8.1.1:

[10:10:02 INF] EXPECTO? Running tests... <Expecto>
[10:10:02 ERR] Test failed in 00:00:00.1420000.
Never. Actual value was 1 but had expected it to be 2.
  G:\projects\experiments\expecto\testsdk\Demo.Tests\Program.fs(7,1): Program.tests@7-34.Invoke(AssertException exn)
 <Expecto>
[10:10:02 INF] EXPECTO! 2 tests run in 00:00:00.2543496 for Tests - 0 passed, 0 ignored, 1 failed, 1 errored.  <Expecto>

I think #295 might be related.

I also just noticed that this only happens with the netcoreapp2.1 target framework. If the test program is build for net461, this is the output:

[10:23:34 INF] EXPECTO? Running tests... <Expecto>
[10:23:35 ERR] Test failed in 00:00:00.1060000.
Never. Actual value was 1 but had expected it to be 2.
   bei Expecto.Expect.equal@289-8.Invoke(String x)
   bei Program.tests@4.Invoke(Unit _arg1)
   bei Expecto.Impl.execTestAsync@924-1.Invoke(Unit unitVar)
   bei Microsoft.FSharp.Control.AsyncPrimitives.CallThenInvoke[T,TResult](AsyncActivation`1 ctxt, TResult result1, FSharpFunc`2 part2)
   bei <StartupCode$FSharp-Core>.$Async.StartChild@1641-5.Invoke(AsyncActivation`1 ctxt)
   bei Microsoft.FSharp.Control.Trampoline.Execute(FSharpFunc`2 firstAction)
 <Expecto>
[10:23:35 INF] EXPECTO! 1 tests run in 00:00:00.3093376 for Failing test - 0 passed, 0 ignored, 1 failed, 0 errored.  <Expecto>

I created a Gist with the demo program here: https://gist.github.com/inosik/0c25edb03538cebc1037510ed930d7ea

AnthonyLloyd commented 5 years ago

Thank you for this. I'll take a look.

AnthonyLloyd commented 5 years ago

fix released in 8.6.5, thanks.