Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue #1962 - ignoredDependenices multiple install run #1970

Merged
merged 1 commit into from
Oct 24, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/core/Manager.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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