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

Skipping results in an exception report #313

Closed et1975 closed 5 years ago

et1975 commented 5 years ago

Using 8.10.0 and skipping a task test:

[14:23:10 ERR] [snip] errored in 00:00:00.0020000 Expecto.IgnoreException: skipped at [snip] at FSharp.Control.Tasks.TaskBuilder.run[a](FSharpFunc`2 firstStep) in C:\Users\humbo\source\repos\TaskBuilder.fs\TaskBuilder.fs:line 226

AnthonyLloyd commented 5 years ago

Sorry, I can't reproduce. Can you give more details or an example.

Ah sorry I missed task test, will check.

No sorry, I can ptestTask in the Expecto tests. Do you have a small example?

et1975 commented 5 years ago

I have this: let noop = task { Tests.skiptest "skipped" } which used to work as expected in 8.6.0, now it seems to fall through. It's used to conditionally skip tests and invoked via something like this:

testTask name {
        let task = mkTask arg // <-- this is where the noop task would end up
        let! r = Task.WhenAny(task, Task.Delay timeoutMs)
        if task :> Task <> r then Tests.failtestNoStack "timed out"
        return! task
    }
AnthonyLloyd commented 5 years ago

I'm not sure what changed but the ignore ends up in an AggregateExpception and then isn't considered as an ignore.

Easy enough to put in a check.