Forums

Posting in these forums is disabled. These forums will be available for archive purposes. Please join the new forums at the links below:

  • yui-support - replaces the `YUI 3.x` and `YUI 3 Gallery` forums.
    We have created the following discussion categories within this group to aid discoverability for these most-used topics:
    • Charts for YUI Charts support.
    • DataTable for YUI DataTable support.
    • Gallery for YUI Gallery support, including support for published Gallery components as well as the Gallery process in general.
    • Tools for support of YUI’s suite of developer tools such as selleck, shifter, grover, yogi, etc.
    • Everything Else for questions that don’t fit one of the categories above, we’ve got you covered here.
  • yui-deprecated - replaces the `YUI 2.x` forum and the forums of other deprecated products (`YUI Doc`, `Builder`, `YUI PHP Loader`, etc.).
  [ 3 posts ]
New Topic | Post Reply | Print view
Previous topic | Next topic

Walter Rumsby

YUI Contributor

  • Username: wrumsby
  • Joined: Tue Feb 10, 2009 1:11 pm
  • Posts: 20
  • Location: Auckland, New Zealand
  • Twitter: wrumsby
  • GitHub: wrumsby
  • Gists: wrumsby
  • Offline
  • Profile
Tags:
  • docs
  • gist
  • github
  • io

Yeti and AMD Modules

Post Posted: Thu Jun 13, 2013 1:38 pm
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:

Image

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.
$yetify.run();

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.

Walter Rumsby

YUI Contributor

  • Username: wrumsby
  • Joined: Tue Feb 10, 2009 1:11 pm
  • Posts: 20
  • Location: Auckland, New Zealand
  • Twitter: wrumsby
  • GitHub: wrumsby
  • Gists: wrumsby
  • Offline
  • Profile

Re: Yeti and AMD Modules

Post Posted: Thu Jun 13, 2013 8:25 pm
Just to clarify, I'm suggesting that if someone calls

$yetify.wait()

only then is an explicit call to

$yetify.run()

required, otherwise $yetify.run happens on 'domready'

Reid Burke

YUI Developer

  • Username: reid
  • Joined: Mon May 11, 2009 1:02 pm
  • Posts: 28
  • Location: Sunnyvale, California
  • Twitter: reid
  • GitHub: reid
  • Gists: reid
  • IRC: reid
  • YUI Developer
  • Offline
  • Profile

Re: Yeti and AMD Modules

Post Posted: Tue Jul 09, 2013 1:45 pm
wrumsby,

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.
  [ 3 posts ]
New Topic | Post Reply | Print view
Previous topic | Next topic
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