lambdaisland / kaocha-cljs

ClojureScript support for Kaocha
Eclipse Public License 1.0
40 stars 10 forks source link

Add support for source maps #30

Open eerohele opened 4 years ago

eerohele commented 4 years ago

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.

alysbrooks commented 1 year ago

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.

humorless commented 1 year ago

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"}}}
plexus commented 1 year ago

That's using shadow's test runner, not kaocha.

humorless commented 1 year ago

I did a little bit more research on this topic, and I found a npm library seems related. source-map-support

lambduhh commented 5 months ago

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.