 		modulePath = pathUtils.relative base, filename
 		parentPath = pathUtils.relative base, parent.id
 
-	unless modulesByPaths[modulePath]
-		modules.push modulePath
-		modulesByPaths[modulePath] = true
+	if req is index or testResolved(req, filename, modulePath, parentPath)
+		unless modulesByPaths[modulePath]
+			modules.push modulePath
+			modulesByPaths[modulePath] = true
 
-	if parentPath
-		mpaths = paths[parentPath] ?= {}
-		mpaths[req] = modulePath
+		if parentPath
+			mpaths = paths[parentPath] ?= {}
+			mpaths[req] = modulePath
 
 	r
 

		return r

	if pathUtils.isAbsolute(req) and req isnt index
		modulePath = req
		parentPath = ''
	else

		val

index = pathUtils.resolve fs.realpathSync('.'), opts.path
{platform, test, testResolved, path} = opts
test ?= -> true
testResolved ?= -> true

customGlobalProps = Object.create null
mockGlobal = (obj) ->
