hi everyone! I'm running devcards as an extra-main using figwheel main. The entrypoint seems to be imported fine and devcard ui is showing, but none of my cards are being shown. Anyone have any clue what might be going wrong?
Have you done a require of your test namespaces in your runner?
It doesn't automagically find them like the auto testing runner does, in my experience
yes, I've done a require. It seems like the macro is not getting expanded into a card/is being removed
ok, figured it out. The figwheel extra-main-files gave me the impression that the map for an extra entry would get merged with the settings for the main entry. So I thought I could do this:
^{:watch-dirs ["src" "env/dev" "cards" "test"]
:auto-bundle :webpack
:final-output-to "resources/public/js/app.js"
:clean-outputs true
:extra-main-files
{:devcards {:main frontend.devcards-runner
:devcards true}}}
{:main frontend.main
:output-dir "resources/public/js/app"
:output-wrapper true}
which apparently you can't. If I specify the :devcards true
setting in the main map it works@adriaan.callaerts oh that’s tricky
but its true
its in the docs
maybe I need to raise it to the top in a tdlr section
Also I’m hoping to have a :auto-devcards figwheel option soon
Another thing that I noticed using it with figwheel main is that I kinda have to do something hacky to get it to play nice with the generated entrypoint. I wanted to achieve a similar effect as the auto-testing, in which the UI of the testing/devcards report overrides/replaces the dummy output of the extra-main html. To achieve that with devcards, I resorted to doing something like this:
(ns fleet-frontend.devcards-runner
(:require [devcards.core]
[devcards.system :refer [devcards-app-element-id get-element-by-id]]
[frontend.cards]))
(defonce init
(do
(enable-console-print!)
(println "Devcards are ON")
(set! (. (get-element-by-id "app-devcards") -id) devcards-app-element-id)
(devcards.core/start-devcard-ui!)))
yeah you are better off creating a landing html page that requires the devcards-runner.main.js
how does figwheel achieve that effect with the testing report? I'm guessing it overrides the goog-define for the root element id that's used there?
it uses the app element that is already there I think
hmmm wait
wouldn't the app element be called app-auto-testing?
yeah your right
so I'm guessing figwheel does some magic to "set" this https://github.com/bhauman/cljs-test-display/blob/master/src/cljs_test_display/core.cljs#L25 to use the alternative mount point, as opposed to devcard which has it hardcoded here https://github.com/bhauman/devcards/blob/master/src/devcards/system.cljs#L23
yeah a closure define can set that
https://github.com/bhauman/figwheel-main/blob/master/src/figwheel/main/testing.cljc#L253
there it is