Exceptions thrown in tests outside assertions don't report *testing-contexts*

Description

If an exception is thrown within an assertion, Clojure helpfully supplies the testing context (from `testing`) to guide the developer to the problematic code. But if that exception is thrown outside an assertion, it only supplies the name of the test (from `deftest`), which is very vague.

In practice I often have situations like this minimal example:

Assuming that the `deftest` contains dozens of `testing` blocks with nesting beneath them, and the setup `let`s often 4-5 bindings, it can be quite tedious to trace the exact cause of the failure by digging through the stack trace.

I had a brief look at the code and believe that if clojure.test/test-var would report `testing-contexts` in this case, that would be a simple and cheap quality of life improvement for developers.

Environment

Tested on Clojure 1.10.1 and earlier

Status

Assignee

Unassigned

Reporter

Alex Miller

Labels

None

Approval

None

Patch

None

Priority

Major
Configure