figwheel-main

Nguyen Hoai Nam 2025-02-10T03:40:21.397999Z

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.

Nguyen Hoai Nam 2025-02-10T05:50:43.367609Z

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}

bhauman 2025-02-10T16:16:53.428409Z

That looks good to me!

1
bhauman 2025-02-10T16:21:55.010199Z

figwheel-main 0.2.21-SNAPSHOT has been released and it MAY? address headless tests not starting.

bhauman 2025-02-10T16:24:15.841949Z

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.

athomasoriginal 2025-02-10T16:48:59.488769Z

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?

athomasoriginal 2025-02-10T16:58:41.265139Z

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"]}

bhauman 2025-02-10T17:16:31.732989Z

@tkjone Thanks for testing it out. It seems I didn't check in some changes... fixing now

๐Ÿ‘ 1
bhauman 2025-02-10T17:26:36.272039Z

@tkjone OK deploying changes now, it might take a minute for the changes to show up

๐Ÿ‘ 1
athomasoriginal 2025-02-10T18:01:25.780659Z

Picked up the changes and rerunning tests

athomasoriginal 2025-02-10T18:16:45.791709Z

I'm still seeing failure to run in CI with chrome. I'm going to investigate a few more things.

athomasoriginal 2025-02-10T18:36:05.584009Z

Is there a way I can confirm that figwheel is using the connect-url I provided?

bhauman 2025-02-10T21:11:47.497109Z

I'm sure it's picking it up.

bhauman 2025-02-10T21:16:31.598959Z

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 options

bhauman 2025-02-10T21:23:11.874319Z

I'd love to know if the headless tests work locally outside of CI

athomasoriginal 2025-02-10T21:54:30.514019Z

Yep, they work outside of CI ๐Ÿ™‚

athomasoriginal 2025-02-10T21:54:53.459219Z

It's only the CI tests i'm fighting with