lib/assert.js
function( time, callback ) {
		var self = this, timeid;

		// Can only delay an active module
		self.requireState( munit.ASSERT_STATE_ACTIVE, self.delay );

		// Time parameter is required
		if ( ! munit.isNumber( time ) ) {
			throw new munit.AssertionError( "Time parameter not passed to assert.delay", self.delay );
		}

		// Module has yet to complete the callback cycle,
		// Start async extension now
		if ( ! self.isAsync ) {
			self.isAsync = true;
			self.options.timeout = time;
			self._timerStart = Date.now();
			self._timeid = timeid = setTimeout(function(){
				if ( munit.isFunction( callback ) ) {
					callback( self );
				}

				if ( timeid === self._timeid && self.state < munit.ASSERT_STATE_TEARDOWN ) {
					self.close();
				}
			}, time );
		}
		// Only extend current timeout if it is less then requested delay
		else if ( ( self._timerStart + self.options.timeout ) < ( Date.now() + time ) ) {
			if ( self._timeid ) {
				self._timeid = clearTimeout( self._timeid );
			}

			self.isAsync = true;
			self._timerStart = Date.now();
			self._timeid = timeid = setTimeout(function(){
				if ( munit.isFunction( callback ) ) {
					callback( self );
				}

				if ( timeid === self._timeid && self.state < munit.ASSERT_STATE_TEARDOWN ) {
					self.close();
				}
			}, time );
		}
		// Force block any delay that does not extend longer than current timeout
		else {
			throw new munit.AssertionError( "delay time doesn't extend further than the current timeout", self.delay );
		}
	}
function( time, callback ) {
		var self = this, timeid;

		// Can only delay an active module
		self.requireState( munit.ASSERT_STATE_ACTIVE, self.delay );

		// Time parameter is required
		if ( ! munit.isNumber( time ) ) {
			throw new munit.AssertionError( "Time parameter not passed to assert.delay", self.delay );
		}

		// Module has yet to complete the callback cycle,
		// Start async extension now
		if ( ! self.isAsync ) {
			self.isAsync = true;
			self.options.timeout = time;
			self._timerStart = Date.now();
			self._timeid = timeid = setTimeout(function(){
				if ( munit.isFunction( callback ) ) {
					callback( self );
				}

				if ( timeid === self._timeid && self.state < munit.ASSERT_STATE_TEARDOWN ) {
					self.close();
				}
			}, time );
		}
		// Only extend current timeout if it is less then requested delay
		else if ( ( self._timerStart + self.options.timeout ) < ( Date.now() + time ) ) {
			if ( self._timeid ) {
				self._timeid = clearTimeout( self._timeid );
			}

			self.isAsync = true;
			self._timerStart = Date.now();
			self._timeid = timeid = setTimeout(function(){
				if ( munit.isFunction( callback ) ) {
					callback( self );
				}

				if ( timeid === self._timeid && self.state < munit.ASSERT_STATE_TEARDOWN ) {
					self.close();
				}
			}, time );
		}
		// Force block any delay that does not extend longer than current timeout
		else {
			throw new munit.AssertionError( "delay time doesn't extend further than the current timeout", self.delay );
		}
	}
function ( time , callback ) { var self = this , timeid ; // Can only delay an active module self . requireState ( munit . ASSERT_STATE_ACTIVE , self . delay ) ; // Time parameter is required if ( ! munit . isNumber ( time ) ) { throw new munit . AssertionError ( "Time parameter not passed to assert.delay" , self . delay ) ; } // Module has yet to complete the callback cycle, // Start async extension now if ( ! self . isAsync ) { self . isAsync = true ; self . options . timeout = time ; self . _timerStart = Date . now ( ) ; self . _timeid = timeid = setTimeout ( function ( ) { if ( munit . isFunction ( callback ) ) { callback ( self ) ; } if ( timeid === self . _timeid && self . state < munit . ASSERT_STATE_TEARDOWN ) { self . close ( ) ; } } , time ) ; } // Only extend current timeout if it is less then requested delay else if ( ( self . _timerStart + self . options . timeout ) < ( Date . now ( ) + time ) ) { if ( self . _timeid ) { self . _timeid = clearTimeout ( self . _timeid ) ; } self . isAsync = true ; self . _timerStart = Date . now ( ) ; self . _timeid = timeid = setTimeout ( function ( ) { if ( munit . isFunction ( callback ) ) { callback ( self ) ; } if ( timeid === self . _timeid && self . state < munit . ASSERT_STATE_TEARDOWN ) { self . close ( ) ; } } , time ) ; } // Force block any delay that does not extend longer than current timeout else { throw new munit . AssertionError ( "delay time doesn't extend further than the current timeout" , self . delay ) ; } }
Makes module asynchronous
Makes module asynchronous