jquery/qunit — pull request #433 by qxjit (2013-03-25 12:34:59+00:00)
Title: Fixes #432 - Using a setTimeout stub can stop test suite from continuing

If you replace the global setTimeout function with a stub (like sinon's useFakeTimers), it can permanently stop the test suite.

When QUnit stops processing the queue to let the browser update, it calls the global setTimeout to schedule the next block of queue processing. If you are unlucky the test currently running may have stubbed setTimeout and its teardown step could still be on queue waiting to run. In this case, QUnit will end up using the stubbed setTimeout instead of the real one, and the entire test suite will stop running.

This change fixes the problem by capturing window.setTimeout when QUnit is loaded and using the captured version rather than referring to window.setTimeout for each call.