Fork me on GitHub
Adam Helins17:10:53

When async tests fail, testing messages are not printed. Is that expected, is there any solution? Unsure whether it is about shadow or CLJS itself.


it seems the testing stuff is done in a try/finally which kind of assumes sync testing probably


no clue. if you setup an example showing it working with regular CLJS I will investigate 😛


instead it could maybe done using the test blocks thing with functions that are picked up from the queue


don't think I ever used testing once 😛


Cljs.test generally has poor support for async


Which is unfortunate, given that almost everything interesting in JS is asynchronous

Adam Helins17:10:42

Oh yeah, it seems to be implemented in a try-catch so it wouldn't work in an async setup. Which is a tad weird since async examples do use testing:

Adam Helins17:10:09

That's why I thought there might be something off with Shadow's test runner


FWIW this is one reason why I'm switching to Jest (cljs.test has a weak design and is effectively maintained)


I added selective test running once to cljs.test and it required monkey patching


that really has little to do with cljs.test. :node-test can do selective test runs just fine


been meaning to implement it for :browser-test just never got around to it


cljs.test isn't great overall I'd agree on that but the basics are fine. All the macros really are the problem


shadow.test fixes that and beyond that there is just some UI that needs to be written to get the fancy stuff


Yes we're using shadow.test for that now, much better than my macguyver solution


I think the testing stuff can be made to work with async tests


someone needs to make an issue about it, probably after chatting in #cljs-dev


first actually verify. it might absolutely be shadow


ok, I can see from the code already that this isn't going to work async, but here is a repro:

$ plk
ClojureScript 1.10.597
cljs.user=> (require '[clojure.test :as t])
cljs.user=> (t/deftest foobar (t/async done (t/testing "dude" (js/setTimeout (fn [] (t/is (= 3 4)) (done)) 1000))))
cljs.user=> (foobar)

FAIL in (foobar) (:)
expected: (= 3 4)
  actual: (not (= 3 4))
cljs.user=> (t/deftest foobar (t/testing "dude" (t/is (= 3 4))))
cljs.user=> (foobar)

FAIL in (foobar) (file:44:173)
expected: (= 3 4)
  actual: (not (= 3 4))


the try/finally just isn't going to work with async, the finally block is of course executed too early

Adam Helins20:10:38

Yep, same conclusion!


What you can of course do is move the testing into the callback, but then it won't nest properly


When using the Inspect Stream window, is there a way to get the path to the current object within its context?


@alex.sheluchin no, not that simple. it'll use datafy/nav so constructing a "path" may not always be that reliable. also the UI navigates by index so it never knows actual path values


Thanks @U05224H0W. Not so complicated to figure out the path manually. Was just wondering if there was a shortcut.


Hey I tried to bump to version 2.15.11 from 2.15.10 and my project and tests started to throwing this

Chrome Headless 94.0.4606.0 (Linux x86_64) WARN: 'shadow-cljs - failed to load', 'module$node_modules$react_markdown$lib$react_markdown'

Chrome Headless 94.0.4606.0 (Linux x86_64) WARN: 'shadow-cljs - failed to load', 'module$node_modules$react_markdown$index'

Chrome Headless 94.0.4606.0 (Linux x86_64) ERROR
  Uncaught ReferenceError: babelHelpers is not defined
  at ci.js:116796:9
  ReferenceError: babelHelpers is not defined
      at Object.shadow$provide.module$node_modules$react_markdown$lib$react_markdown (ci.js:188082:442)
      at shadow.js.jsRequire (ci.js:116793:18)
      at Object.shadow$provide.module$node_modules$react_markdown$index (ci.js:188088:300)
      at Object.shadow.js.jsRequire (ci.js:116793:18)
      at Object.shadow.js.require (ci.js:116818:20)
      at ci.js:188249:56 
Is there anything new I need to do in the new version? This only happens after I bump to the new version and delete the folder .shadow-cljs


@rafaeldelboni oops, should be fixed in 2.15.12. there was some compiled code from a branch in that release that shouldn't have been.


Thanks for your fast reply! :)


continuous delivery ftw!

Chris McCormick23:10:01

Is deps.edn the only way to pull in a dependency from a git repository when using shadow-cljs at the moment? Or is there a way to specify git deps in shadow-cljs.edn?

Ryan Jerue01:10:15

If you're on lein, there's I also don't think there's anything stopping sometime from putting it in a package json and adding it to to your paths. Not very elegant, but could work.