diff --git a/gulpfile.js b/gulpfile.js index 27f3243..d5e91ff 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -11,5 +11,5 @@ gulp.task('test', function() { }); gulp.task('watch:test', function(){ - gulp.watch('index.js', ["test"]); -}); \ No newline at end of file + gulp.watch(['index.js', "tests/**/*"], ["test"]); +}); diff --git a/index.js b/index.js index d42f4cf..b36f14e 100644 --- a/index.js +++ b/index.js @@ -64,7 +64,11 @@ module.exports = function nwire(config, callback) { if (!skipNeeds) { self.packages[dependencyName] = load(dependencyName, skip); - imports[dependencyName] = self.packages[dependencyName]; + Object.defineProperty(imports, dependencyName, { + get: function(){ + return self.packages[dependencyName]; + } + }); } }); @@ -91,4 +95,4 @@ module.exports = function nwire(config, callback) { if (!callback) throw err; callback(err); } -} \ No newline at end of file +} diff --git a/tests/nwire.js b/tests/nwire.js index 75eca99..569c498 100644 --- a/tests/nwire.js +++ b/tests/nwire.js @@ -81,9 +81,9 @@ describe('nwire application', function() { }); describe('leech package', function(){ - it('has a consumed package', function(){ + it('should not have packages', function(){ var app = wire(configurationFixture); - expect(_.size(app.packages.leech.imports)).to.equal(1); + expect(_.size(app.packages.leech.imports)).to.equal(0); }); it('has the consumed seed package', function(){ @@ -100,4 +100,4 @@ describe('leech package', function(){ var app = wire(circularConfigurationFixture); expect(app.packages.leech.imports.seed.dummyFn).to.not.be.undefined; }); -}); \ No newline at end of file +});