diff --git a/lib/nodeunit.js b/lib/nodeunit.js index df267910..47ffd823 100644 --- a/lib/nodeunit.js +++ b/lib/nodeunit.js @@ -559,10 +559,11 @@ var reporter = {}; //// exported async module functions //// - //// nextTick implementation with browser-compatible fallback //// + //// nextTick implementation with browser and rhino-compatible fallbacks //// async.nextTick = function(fn){ if(typeof process == 'undefined' || !(process.nextTick)){ - setTimeout(fn, 0); + if (typeof window !== 'undefined' && window.setTimeout) setTimeout(fn, 0); + else fn(); } else process.nextTick(fn); }; @@ -1747,7 +1748,7 @@ exports.run = function (modules, options) { ' assertions (' + assertions.duration + 'ms)'; } if (typeof document === 'undefined' && typeof print !== 'undefined') { - return print( html.replace(/