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

Duo Zheng

  • Username: duoduo
  • Joined: Thu Feb 03, 2011 9:03 am
  • Posts: 2
  • GitHub: duoduo
  • Gists: duoduo
  • Offline
  • Profile
Tags:
  • github

inc/inject.js YETI subscribers

Post Posted: Wed Feb 09, 2011 12:37 pm
I am digging into inject.js and I notice on that there are TestRunner subscribers at the end (@see https://github.com/yui/yeti/blob/fa7721 ... ct.js#L117)

I understand this is for the heartbeat function, but are the tests not completed by the time inject.js arrives?

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
Tags:
  • github

Re: inc/inject.js YETI subscribers

Post Posted: Wed Feb 09, 2011 2:04 pm
That's right, the tests are not yet completed by the time inject.js arrives. Typically, they haven't even started yet.

The attachReporter function attaches itself to "global" YUI Test Runner events that apply to all tests under that runner.

As soon as that code runs, the timeout counter is reset every time heartbeat is called (for any test activity). For example, if no tests were on the page, the timeout would eventually activate and a new test would load.

This is similar to how Mozilla's TestSwarm does things: https://github.com/jeresig/testswarm/bl ... /inject.js

Let me know if you need more explanation there.

Duo Zheng

  • Username: duoduo
  • Joined: Thu Feb 03, 2011 9:03 am
  • Posts: 2
  • GitHub: duoduo
  • Gists: duoduo
  • Offline
  • Profile
Tags:
  • yuitest

Re: inc/inject.js YETI subscribers

Post Posted: Wed Feb 09, 2011 2:26 pm
I originally meant the opposite actually. The tests *should* have been completely already when inject.js arrives as inject.js was "injected" after the closing </html> tag, but I just ran a quick test and it shows that YUITest executes after inject.js. What state is YUITest waiting for before it runs? Is it guaranteed to always run after inject.js?

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
Tags:
  • yuitest

Re: inc/inject.js YETI subscribers

Post Posted: Wed Feb 09, 2011 4:36 pm
Yup, YUITest runs after.

For example, in YUI 3 tests, YUITest isn't available yet since it's still waiting for the test module to load. Earlier in the inject.js, you'll notice we poll for YUITest to become available:

Code:
    // poll for Y.Test
    if (!YTest) return w.setTimeout($yetify, 50);
  [ 4 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