Skip to content

Commit

Permalink
Merge pull request #1970 from twalpole/ignore2
Browse files Browse the repository at this point in the history
fix issue #1962 - ignoredDependenices multiple install run
  • Loading branch information
sheerun committed Oct 24, 2015
2 parents 302c4ad + 43d00de commit b6a524e
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/core/Manager.js
Expand Up @@ -25,8 +25,11 @@ Manager.prototype.configure = function (setup) {
var targetsHash = {};
this._conflicted = {};

// Targets
this._targets = setup.targets || [];
// Targets - ignore those specified in ignoredDependencies
this._targets = mout.array.reject(setup.targets || [], function(target) {
return mout.array.contains(this._config.ignoredDependencies, target.name );
}, this);

this._targets.forEach(function (decEndpoint) {
decEndpoint.initialName = decEndpoint.name;
decEndpoint.dependants = mout.object.values(decEndpoint.dependants);
Expand Down
38 changes: 38 additions & 0 deletions test/commands/install.js
Expand Up @@ -316,6 +316,44 @@ describe('bower install', function () {

});

it('does not install ignored dependencies if run multiple times', function() {
package.prepare();
var package2 = new helpers.TempDir({
'bower.json': {
name: 'package2',
}
}).prepare();

var package3 = new helpers.TempDir({
'bower.json': {
name: 'package3',
dependencies: {
package2: package2.path,
package: package.path,
}
}
}).prepare();

tempDir.prepare({
'bower.json': {
name: 'test_tw',
dependencies: {
package3: package3.path
}
},
'.bowerrc': {
ignoredDependencies: ['package']
}
});
return helpers.run(install).then(function() {
return helpers.run(install).then(function() {
expect(tempDir.exists('bower_components/package')).to.be(false);
expect(tempDir.exists('bower_components/package2')).to.be(true);
});
});

});

it('recognizes proxy option in config', function () {
this.timeout(10000);

Expand Down
37 changes: 37 additions & 0 deletions test/commands/update.js
Expand Up @@ -125,6 +125,43 @@ describe('bower update', function () {

});

it('does not install ignored dependencies if run multiple times', function() {
var package3 = new helpers.TempDir({
'bower.json': {
name: 'package3'
}
}).prepare();

var package2 = new helpers.TempDir({
'bower.json': {
name: 'package2',
dependencies: {
package3: package3.path
}
}
}).prepare();

tempDir.prepare({
'bower.json': {
name: 'test',
dependencies: {
package2: package2.path
}
},
'.bowerrc': {
ignoredDependencies: ['package3']
}
});

return update().then(function() {
return update().then(function() {
expect(tempDir.exists('bower_components/package2/bower.json')).to.equal(true);
expect(tempDir.exists('bower_components/package3')).to.equal(false);
});
});

});

it('runs preinstall hook when installing missing package', function () {
package.prepare();

Expand Down

0 comments on commit b6a524e

Please sign in to comment.