Posting in these forums is disabled. These forums will be available for archive purposes. Please join the new forums at the links below:
|Page 1 of 1||[ 3 posts ]|
I've been playing around with Yeti for a while trying to get it to work with Mocha & RequireJS using a this test runner.
Occasionally it works, but mostly it doesn't. I've suspected the problem has been that because Yeti trigger's on 'domready' which can fire before Require has finished loading everything. http://requirejs.org/docs/api.html#pageload supports that theory. What seems to happen when things go wrong is that on 'domready', Yeti calls mocha.run() and then when require has finished my code calls mocha.run() again. The image below seems to confirm this too:
Last night I was playing around with Karma and followed the instructions to get things running in Karma with Require and I got things to work with this config. Again, this seems to confirm my theory because there is an explicit call to __karma__.start().
I'm not super happy with the approach I had to take to get Karma to run and I'd like to use Yeti because it should support running my HTML test runner page directly meaning I have only 1 place to tweak my tests.
All of the above is a long way of saying that I had played around with the idea of requiring an explicit call to $yetify.run() - I held off on making a pull request to the official project for a couple of reasons:
1. My diff had some noise because of different spacing/formatting
2. I wasn't 100% sure of the approach (i.e. implicitly deciding to require an explict call to $yetify.run())
What do folks think of the idea?
An alternative idea, inspired by jQuery's holdReady method (which delays the ready/domready) is to provide two methods on $yetify, i.e.
$yetify.wait(); // or delay, pause, hold, etc.
so an explicit call to wait would prevent the implicit running of the tests.
Or it's probably possibly to throttle mocha.run(), but at this stage I'm in favour of doing things a little more explicitly until I can prove my theory.
I appreciate any thoughts & discussion on this and would like to know if people have had similar experiences.
Just to clarify, I'm suggesting that if someone calls
only then is an explicit call to
required, otherwise $yetify.run happens on 'domready'
Thanks so much for your thoughtful post. I'm terribly sorry that I have not responded to this post sooner. Please accept my apologies.
I'm pretty new to Mocha, but I think that Yeti should *not* be responsible for calling `mocha.run()` if that invocation would begin the testing process. For other frameworks e.g. YUI Test, Yeti does not cause the testing system to start, it simply hooks into the system and requires the implementer to start testing.
I'll look into the possibility of having Yeti not make any function calls that would begin testing prematurely for Mocha.
|Page 1 of 1||[ 3 posts ]|
|You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum