nathanboktae / mocha-casperjs

Write CasperJS tests using Mocha
MIT License
120 stars 30 forks source link

watching #65

Closed szkrd closed 9 years ago

szkrd commented 9 years ago

Is it possible to watch for file changes? Starting up the whole process from zero (via a gulp watcher for example) seems to be a bit counterproductive.

nathanboktae commented 9 years ago

Where would you expect mocha-casperjs to restart from if a file is reloaded? Rerun all the tests?

This is really tricky if it's feasible at all.... phantomjs would have to hot reload the modules. casperjs would have to reset it's state. a new mocha object would have to be created. It would create so many edge cases for this and your tests I doubt it would be worth it.

szkrd commented 9 years ago

I see, thank you. So far I'm using gulp watch and that seems to be okayish.

nathanboktae commented 9 years ago

I was honestly looking forward to see what you would want and expect specifically out of a better watcher. It is a desired feature for sure... Infeasability was of the top of my head... It would need a better look.

szkrd commented 9 years ago

My main problem with full relaunch is that it tends to be slow, brings back memories of rhino and envjs. Yes, I want all the tests rerun, like mocha -w does but if this is not in the scope that's just fine too.

nathanboktae commented 9 years ago

Yeah thinking about it a 3rd time, phantomjs has no watcher API, so it'd have to be external to phantomjs, which is about where you're at.

Are you on OS X? You can try unpacking the executable, then crafting your own fswatch command to rerun it pointing at mocha-casperjs with all it's args. though I've noticed the gulp watcher is much faster than fswatch .. maybe a special gulp task to relaunch the phantomjs unpacked executable?