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

keep the JS environment alive in watch-mode #86

Open magomimmo opened 8 years ago

magomimmo commented 8 years ago

Hi @bensu I'm using your doo lib via the great test-cljs lib by @crisptrutski (with phantomjs at the moment). Even if I'm not a TDD practitioner, there are few of them working in my company that would refuse any small test cycle that take more than a second to complete. I recently read this post about reducing phantomjs start-up time between tests cycles in watch-mode by simply not destroying the phantomjs' instance created at launch time.

Is that something that make sense in doo context?

Thanks so much for your very appreciated work

bensu commented 8 years ago

Hi @magomimmo

If the delay is big it does make sense and in fact that strategy is implemented for Karma. Since Karma has a PhantomJS runner we could try to replicate the functionality through Karma, or follow something similar to the post. The strategy implemented in the post is somewhat dirty and could lead to all sorts of issues, so I would try to avoid it.

I'll check if a :karma-phantom option reduces the cycle time significantly and keep you posted.

magomimmo commented 8 years ago

Thanks @bensu I'll take a look to karma as well.

atroche commented 8 years ago

Could a similar strategy work for nashorn?

bensu commented 8 years ago

Hi @atroche

The strategy is to keep the environment alive and clean it between tests. For Phantom and the browsers we could piggieback on Karma but not for Nashorn since there is no karma-nashorn-runner. If there is a way to keep Nashorn alive and clean the state it might be viable, but we would need to implement it.

bensu commented 8 years ago

Hi @magomimmo,

I tried to use Phantom and Slimer throught Karma and succeeded for lein doo karma-phantom test once but it fails in auto mode. I don't have time to research this further but if you are interested, the work is in this branch.

Feel free to reopen this issue if you are willing to work on it, or if you desperately need this feature.

[UPDATE]: After researching this further, I made it work and we can now keep both Slimer and Phantom alive when using Karma

bensu commented 8 years ago

Hi @magomimmo,

Karma Slimer and Karma Phantom are now in master. Do you mind trying them out? For example:

lein doo karma-phantom test auto