Skip to content

Commit

Permalink
fix #2255, avoid adding overrides upon import when a component overri…
Browse files Browse the repository at this point in the history
…des has not changed (#2257)
  • Loading branch information
davidfirst authored Jan 25, 2020
1 parent 3eece07 commit f72d047
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [unreleased]

- [#2255](https://github.com/teambit/bit/issues/2255) avoid adding unneeded overrides upon import
- [#2247](https://github.com/teambit/bit/issues/2247) improve auto-tag output

## [[14.7.2] - 2020-01-12](https://github.com/teambit/bit/releases/tag/v14.7.2)
Expand Down
15 changes: 15 additions & 0 deletions e2e/functionalities/workspace-config.e2e.3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1717,4 +1717,19 @@ describe('workspace config', function() {
});
});
});
describe('export a component with compiler then import', () => {
before(() => {
helper.scopeHelper.setNewLocalAndRemoteScopes();
helper.fixtures.createComponentBarFoo();
helper.fixtures.addComponentBarFoo();
helper.env.importDummyCompiler();
helper.command.tagAllComponents();
helper.command.exportAllComponents();
helper.command.importComponent('bar/foo');
});
it('should not add the component into the overrides of the workspace because nothing has changed', () => {
const bitJson = helper.bitJson.read();
expect(bitJson).to.not.have.property('overrides');
});
});
});
2 changes: 1 addition & 1 deletion src/consumer/config/consumer-overrides.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export default class ConsumerOverrides {
): boolean {
// seems like R.equals does a great job here. it compares objects by values (not by reference).
// also it disregards the keys order.
return R.equals(overridesA, overridesB);
return R.equals(overridesA || {}, overridesB || {});
}

findExactMatch(bitId: BitId): string | null | undefined {
Expand Down

0 comments on commit f72d047

Please sign in to comment.