Comparing version 0.2.0 to 0.2.1
@@ -88,3 +88,4 @@ var fs = require('fs'); | ||
function nodeModulesPathsSync (start) { | ||
var parts = start.split(/\/+/); | ||
var splitRe = process.platform === 'win32' ? /[\/\\]/ : /\/+/; | ||
var parts = start.split(splitRe); | ||
@@ -91,0 +92,0 @@ var dirs = []; |
{ | ||
"name" : "resolve", | ||
"description" : "A more hookable require.resolve() implementation", | ||
"version" : "0.2.0", | ||
"version" : "0.2.1", | ||
"repository" : { | ||
@@ -22,7 +22,7 @@ "type" : "git", | ||
"scripts" : { | ||
"test" : "expresso" | ||
"test" : "tap test/*.js" | ||
}, | ||
"dependencies" : {}, | ||
"devDependencies" : { | ||
"expresso" : "0.7.x" | ||
"tap" : "~0.2.4" | ||
}, | ||
@@ -29,0 +29,0 @@ "engines" : { |
@@ -1,11 +0,12 @@ | ||
var assert = require('assert'); | ||
var test = require('tap').test; | ||
var resolve = require('../'); | ||
exports.core = function () { | ||
assert.ok(resolve.isCore('fs')); | ||
assert.ok(resolve.isCore('net')); | ||
assert.ok(resolve.isCore('http')); | ||
test('core modules', function (t) { | ||
t.ok(resolve.isCore('fs')); | ||
t.ok(resolve.isCore('net')); | ||
t.ok(resolve.isCore('http')); | ||
assert.ok(!resolve.isCore('seq')); | ||
assert.ok(!resolve.isCore('../')); | ||
}; | ||
t.ok(!resolve.isCore('seq')); | ||
t.ok(!resolve.isCore('../')); | ||
t.end(); | ||
}); |
@@ -1,5 +0,5 @@ | ||
var assert = require('assert'); | ||
var test = require('tap').test; | ||
var resolve = require('../'); | ||
exports.filter = function () { | ||
test('filter', function (t) { | ||
var dir = __dirname + '/resolver'; | ||
@@ -13,3 +13,4 @@ var res = resolve.sync('./baz', { | ||
}); | ||
assert.equal(res, dir + '/baz/doom.js'); | ||
}; | ||
t.equal(res, dir + '/baz/doom.js'); | ||
t.end(); | ||
}); |
@@ -1,5 +0,7 @@ | ||
var assert = require('assert'); | ||
var test = require('tap').test; | ||
var resolve = require('../'); | ||
exports.mock = function () { | ||
test('mock', function (t) { | ||
t.plan(3); | ||
var files = { | ||
@@ -21,3 +23,3 @@ '/foo/bar/baz.js' : 'beep' | ||
assert.equal( | ||
t.equal( | ||
resolve.sync('./baz', opts('/foo/bar')), | ||
@@ -27,3 +29,3 @@ '/foo/bar/baz.js' | ||
assert.equal( | ||
t.equal( | ||
resolve.sync('./baz.js', opts('/foo/bar')), | ||
@@ -33,8 +35,10 @@ '/foo/bar/baz.js' | ||
assert.throws(function () { | ||
t.throws(function () { | ||
resolve.sync('baz', opts('/foo/bar')); | ||
}); | ||
}; | ||
}); | ||
exports.mockPackage = function () { | ||
test('mock package', function (t) { | ||
t.plan(1); | ||
var files = { | ||
@@ -59,6 +63,6 @@ '/foo/node_modules/bar/baz.js' : 'beep', | ||
assert.equal( | ||
t.equal( | ||
resolve.sync('bar', opts('/foo')), | ||
'/foo/node_modules/bar/baz.js' | ||
); | ||
}; | ||
}); |
@@ -1,8 +0,8 @@ | ||
var assert = require('assert'); | ||
var test = require('tap').test; | ||
var resolve = require('../'); | ||
exports.foo = function () { | ||
test('foo', function (t) { | ||
var dir = __dirname + '/resolver'; | ||
assert.equal( | ||
t.equal( | ||
resolve.sync('./foo', { basedir : dir }), | ||
@@ -12,3 +12,3 @@ dir + '/foo.js' | ||
assert.equal( | ||
t.equal( | ||
resolve.sync('./foo.js', { basedir : dir }), | ||
@@ -18,28 +18,32 @@ dir + '/foo.js' | ||
assert.throws(function () { | ||
t.throws(function () { | ||
resolve.sync('foo', { basedir : dir }); | ||
}); | ||
}; | ||
t.end(); | ||
}); | ||
exports.bar = function () { | ||
test('bar', function (t) { | ||
var dir = __dirname + '/resolver'; | ||
assert.equal( | ||
t.equal( | ||
resolve.sync('foo', { basedir : dir + '/bar' }), | ||
dir + '/bar/node_modules/foo/index.js' | ||
); | ||
}; | ||
t.end(); | ||
}); | ||
exports.baz = function () { | ||
test('baz', function (t) { | ||
var dir = __dirname + '/resolver'; | ||
assert.equal( | ||
t.equal( | ||
resolve.sync('./baz', { basedir : dir }), | ||
dir + '/baz/quux.js' | ||
); | ||
}; | ||
t.end(); | ||
}); | ||
exports.biz = function () { | ||
test('biz', function (t) { | ||
var dir = __dirname + '/resolver/biz/node_modules'; | ||
assert.equal( | ||
t.equal( | ||
resolve.sync('./grux', { basedir : dir }), | ||
@@ -49,3 +53,3 @@ dir + '/grux/index.js' | ||
assert.equal( | ||
t.equal( | ||
resolve.sync('tiv', { basedir : dir + '/grux' }), | ||
@@ -55,19 +59,21 @@ dir + '/tiv/index.js' | ||
assert.equal( | ||
t.equal( | ||
resolve.sync('grux', { basedir : dir + '/tiv' }), | ||
dir + '/grux/index.js' | ||
); | ||
}; | ||
t.end(); | ||
}); | ||
exports.normalize = function () { | ||
test('normalize', function (t) { | ||
var dir = __dirname + '/resolver/biz/node_modules/grux'; | ||
assert.equal( | ||
t.equal( | ||
resolve.sync('../grux', { basedir : dir }), | ||
dir + '/index.js' | ||
); | ||
}; | ||
t.end(); | ||
}); | ||
exports.cup = function () { | ||
test('cup', function (t) { | ||
var dir = __dirname + '/resolver'; | ||
assert.equal( | ||
t.equal( | ||
resolve.sync('./cup', { | ||
@@ -80,3 +86,3 @@ basedir : dir, | ||
assert.equal( | ||
t.equal( | ||
resolve.sync('./cup.coffee', { | ||
@@ -88,16 +94,15 @@ basedir : dir | ||
assert.throws(function () { | ||
assert.equal( | ||
resolve.sync('./cup', { | ||
basedir : dir, | ||
extensions : [ '.js' ] | ||
}), | ||
dir + '/cup.coffee' | ||
); | ||
t.throws(function () { | ||
resolve.sync('./cup', { | ||
basedir : dir, | ||
extensions : [ '.js' ] | ||
}) | ||
}); | ||
}; | ||
t.end(); | ||
}); | ||
exports.mug = function () { | ||
test('mug', function (t) { | ||
var dir = __dirname + '/resolver'; | ||
assert.equal( | ||
t.equal( | ||
resolve.sync('./mug', { basedir : dir }), | ||
@@ -107,3 +112,3 @@ dir + '/mug.js' | ||
assert.equal( | ||
t.equal( | ||
resolve.sync('./mug', { | ||
@@ -116,3 +121,3 @@ basedir : dir, | ||
assert.equal( | ||
t.equal( | ||
resolve.sync('./mug', { | ||
@@ -124,5 +129,7 @@ basedir : dir, | ||
); | ||
}; | ||
t.end(); | ||
}); | ||
exports.other_path = function () { | ||
test('other path', function (t) { | ||
var resolverDir = __dirname + '/resolver'; | ||
@@ -134,3 +141,3 @@ var dir = resolverDir + '/bar'; | ||
assert.equal( | ||
t.equal( | ||
resolve.sync('root', { | ||
@@ -142,3 +149,3 @@ basedir : dir, | ||
assert.equal( | ||
t.equal( | ||
resolve.sync('lib/other-lib', { | ||
@@ -150,7 +157,7 @@ basedir : dir, | ||
assert.throws(function () { | ||
t.throws(function () { | ||
resolve.sync('root', { basedir : dir, }); | ||
}); | ||
assert.throws(function () { | ||
t.throws(function () { | ||
resolve.sync('zzz', { | ||
@@ -160,2 +167,4 @@ basedir : dir, | ||
}); | ||
}; | ||
t.end(); | ||
}); |
Sorry, the diff of this file is not supported yet
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
10772
20
294
48