Olical / cljs-test-runner

Discover and run your ClojureScript tests
https://clojars.org/olical/cljs-test-runner
The Unlicense
86 stars 16 forks source link

Fix test running with something other than :none optmisations #17

Closed Olical closed 6 years ago

Olical commented 6 years ago

Yes, "optimisations" not "optimizations"

Glares in British :gb:

Olical commented 6 years ago

This is for fixing #16, I hope I can find a solution. When you run with :advanced (or anything that isn't :none) you currently get No file for namespace gen.test-runner exists.

So clearly the namespace resolution is totally different as soon as you enable optimisations. My hunch is that the generated .cljs file needs to be in a specific path. Maybe it needs to be on the PATH?

Olical commented 6 years ago

So, progress. If you want to use any optimisation level other than :none you must:

This should be enough to get it to run but it seems like it only works the first time. On the second run it complains about not being able to find the test namespaces which is pretty weird. Using advanced compilation seems to change a lot about the build cycle, maybe we can't get around this?

Maybe since this is sort of an edge case these caveats are okay and they just need documenting? If you ran rm -rf cljs-test-runner-out && mkdir cljs-test-runner-out before each run I think it'd work fine on this branch.

Care to try it out, @henryw374?

henryw374 commented 6 years ago

Hi, thanks for looking into this.

with whitespace Optimization, nothing gets compiled or run.

With simple and advanced , things now get compiled, but then there is an error where a foreign lib does not appear to have been loaded.... yet to work out why.

On Fri, Oct 19, 2018 at 6:57 PM Oliver Caldwell notifications@github.com wrote:

So, progress. If you want to use any optimisation level other than :none you must:

  • Add cljs-test-runner-out to your path so the compiler can find the gen.test-runner namespace.
  • Ensure that the cljs-test-runner-out directory exists before running the program otherwise I think the JVM drops the path from the path list.

This should be enough to get it to run but it seems like it only works the first time. On the second run it complains about not being able to find the test namespaces which is pretty weird. Using advanced compilation seems to change a lot about the build cycle, maybe we can't get around this?

Maybe since this is sort of an edge case these caveats are okay and they just need documenting? If you ran rm -rf cljs-test-runner-out && mkdir cljs-test-runner-out before each run I think it'd work fine on this branch.

Care to try it out, @henryw374 https://github.com/henryw374?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Olical/cljs-test-runner/pull/17#issuecomment-431446975, or mute the thread https://github.com/notifications/unsubscribe-auth/AC7ZDO7VvM05jRb0eTTukLf2agkDnE-Mks5umhKhgaJpZM4Xw3Ep .

-- @henryw374

Olical commented 6 years ago

Have you added all of the externs? I can take another look, I had this working fine for me with advanced, make sure your test ClojureScript / JS actually compiles properly with advanced. Try rm -rf cljs-test-runner-out; mkdir -p cljs-test-runner-out/gen too.

Olical commented 6 years ago

In my test harness, :none, :simple and :advanced work fine. Whitespace errors but the error is suppressed so I'll need to have a look at it when running from the REPL. (also need to get errors printing when run from the CLI!)

I haven't tried with any foreign libs though...