main * 
@name rewiremock
@param {String|Function} module name
@return {ModuleMock}
438300
function mockModule(moduleName) {
    scope();
    if(typeof moduleName === 'function'){
      return onMockCreate(new ModuleMock(getAsyncMock(moduleName, parentModule)));
    } else {
      const name = convertName(moduleName, parentModule);
      resetMock(name);
      return onMockCreate(new ModuleMock(getMock(name)));
    }
}
996063
public static void runServer (Module... modules)
    {
        Injector injector = Guice.createInjector(modules);
        PresentsServer server = injector.getInstance(PresentsServer.class);
        try {
            // initialize the server
            server.init(injector);

            // check to see if we should load and invoke a test module before running the server
            String testmod = System.getProperty("test_module");
            if (testmod != null) {
                try {
                    log.info("Invoking test module", "mod", testmod);
                    Class<?> tmclass = Class.forName(testmod);
                    Runnable trun = (Runnable)tmclass.newInstance();
                    trun.run();
                } catch (Exception e) {
                    log.warning("Unable to invoke test module '" + testmod + "'.", e);
                }
            }

            // start the server to running (this method call won't return until the server is shut
            // down)
            server.run();

        } catch (Throwable t) {
            log.warning("Unable to initialize server.", t);
            System.exit(-1);
        }
    }
806674
function( name, testEnvironment ) {
		var currentModule = {
			name: name,
			testEnvironment: testEnvironment,
			tests: []
		};

		// DEPRECATED: handles setup/teardown functions,
		// beforeEach and afterEach should be used instead
		if ( testEnvironment && testEnvironment.setup ) {
			testEnvironment.beforeEach = testEnvironment.setup;
			delete testEnvironment.setup;
		}
		if ( testEnvironment && testEnvironment.teardown ) {
			testEnvironment.afterEach = testEnvironment.teardown;
			delete testEnvironment.teardown;
		}

		config.modules.push( currentModule );
		config.currentModule = currentModule;
	}
426749
function (moduleName) {
                var found, args, mod,
                    shim = config.shim[moduleName] || {},
                    shExports = shim.exports;

                takeGlobalQueue();

                while (defQueue.length) {
                    args = defQueue.shift();
                    if (args[0] === null) {
                        args[0] = moduleName;
                        //If already found an anonymous module and bound it
                        //to this name, then this is some other anon module
                        //waiting for its completeLoad to fire.
                        if (found) {
                            break;
                        }
                        found = true;
                    } else if (args[0] === moduleName) {
                        //Found matching define call for this script!
                        found = true;
                    }

                    callGetModule(args);
                }

                //Do this after the cycle of callGetModule in case the result
                //of those calls/init calls changes the registry.
                mod = registry[moduleName];

                if (!found && !defined[moduleName] && mod && !mod.inited) {
                    if (config.enforceDefine && (!shExports || !getGlobal(shExports))) {
                        if (hasPathFallback(moduleName)) {
                            return;
                        } else {
                            return onError(makeError('nodefine',
                                             'No define call for ' + moduleName,
                                             null,
                                             [moduleName]));
                        }
                    } else {
                        //A script that does not call define(), so just simulate
                        //the call for it.
                        callGetModule([moduleName, (shim.deps || []), shim.exportsFn]);
                    }
                }

                checkLoaded();
            }
303807
function( startFunc, forced ) {
		var self = this, i, mod;

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

		// Add fail marker if no tests were ran
		if ( self.count < 1 ) {
			self.fail( "[munit] No tests ran in this module" );
		}

		// Auto close out any spies
		self._spies.reverse().forEach(function( spy ) {
			spy.restore();
		});

		// Proxy teardown to pass start function and forced state
		self._teardown(function( e, teardownCallback ) {
			if ( e ) {
				self._fail( "[munit] failed to teardown '" + self.nsPath + "' module properly", teardownCallback );
			}

			self._close( startFunc || self.close, forced );
		});

		return self;
	}
347457
function module(filename) {
            return function () {
                if (verbose.local) console.log(filename);
                response.write(fs.readFileSync(filename) + '\n/*:oxsep:*/\n');
            };
        }
80860
function automock (method) {
    // require function
    if (typeof method !== 'function') {
        throw new Error('automock error: automock must be called with function')
    }
    // create automock wrapper function
    var automockWrapper = function coreAutomockWrapper (args) {
        // require args to be object
        args = requireValidOptionalObject(args)
        // if the automock flag is set to false then call original method but
        // delete the automock flag from the session so that all subsequent
        // calls will be mocked
        if (args && args.session && args.session.automock === false) {
            // delete automock flag
            delete args.session.automock
            // call original method
            return method.apply(this, arguments)
        }
        // get stable id for args
        var stableId = moduleCallStableId({
            args: args,
            methodName: method.meta.methodName,
            moduleName: method.meta.moduleName,
        })
        // get mock data for moduleCall
        var moduleCallMock = immutableAutomock.moduleCallMocks[stableId]
        var moduleCallResolveMock = moduleCallMock && immutableAutomock.moduleCallResolveMocks[moduleCallMock.moduleCallId]
        // return mock data if moduleCall and ModuleCallResolve mocks exist
        if (moduleCallMock && moduleCallResolveMock) {
            // either resolve or reject - clone data to prevent mock pollution
            return moduleCallResolveMock.resolved
                ? Promise.resolve(_.cloneDeep(moduleCallResolveMock.moduleCallResolveData))
                : Promise.reject(_.cloneDeep(moduleCallResolveMock.moduleCallResolveData))
        }
        // if requireAutomock flag is set on session throw error
        else if (args && args.session && args.session.requireAutomock) {
            // create new error object
            var error = new Error('missing automock for method: '+method.meta.moduleName+'.'+method.meta.methodName)
            // add call data to error
            error.automockCallData = {
                args: args,
                methodName: method.meta.methodName,
                moduleName: method.meta.moduleName,
            }
            error.automockStableId = stableId
            // throw error
            throw error
        }
        // call original method with args
        return method.apply(this, arguments)
    }
    // set method meta data on wrapper
    automockWrapper.meta = method.meta
    // return wrapper
    return automockWrapper
}
1099652
function loadMockModuleCall (mockData, options) {
    // convert old data schema to new
    if (mockData.data && mockData.data.functionName) {
        mockData.data.methodName = mockData.data.functionName
        delete mockData.data.functionName
    }
    // get stable id for module call data with non-deterministic properites removed
    try {
        var stableId = moduleCallStableId(mockData.data)
    }
    // catch errors if ignore option is set
    catch (ex) {
        if (options.ignoreInvalidMockData) {
            return
        }
        else {
            throw new Error('automock error: invalid mock data')
        }
    }
    // store moduleCall data keyed by stable id
    immutableAutomock.moduleCallMocks[stableId] = mockData.data
}
242874
function loadMockModuleCallResolve (mockData, options) {
    // store moduleCallResolve data keyed by moduleCallId
    immutableAutomock.moduleCallResolveMocks[mockData.data.moduleCallId] = mockData.data
}
1148532
function(refPath) {
		var require = function(relModuleId) {
			var moduleId = resolveModuleId(relModuleId, refPath),
				module = getModule(moduleId);

			if (!module) {
				throw "Module not loaded";
			}
			else if (module.error) {
				throw "Error loading module";
			}

			if (!module.exports) {
				module.exports = {};
				var moduleDir = moduleId.substring(0, moduleId.lastIndexOf('/')+1),
					injects = module.injects,
					args = [];

				for (var i = 0, n = injects.length; i<n; i++) {
					if (injects[i] == 'require') {
						args.push(createRequireFunc(moduleDir));
					}
					else if (injects[i] == 'exports') {
						args.push(module.exports);
					}
					else if (injects[i] == 'module') {
						args.push(module.module);
					}
				}

				module.factory.apply(null, args);
			}
			return module.exports;
		};

		require.ensure = function(deps, cb) {
			ensureImpl(deps, cb, refPath);
		};

		if (_mainProgram != null) {
			require.main = getModule(_mainProgram).module;
		}

		return require;
	}
1218104
function _requireModule(rootPath, name) {
  let modulePath = _normalizeRequire(rootPath, name),
    moduleRes;
  try {
    moduleRes = require(modulePath);
  } catch (e) {
    if (e.code === 'MODULE_NOT_FOUND' && e.message.indexOf(name) !== -1) {
      try {
        moduleRes = require(name);
      } catch (e) {
        if (e.code === 'MODULE_NOT_FOUND' && e.message.indexOf(name) !== -1) {
          throw "NOT_FOUND";
        }
        throw e;
      }
    } else {
      throw e;
    }
  }
  return moduleRes;
}
1112190
function config(name) {
  const args = [].slice.call(arguments, 1)
  const modules = {
    ActionSheet: $actionSheet,
    Loading: $loading,
    Toast: $toast,
    Dialog: $dialog
  }
  const module = components[name] || modules[name]
  if (typeof module.config === 'function') {
    module.config.apply(null, args)
  }
  else {
    console.warn(`${name}.config is not a function`)
  }
}
406661
function workFn() {
            if (currentSpec.$injector) {
                throw Error('Injector already created, can not register a module!');
            } else {
                var modules = currentSpec.$modules || (currentSpec.$modules = []);
                angular.forEach(moduleFns, function(module) {
                    if (angular.isObject(module) && !angular.isArray(module)) {
                        modules.push(function($provide) {
                            angular.forEach(module, function(value, key) {
                                $provide.value(key, value);
                            });
                        });
                    } else {
                        modules.push(module);
                    }
                });
            }
        }
1194533
def run_module(mod_name, init_globals=None,
               run_name=None, alter_sys=False):
    
    mod_name, loader, code, fname = _get_module_details(mod_name)
    if run_name is None:
        run_name = mod_name
    pkg_name = mod_name.rpartition('.')[0]
    if alter_sys:
        return _run_module_code(code, init_globals, run_name,
                                fname, loader, pkg_name)
    else:
        # Leave the sys module alone
        return _run_code(code, {}, init_globals, run_name,
                         fname, loader, pkg_name)
384732
function( name, options, callback ) {
		var self = this;

		// Can only create sub modules if this modules isn't finished
		self.requireMaxState( munit.ASSERT_STATE_ACTIVE, self.module );

		// Module creation is done on the main object (pass this modules prefix path)
		return munit._module( name, options, callback, { nsprefix: self.nsPath } );
	}
318704
function(name) {
			var match = null;
			list.forEach(function(file) {
				if(_.indexOf(file.modules, name) >= 0) {
					match = file;
					return false;
				}
			});
			return match;
		}
235979
function (moduleName) {
                var args;

                context.takeGlobalQueue();

                while (defQueue.length) {
                    args = defQueue.shift();

                    if (args[0] === null) {
                        args[0] = moduleName;
                        break;
                    } else if (args[0] === moduleName) {
                        //Found matching define call for this script!
                        break;
                    } else {
                        //Some other named define call, most likely the result
                        //of a build layer that included many define calls.
                        callDefMain(args);
                        args = null;
                    }
                }
                if (args) {
                    callDefMain(args);
                } else {
                    //A script that does not call define(), so just simulate
                    //the call for it. Special exception for jQuery dynamic load.
                    callDefMain([moduleName, [],
                                moduleName === "jquery" && typeof jQuery !== "undefined" ?
                                function () {
                                    return jQuery;
                                } : null]);
                }

                //Mark the script as loaded. Note that this can be different from a
                //moduleName that maps to a define call. This line is important
                //for traditional browser scripts.
                loaded[moduleName] = true;

                //If a global jQuery is defined, check for it. Need to do it here
                //instead of main() since stock jQuery does not register as
                //a module via define.
                jQueryCheck();

                //Doing this scriptCount decrement branching because sync envs
                //need to decrement after resume, otherwise it looks like
                //loading is complete after the first dependency is fetched.
                //For browsers, it works fine to decrement after, but it means
                //the checkLoaded setTimeout 50 ms cost is taken. To avoid
                //that cost, decrement beforehand.
                if (req.isAsync) {
                    context.scriptCount -= 1;
                }
                resume();
                if (!req.isAsync) {
                    context.scriptCount -= 1;
                }
            }