VSCode Debugger: Pause on failed test

What’s the most convenient way to have the debugger pause upon hitting a failed @test?

I assume I could set a breakpoint on some function in the Test package, but figuring out (and remembering) which is the appropriate function seems a bit tedious. Is there an easier way?

MWE:

@test true   # Don't pause
@test false  # Pause and allow me to investigate why the test failed

It seems an easy way to get what I want is to replace @test with @assert and enable the “All exceptions” option in the Debugger pane.

Alternatively, I imagine it must be possible to set a conditional breakpoint on the @test line where I copy-paste the test as the break condition.

You could submit a PR adding more states (& accompanying logic) to break_on:
https://github.com/JuliaDebug/JuliaInterpreter.jl/blob/8df3bef5991ccb83f8dfdedc76ddc74744b8ca31/src/breakpoints.jl#L328-L347

1 Like