lib/assert.js
function( startFunc, forced ) {
		var self = this, i, mod;

		// Handle invalid number of tests ran
		if ( self.options.expect > 0 && self.count < self.options.expect && munit.render.focusPath( self.nsPath ) ) {
			self._fail(
				'[munit] Unexpected End',
				startFunc || self._close,
				'Expecting ' + self.options.expect + ' tests, only ' + self.count + ' ran.'
			);
		}
		else if ( self.count < 1 && self.callback && munit.render.focusPath( self.nsPath ) ) {
			self._fail(
				"[munit] No Tests Found",
				startFunc || self._close,
				"Module closed without any tests being ran."
			);
		}

		// Remove timer
		if ( self._timeid ) {
			self._timeid = clearTimeout( self._timeid );
		}

		// Meta
		self.end = Date.now();

		// Readd the queue back to the stack
		if ( self.options.autoQueue && self.queue ) {
			munit.queue.add( self.queue );
			self.queue = null;
		}

		// Check to see if submodules have closed off yet
		for ( i in self.ns ) {
			mod = self.ns[ i ];

			if ( mod.state < munit.ASSERT_STATE_CLOSED ) {
				// Force close them if needed
				if ( forced ) {
					mod.close( startFunc || self._close, forced );
				}
				else {
					return self;
				}
			}
		}

		// All submodules have closed off, can mark this one as finished
		return self.finish( startFunc, forced );
	}
function( startFunc, forced ) {
		var self = this, i, mod;

		// Handle invalid number of tests ran
		if ( self.options.expect > 0 && self.count < self.options.expect && munit.render.focusPath( self.nsPath ) ) {
			self._fail(
				'[munit] Unexpected End',
				startFunc || self._close,
				'Expecting ' + self.options.expect + ' tests, only ' + self.count + ' ran.'
			);
		}
		else if ( self.count < 1 && self.callback && munit.render.focusPath( self.nsPath ) ) {
			self._fail(
				"[munit] No Tests Found",
				startFunc || self._close,
				"Module closed without any tests being ran."
			);
		}

		// Remove timer
		if ( self._timeid ) {
			self._timeid = clearTimeout( self._timeid );
		}

		// Meta
		self.end = Date.now();

		// Readd the queue back to the stack
		if ( self.options.autoQueue && self.queue ) {
			munit.queue.add( self.queue );
			self.queue = null;
		}

		// Check to see if submodules have closed off yet
		for ( i in self.ns ) {
			mod = self.ns[ i ];

			if ( mod.state < munit.ASSERT_STATE_CLOSED ) {
				// Force close them if needed
				if ( forced ) {
					mod.close( startFunc || self._close, forced );
				}
				else {
					return self;
				}
			}
		}

		// All submodules have closed off, can mark this one as finished
		return self.finish( startFunc, forced );
	}
function ( startFunc , forced ) { var self = this , i , mod ; // Handle invalid number of tests ran if ( self . options . expect > 0 && self . count < self . options . expect && munit . render . focusPath ( self . nsPath ) ) { self . _fail ( '[munit] Unexpected End' , startFunc || self . _close , 'Expecting ' + self . options . expect + ' tests, only ' + self . count + ' ran.' ) ; } else if ( self . count < 1 && self . callback && munit . render . focusPath ( self . nsPath ) ) { self . _fail ( "[munit] No Tests Found" , startFunc || self . _close , "Module closed without any tests being ran." ) ; } // Remove timer if ( self . _timeid ) { self . _timeid = clearTimeout ( self . _timeid ) ; } // Meta self . end = Date . now ( ) ; // Readd the queue back to the stack if ( self . options . autoQueue && self . queue ) { munit . queue . add ( self . queue ) ; self . queue = null ; } // Check to see if submodules have closed off yet for ( i in self . ns ) { mod = self . ns [ i ] ; if ( mod . state < munit . ASSERT_STATE_CLOSED ) { // Force close them if needed if ( forced ) { mod . close ( startFunc || self . _close , forced ) ; } else { return self ; } } } // All submodules have closed off, can mark this one as finished return self . finish ( startFunc , forced ) ; }
Closing of module after teardown process
Closing of module after teardown process