Merge branch 'develop' into sidv/typescript

* develop:
  chore(deps-dev): bump @commitlint/cli from 17.0.3 to 17.1.1 (#3376)
  chore(deps-dev): bump eslint from 8.22.0 to 8.23.0 (#3378)
  chore(deps): bump dompurify from 2.3.10 to 2.4.0 (#3375)
  chore(deps-dev): bump @commitlint/config-conventional (#3370)
  chore(deps-dev): bump @babel/core from 7.18.10 to 7.18.13 (#3373)
  chore(deps-dev): bump eslint-plugin-jest from 26.8.7 to 27.0.1 (#3372)
  chore(deps-dev): bump jest-environment-jsdom from 28.1.3 to 29.0.1 (#3369)
  chore(deps-dev): bump babel-jest from 28.1.3 to 29.0.1 (#3368)
  Updating docs to latest mermaid version
  build: add eslint --cache file
  Adjusting size and test
  Updated viewBox settings
  Border
  feat(git): allow custom merge commit ids
  Document line curve options
  Added 'ms' duration
  Fix font weight for messages in sequence diagrams
  Added lollipop feature for updated codebase
This commit is contained in:
Sidharth Vinod
2022-08-31 11:34:59 +05:30
36 changed files with 718 additions and 335 deletions

View File

@@ -495,6 +495,76 @@ describe('when parsing a gitGraph', function () {
]);
});
it('should handle merge ids', function () {
const str = `gitGraph:
commit
branch testBranch
checkout testBranch
commit
checkout main
%% Merge Tag and ID
merge testBranch tag: "merge-tag" id: "2-222"
branch testBranch2
checkout testBranch2
commit
checkout main
%% Merge ID and Tag (reverse order)
merge testBranch2 id: "4-444" tag: "merge-tag2"
branch testBranch3
checkout testBranch3
commit
checkout main
%% just Merge ID
merge testBranch3 id: "6-666"
`;
parser.parse(str);
const commits = parser.yy.getCommits();
expect(Object.keys(commits).length).toBe(7);
expect(parser.yy.getCurrentBranch()).toBe('main');
expect(parser.yy.getDirection()).toBe('LR');
// The order of these commits is in alphabetical order of IDs
const [
mainCommit,
testBranchCommit,
testBranchMerge,
testBranch2Commit,
testBranch2Merge,
testBranch3Commit,
testBranch3Merge,
] = Object.values(commits);
console.log(Object.keys(commits));
expect(mainCommit.branch).toBe('main');
expect(mainCommit.parents).toStrictEqual([]);
expect(testBranchCommit.branch).toBe('testBranch');
expect(testBranchCommit.parents).toStrictEqual([mainCommit.id]);
expect(testBranchMerge.branch).toBe('main');
expect(testBranchMerge.parents).toStrictEqual([mainCommit.id, testBranchCommit.id]);
expect(testBranchMerge.tag).toBe('merge-tag');
expect(testBranchMerge.id).toBe('2-222');
expect(testBranch2Merge.branch).toBe('main');
expect(testBranch2Merge.parents).toStrictEqual([testBranchMerge.id, testBranch2Commit.id]);
expect(testBranch2Merge.tag).toBe('merge-tag2');
expect(testBranch2Merge.id).toBe('4-444');
expect(testBranch3Merge.branch).toBe('main');
expect(testBranch3Merge.parents).toStrictEqual([testBranch2Merge.id, testBranch3Commit.id]);
expect(testBranch3Merge.id).toBe('6-666');
expect(parser.yy.getBranchesAsObjArray()).toStrictEqual([
{ name: 'main' },
{ name: 'testBranch' },
{ name: 'testBranch2' },
{ name: 'testBranch3' },
]);
});
it('should throw error when try to branch existing branch: main', function () {
const str = `gitGraph
commit