Comparing version 1.11.0 to 1.11.1
@@ -76,4 +76,4 @@ var core = require('./core'); | ||
if (err) cb(err); | ||
else if (core[x]) return cb(null, x); | ||
else if (n) cb(null, n, pkg); | ||
else if (core[x]) return cb(null, x); | ||
else { | ||
@@ -80,0 +80,0 @@ var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); |
@@ -21,3 +21,3 @@ var path = require('path'); | ||
return dirs.concat(modules.map(function (moduleDir) { | ||
return path.join(prefix, aPath, moduleDir); | ||
return path.resolve(prefix, aPath, moduleDir); | ||
})); | ||
@@ -24,0 +24,0 @@ }, []); |
@@ -62,2 +62,4 @@ var core = require('./core'); | ||
if (m) return m; | ||
} else if (core[x]) { | ||
return x; | ||
} else { | ||
@@ -64,0 +66,0 @@ var n = loadNodeModulesSync(x, absoluteStart); |
{ | ||
"name": "resolve", | ||
"description": "resolve like require.resolve() on behalf of files asynchronously and synchronously", | ||
"version": "1.11.0", | ||
"version": "1.11.1", | ||
"repository": { | ||
@@ -6,0 +6,0 @@ "type": "git", |
@@ -121,2 +121,24 @@ var test = require('tape'); | ||
}); | ||
t.test('combine paths correctly on Windows', function (t) { | ||
var start = 'C:\\Users\\username\\myProject\\src'; | ||
var paths = []; | ||
var moduleDirectories = ['node_modules', start]; | ||
var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); | ||
t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir'); | ||
t.end(); | ||
}); | ||
t.test('combine paths correctly on non-Windows', { skip: process.platform === 'win32' }, function (t) { | ||
var start = '/Users/username/git/myProject/src'; | ||
var paths = []; | ||
var moduleDirectories = ['node_modules', '/Users/username/git/myProject/src']; | ||
var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); | ||
t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir'); | ||
t.end(); | ||
}); | ||
}); |
@@ -187,13 +187,2 @@ var path = require('path'); | ||
test('#25: node modules with the same name as node stdlib modules', function (t) { | ||
var resolverDir = path.join(__dirname, 'resolver/punycode'); | ||
t.equal( | ||
resolve.sync('punycode', { basedir: resolverDir }), | ||
path.join(resolverDir, 'node_modules/punycode/index.js') | ||
); | ||
t.end(); | ||
}); | ||
var stubStatSync = function stubStatSync(fn) { | ||
@@ -200,0 +189,0 @@ var fs = require('fs'); |
@@ -286,13 +286,2 @@ var path = require('path'); | ||
test('#25: node modules with the same name as node stdlib modules', function (t) { | ||
t.plan(1); | ||
var resolverDir = path.join(__dirname, 'resolver/punycode'); | ||
resolve('punycode', { basedir: resolverDir }, function (err, res, pkg) { | ||
if (err) t.fail(err); | ||
t.equal(res, path.join(resolverDir, 'node_modules/punycode/index.js')); | ||
}); | ||
}); | ||
test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) { | ||
@@ -299,0 +288,0 @@ t.plan(2); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
141483
88
2009