Add support for source maps
Currently, if a test throws an exception, every line of the stack trace refers to a .js file. It would be more useful if stack traces referred to the original ClojureScript files instead.
I think this is a consequence of our use of the REPL to execute code, but I'm not sure. There may not be any sort of out of the box solution and we may have to manually "fix" the stack traces using the source map to point to the actual source.
Tried to run the shadow-browser example in here with the config that enable source map, and found that with shadow-cljs.edn like below, and I can see the exception with correct cljs line number in browser's console.
{:source-paths ["src" "test"]
:dependencies []
:dev-http {8000 "out"}
:builds
{:main
{:target :browser
:modules {:main {:entries [basic-shadow.main]}}}
:test
{:optimizations :none
:source-map true
:target :browser-test
:test-dir "out"}}}
That's using shadow's test runner, not kaocha.
I did a little bit more research on this topic, and I found a npm library seems related. source-map-support
Adding as a "feature request" but marking as a low priority since shadow test runner provides a workaround for a user who wants a .cljs stack trace.