From f72d047671d8afb18abda89c1d972e2d3222f4d2 Mon Sep 17 00:00:00 2001 From: David First Date: Fri, 24 Jan 2020 23:36:21 -0500 Subject: [PATCH] fix #2255, avoid adding overrides upon import when a component overrides has not changed (#2257) --- CHANGELOG.md | 1 + e2e/functionalities/workspace-config.e2e.3.ts | 15 +++++++++++++++ src/consumer/config/consumer-overrides.ts | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8ea334f761e..b80a050ee0e9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/e2e/functionalities/workspace-config.e2e.3.ts b/e2e/functionalities/workspace-config.e2e.3.ts index c6491150b0b6..2659a4a1071f 100644 --- a/e2e/functionalities/workspace-config.e2e.3.ts +++ b/e2e/functionalities/workspace-config.e2e.3.ts @@ -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'); + }); + }); }); diff --git a/src/consumer/config/consumer-overrides.ts b/src/consumer/config/consumer-overrides.ts index f91968153475..b2f8d808e128 100644 --- a/src/consumer/config/consumer-overrides.ts +++ b/src/consumer/config/consumer-overrides.ts @@ -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 {