-
Notifications
You must be signed in to change notification settings - Fork 940
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(lane-merge), handle a case when a component is deleted and is als…
…o unrelated to the other lane (#7837) In this case, we set the "--resolve-unrelated" to `theirs`, so then the history is kept according to the other lane (which is not removed).
- Loading branch information
1 parent
6263e94
commit d007699
Showing
4 changed files
with
84 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import chai, { expect } from 'chai'; | ||
import Helper from '../../../src/e2e-helper/e2e-helper'; | ||
|
||
chai.use(require('chai-fs')); | ||
|
||
describe('current lane a comp is removed, merging a lane that has this comp with different history', function () { | ||
this.timeout(0); | ||
let helper: Helper; | ||
let headOnLaneA: string; | ||
let headOnLaneB: string; | ||
before(() => { | ||
helper = new Helper(); | ||
helper.scopeHelper.setNewLocalAndRemoteScopes(); | ||
helper.command.createLane('lane-a'); | ||
helper.fixtures.populateComponents(1, false, 'lane-a'); | ||
helper.command.snapAllComponentsWithoutBuild(); | ||
helper.command.export(); | ||
headOnLaneA = helper.command.getHeadOfLane('lane-a', 'comp1'); | ||
|
||
helper.scopeHelper.reInitLocalScope(); | ||
helper.scopeHelper.addRemoteScope(); | ||
helper.command.createLane('lane-b'); | ||
helper.fixtures.populateComponents(1, false, 'lane-b'); | ||
helper.command.snapAllComponentsWithoutBuild(); | ||
helper.command.export(); | ||
|
||
helper.command.softRemoveOnLane('comp1'); | ||
helper.command.snapAllComponentsWithoutBuild(); | ||
helper.command.export(); | ||
headOnLaneB = helper.command.getHeadOfLane('lane-b', 'comp1'); | ||
|
||
helper.command.mergeLane('lane-a', '--resolve-unrelated -x'); | ||
}); | ||
after(() => { | ||
helper.scopeHelper.destroy(); | ||
}); | ||
// should default to resolve by "their" because the current is removed | ||
it('should get the file content according to their', () => { | ||
const fileContent = helper.fs.readFile(`${helper.scopes.remote}/comp1/index.js`); | ||
expect(fileContent).to.have.string('lane-a'); | ||
expect(fileContent).to.not.have.string('lane-b'); | ||
}); | ||
it('should populate the unrelated property according to the current head', () => { | ||
const ver = helper.command.catComponent('comp1@latest'); | ||
expect(ver.unrelated.head).to.equal(headOnLaneB); | ||
expect(ver.unrelated.laneId.name).to.equal('lane-b'); | ||
}); | ||
it('should populate the parents according to the other lane', () => { | ||
const ver = helper.command.catComponent('comp1@latest'); | ||
expect(ver.parents[0]).to.equal(headOnLaneA); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters