Comparing version 0.0.2 to 0.0.3
@@ -12,3 +12,2 @@ var context; | ||
var requiredModules = []; | ||
var lib = process.env.THEM_LIB || "./lib"; | ||
@@ -22,3 +21,3 @@ functionParameters.forEach(function(name) { | ||
if(toRequire.substr(0, 2) === "./") { | ||
toRequire = lib + toRequire.substr(1); | ||
toRequire = module.exports.getLib() + toRequire.substr(1); | ||
} | ||
@@ -43,4 +42,8 @@ subModule = mapped[1]; | ||
module.exports.getLib = function() { | ||
return process.env.THEM_LIB || "./lib"; | ||
}; | ||
module.exports.list = function() { | ||
return map; | ||
}; |
{ | ||
"name": "them", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Easier node require", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -139,2 +139,25 @@ var them = require("../lib/index.js"), | ||
}); | ||
describe('#getLib()', function() { | ||
it('should return the default lib folder', function() { | ||
// given | ||
them.init(fakeContext, {}); | ||
// when | ||
var lib = them.getLib(); | ||
// then | ||
expect(lib).to.equal("./lib"); | ||
}); | ||
it('should return the default lib folder', function() { | ||
// given | ||
process.env.THEM_LIB = './lib_cov'; | ||
them.init(fakeContext, {}); | ||
// when | ||
var lib = them.getLib(); | ||
// then | ||
expect(lib).to.equal("./lib_cov"); | ||
}); | ||
}); | ||
}); |
9401
219
3