crisptrutski / boot-cljs-test

Boot task to run ClojureScript tests.
53 stars 18 forks source link

Support Karma runner #35

Closed Deraen closed 7 years ago

Deraen commented 8 years ago

Doo run-script starts new Karma instance for each run. Using install! and karma-run! it is possible to only start one instance and run tests in that.

WIP code here: https://github.com/Deraen/boot-cljs-test/commit/e7493432f6c41224af6757707874de736de15ddb

Also fixes #31 by copying node_modules (and everything) to a single tmp-dir for Karma.

crisptrutski commented 8 years ago

LGTM :+1:

May want to copying node_modules even for non-karma case, as slimer for example is also most commonly installed in a similar fashion.

Maybe an option about creating the folder. This also allows opt-out if you're using karma (as I am) as a npm install -g dependency and this step is unnecessary.

Deraen commented 8 years ago

If you don't have node_modules folder, nothing get's copied.

As mentioned in commit body, this breaks Karma for running tests only once (without watch). And I think it doesn't correctly run tests on first run.

crisptrutski commented 8 years ago

Happy with the "having node_modules folder means we sync it" logic, but that stilly leaves using it with non-karma runners. How about removing all the karma checks and names around the tmp dir?

RE: breaking without watch perhaps @bensu has some insight? And the behaviour you're seeing with the first run, is that the same as with lein?

Also, your code is so similar I assume you saw it, but here's corresponding lein code just in case: https://github.com/bensu/doo/blob/master/plugin/src/leiningen/doo.clj#L225-L236

Deraen commented 8 years ago

Lein plugins calls just run-script when only running tests once. In case of Boot we don't really have any way to know if the task is being called with watch or without.

crisptrutski commented 8 years ago

How about treating the second run as the first "watch" run, to avoiding starting a server that's only used once. You won't care that there's a little bit of efficiency, with a watcher that'll get amortised :wink:

Deraen commented 8 years ago

Yeah, that's one way to workaround the problem.

bensu commented 8 years ago

@Deraen you are right: lein-doo doesn't run the tests the first time. There is #71 for that but I have not found the problem yet.

crisptrutski commented 7 years ago

Brought in small adaption of @Deraen's version into 0.3.0 branch