bensu / doo

doo is a library and lein plugin to run cljs.test on different js environments.
Eclipse Public License 1.0
324 stars 63 forks source link

goog/deps.js and cljs_deps.js not found due to matchers #152

Closed vemv closed 6 years ago

vemv commented 6 years ago

Hi!

I'm getting this in karma-chrome and karma-chrome-headless:

06 10 2017 14:47:09.920:WARN [watcher]: All files matched by "/Users/vemv/gpm/src/horizon/resources/test/out/**/*.js" were excluded or matched by prior matchers.
06 10 2017 14:47:09.923:WARN [watcher]: All files matched by "/Users/vemv/gpm/src/horizon/resources/test/out/*.js" were excluded or matched by prior matchers.
06 10 2017 14:47:11.911:WARN [web-server]: 404: /resources/test/out/goog/deps.js
06 10 2017 14:47:11.920:WARN [web-server]: 404: /resources/test/out/cljs_deps.js

My app is loaded and some code loads/runs fine, but what I get is an incomplete version of my app, due to these 404s surely.

I don't know what a "matcher" is. I don't think I'm setting any specific config.

I'd say one has to include /test/out/**/*.js, how to achieve that?

Cheers - Victor

vemv commented 6 years ago

Guessing this has something to do with the TODO in karma.clj, or the code in that ns in general.

Seems a bit fragile unfortunately!

bensu commented 6 years ago

Hi @vemv,

Thanks for the report! Can you please give us a minimal project that reproduces the error?

vemv commented 6 years ago

Will do!

miikka commented 6 years ago

Hi! The matcher warnings are harmless and they aren't related to the 404 messages.

I'm not 100% sure if your problems are caused by the 404 messages, but I know how to fix them. Karma's built-in web server serves the assets under the directory /base/. You have to set :asset-path for your ClojureScript build accordingly. It's value should be approximately base/ + :output-dir. For example, the :none-test build in doo's example project has the same problem and it goes away by setting :asset-path to base/out.

Could you try this and see if it helps?

Ideally doo would take care of this automatically, either by setting :asset-path or by configuring Karma so that it's not needed. As far as I know, Karma's directory for serving the files is not configurable.


Regarding the matchers: having three overlapping patterns in the Karma config triggers the warning messages. Probably having only /** would be enough.

miikka commented 6 years ago

Okay, I poked around more and looks like the 404 warnings are harmless as well. When using :none optimizations, ClojureScript generates a shim file that points to wrong URLs if :asset-path is not properly set, but doo already takes care of this and loads those files from the right URLs.

vemv commented 6 years ago

Hey there! I was hesitating on creating a repro since some setup code is not my property.

Anyway, I could fix the issue with these cljsbuild options (just like you suggested)

:compiler {:asset-path "base/resources/test/out"
                  :output-dir "resources/test/out"
                  :output-to "resources/test/test.js"}

The magic is in the base:

By default all assets are served at http://localhost:[PORT]/base/.

http://karma-runner.github.io/1.0/config/files.html

The 404 warnings indeed don't matter much.

Cheers - Victor