Provide accurate filenames and line numbers in cljs.test

Description

cljs.test is mostly a direct translation of clojure.test. Both of these rely on a function (do-report) to add file and line number information to messages sent to the reporting function. do-report relies on inspecting the call stack to find this information, using a simple heuristic to find the corresponding stack frame, which does not work on all platforms, and in any case can only infer information about the compiled JavaScript, not about the original ClojureScript.

Instead the attached patch uses metadata that is accessible when these assertion macros are expanded to provide accurate file and line numbers. To do this it bypasses do-report, calling report directly.

Many thanks to Thomas Heller for coming up with the patch.

Environment

None

Activity

Show:
David Nolen
May 13, 2020, 2:01 PM

I like it, would be nice to see the results of CI here w/ the patch applied. I wonder if there’s a good way to test this?

Mike Fikes
May 13, 2020, 2:08 PM
Edited

Travis

Details

AppVeyor

Details

Canary

Details

David Nolen
May 19, 2020, 10:07 PM

Assignee

David Nolen

Reporter

Arne Brasseur

Labels

None

Approval

Triaged

Patch

None

Priority

Blocker
Configure