Forwarding this 3-year-old message because I ran into the same issue today.
How do I include npm dependencies specified in package.json for Figwheel auto-testing?
Edit: See the thread for the solution, approved by Figwheelโs author.
My current solution is to use
clj -m figwheel.main -co test.cljs.edn -m <test-runner-ns-here>
instead of
clj -m figwheel.main --build test.
My test.cljs.edn file is simply
^{:auto-bundle :webpack}
{:main <test-runner-ns-here>
:optimizations :none}That looks good to me!
figwheel-main 0.2.21-SNAPSHOT has been released and it MAY? address headless tests not starting.
When it comes to testing in general. We need to probably encourage folks to use a different port number so that the tests aren't able to interact with dev environments. I.E. { :ring-server-options {:port 9501}} Also don't want tests to hang bc the port is already taken etc.
figwheel-main 0.2.21-SNAPSHOT has been released and it MAY? address headless tests not starting.Testing now.
We should be setting :connect-url yes?
Running 0.2.21-SNAPSHOT locally I get the following error when running figwheel:
Execution error (ArityException) at figwheel.repl/run-default-server* (repl.cljc:1143).
Wrong number of args (2) passed to: figwheel.repl/abstract-websocket-connection
my cljs.edn looks like this:
^{:auto-bundle :webpack
:ring-server-options {:port 9504}
:connect-url "http://[[config-hostname]]:[[server-port]]/figwheel-connect"}
{:main app.test-runner-ci
:infer-externs true
:output-dir "target/public/cljs-out"
:output-to "target/public/cljs-out/main.js"
:closure-defines {goog/DEBUG false
watchful.web.core/env "production"}}
and my deps.edn alias
{:main-opts ["--main" "figwheel.main"
"--compile-opts" "test.headless.cljs.edn"
"--fw-opts" "{:launch-js [\"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome\" \"--headless\" \"--remote-debugging-port=9222\" :open-url]}"
"--main" "app.test-runner-ci"]}@tkjone Thanks for testing it out. It seems I didn't check in some changes... fixing now
@tkjone OK deploying changes now, it might take a minute for the changes to show up
Picked up the changes and rerunning tests
I'm still seeing failure to run in CI with chrome. I'm going to investigate a few more things.
Is there a way I can confirm that figwheel is using the connect-url I provided?
I'm sure it's picking it up.
Actually, so the assumption is that your --fw-opts are getting merged with the cljs.edn figwheel opts. Add
:pprint-config true
to your -fw-opts and it will not run the tests and it will print out the merged and updated optionsI'd love to know if the headless tests work locally outside of CI
Yep, they work outside of CI ๐
It's only the CI tests i'm fighting with