51.9 KB2083 lines
Blame
1import { imgSnapshotTest } from '../../helpers/util.ts';
2
3describe('Git Graph diagram', () => {
4 it('1: should render a simple gitgraph with commit on main branch', () => {
5 imgSnapshotTest(
6 `gitGraph
7 commit id: "1"
8 commit id: "2"
9 commit id: "3"
10 `,
11 {}
12 );
13 });
14 it('2: should render a simple gitgraph with commit on main branch with id', () => {
15 imgSnapshotTest(
16 `gitGraph
17 commit id: "One"
18 commit id: "Two"
19 commit id: "Three"
20 `,
21 {}
22 );
23 });
24 it('3: should render a simple gitgraph with different commitTypes on main branch ', () => {
25 imgSnapshotTest(
26 `gitGraph
27 commit id: "Normal Commit"
28 commit id: "Reverse Commit" type: REVERSE
29 commit id: "Highlight Commit" type: HIGHLIGHT
30 `,
31 {}
32 );
33 });
34 it('4: should render a simple gitgraph with tags commitTypes on main branch ', () => {
35 imgSnapshotTest(
36 `gitGraph
37 commit id: "Normal Commit with tag" tag: "v1.0.0"
38 commit id: "Reverse Commit with tag" type: REVERSE tag: "RC_1"
39 commit id: "Highlight Commit" type: HIGHLIGHT tag: "8.8.4"
40 `,
41 {}
42 );
43 });
44 it('5: should render a simple gitgraph with two branches', () => {
45 imgSnapshotTest(
46 `gitGraph
47 commit id: "1"
48 commit id: "2"
49 branch develop
50 checkout develop
51 commit id: "3"
52 commit id: "4"
53 checkout main
54 commit id: "5"
55 commit id: "6"
56 `,
57 {}
58 );
59 });
60 it('6: should render a simple gitgraph with two branches and merge commit', () => {
61 imgSnapshotTest(
62 `gitGraph
63 commit id: "1"
64 commit id: "2"
65 branch develop
66 checkout develop
67 commit id: "3"
68 commit id: "4"
69 checkout main
70 merge develop
71 commit id: "5"
72 commit id: "6"
73 `,
74 {}
75 );
76 });
77 it('7: should render a simple gitgraph with three branches and tagged merge commit', () => {
78 imgSnapshotTest(
79 `gitGraph
80 commit id: "1"
81 commit id: "2"
82 branch nice_feature
83 checkout nice_feature
84 commit id: "3"
85 checkout main
86 commit id: "4"
87 checkout nice_feature
88 branch very_nice_feature
89 checkout very_nice_feature
90 commit id: "5"
91 checkout main
92 commit id: "6"
93 checkout nice_feature
94 commit id: "7"
95 checkout main
96 merge nice_feature id: "12345" tag: "my merge commit"
97 checkout very_nice_feature
98 commit id: "8"
99 checkout main
100 commit id: "9"
101 `,
102 {}
103 );
104 });
105 it('8: should render a simple gitgraph with more than 8 branches & overriding variables', () => {
106 imgSnapshotTest(
107 `%%{init: { 'logLevel': 'debug', 'theme': 'default' , 'themeVariables': {
108 'gitBranchLabel0': '#ffffff',
109 'gitBranchLabel1': '#ffffff',
110 'gitBranchLabel2': '#ffffff',
111 'gitBranchLabel3': '#ffffff',
112 'gitBranchLabel4': '#ffffff',
113 'gitBranchLabel5': '#ffffff',
114 'gitBranchLabel6': '#ffffff',
115 'gitBranchLabel7': '#ffffff',
116 } } }%%
117 gitGraph
118 checkout main
119 branch branch1
120 branch branch2
121 branch branch3
122 branch branch4
123 branch branch5
124 branch branch6
125 branch branch7
126 branch branch8
127 branch branch9
128 checkout branch1
129 commit id: "1"
130 `,
131 {}
132 );
133 });
134 it('9: should render a simple gitgraph with rotated labels', () => {
135 imgSnapshotTest(
136 `%%{init: { 'logLevel': 'debug', 'theme': 'default' , 'gitGraph': {
137 'rotateCommitLabel': true
138 } } }%%
139 gitGraph
140 commit id: "75f7219e83b321cd3fdde7dcf83bc7c1000a6828"
141 commit id: "0db4784daf82736dec4569e0dc92980d328c1f2e"
142 commit id: "7067e9973f9eaa6cd4a4b723c506d1eab598e83e"
143 commit id: "66972321ad6c199013b5b31f03b3a86fa3f9817d"
144 `,
145 {}
146 );
147 });
148 it('10: should render a simple gitgraph with horizontal labels', () => {
149 imgSnapshotTest(
150 `%%{init: { 'logLevel': 'debug', 'theme': 'default' , 'gitGraph': {
151 'rotateCommitLabel': false
152 } } }%%
153 gitGraph
154 commit id: "Alpha"
155 commit id: "Beta"
156 commit id: "Gamma"
157 commit id: "Delta"
158 `,
159 {}
160 );
161 });
162 it('11: should render a simple gitgraph with cherry pick commit', () => {
163 imgSnapshotTest(
164 `
165 gitGraph
166 commit id: "ZERO"
167 branch develop
168 commit id:"A"
169 checkout main
170 commit id:"ONE"
171 checkout develop
172 commit id:"B"
173 checkout main
174 commit id:"TWO"
175 cherry-pick id:"A"
176 commit id:"THREE"
177 checkout develop
178 commit id:"C"
179 `,
180 {}
181 );
182 });
183 it('11: should render a gitgraph with cherry pick commit with custom tag', () => {
184 imgSnapshotTest(
185 `
186 gitGraph
187 commit id: "ZERO"
188 branch develop
189 commit id:"A"
190 checkout main
191 commit id:"ONE"
192 checkout develop
193 commit id:"B"
194 checkout main
195 commit id:"TWO"
196 cherry-pick id:"A" tag: "snapshot"
197 commit id:"THREE"
198 checkout develop
199 commit id:"C"
200 `,
201 {}
202 );
203 });
204 it('11: should render a gitgraph with cherry pick commit with no tag', () => {
205 imgSnapshotTest(
206 `
207 gitGraph
208 commit id: "ZERO"
209 branch develop
210 commit id:"A"
211 checkout main
212 commit id:"ONE"
213 checkout develop
214 commit id:"B"
215 checkout main
216 commit id:"TWO"
217 cherry-pick id:"A" tag: ""
218 commit id:"THREE"
219 checkout develop
220 commit id:"C"
221 `,
222 {}
223 );
224 });
225 it('11: should render a simple gitgraph with two cherry pick commit', () => {
226 imgSnapshotTest(
227 `
228 gitGraph
229 commit id: "ZERO"
230 branch develop
231 commit id:"A"
232 checkout main
233 commit id:"ONE"
234 checkout develop
235 commit id:"B"
236 branch featureA
237 commit id:"FIX"
238 commit id: "FIX-2"
239 checkout main
240 commit id:"TWO"
241 cherry-pick id:"A"
242 commit id:"THREE"
243 cherry-pick id:"FIX"
244 checkout develop
245 commit id:"C"
246 merge featureA
247 `,
248 {}
249 );
250 });
251 it('12: should render commits for more than 8 branches', () => {
252 imgSnapshotTest(
253 `
254 gitGraph
255 checkout main
256 %% Make sure to manually set the id of all commits, for consistent visual tests
257 commit id: "1-abcdefg"
258 checkout main
259 branch branch1
260 commit id: "2-abcdefg"
261 checkout main
262 merge branch1
263 branch branch2
264 commit id: "3-abcdefg"
265 checkout main
266 merge branch2
267 branch branch3
268 commit id: "4-abcdefg"
269 checkout main
270 merge branch3
271 branch branch4
272 commit id: "5-abcdefg"
273 checkout main
274 merge branch4
275 branch branch5
276 commit id: "6-abcdefg"
277 checkout main
278 merge branch5
279 branch branch6
280 commit id: "7-abcdefg"
281 checkout main
282 merge branch6
283 branch branch7
284 commit id: "8-abcdefg"
285 checkout main
286 merge branch7
287 branch branch8
288 commit id: "9-abcdefg"
289 checkout main
290 merge branch8
291 branch branch9
292 commit id: "10-abcdefg"
293 `,
294 {}
295 );
296 });
297 it('13: should render a simple gitgraph with three branches,custom merge commit id,tag,type', () => {
298 imgSnapshotTest(
299 `gitGraph
300 commit id: "1"
301 commit id: "2"
302 branch nice_feature
303 checkout nice_feature
304 commit id: "3"
305 checkout main
306 commit id: "4"
307 checkout nice_feature
308 branch very_nice_feature
309 checkout very_nice_feature
310 commit id: "5"
311 checkout main
312 commit id: "6"
313 checkout nice_feature
314 commit id: "7"
315 checkout main
316 merge nice_feature id: "customID" tag: "customTag" type: REVERSE
317 checkout very_nice_feature
318 commit id: "8"
319 checkout main
320 commit id: "9"
321 `,
322 {}
323 );
324 });
325 it('1433: should render a simple gitgraph with a title', () => {
326 imgSnapshotTest(
327 `---
328title: simple gitGraph
329---
330gitGraph
331 commit id: "1-abcdefg"
332`,
333 {}
334 );
335 });
336 it('15: should render a simple gitgraph with commit on main branch | Vertical Branch', () => {
337 imgSnapshotTest(
338 `gitGraph TB:
339 commit id: "1"
340 commit id: "2"
341 commit id: "3"
342 `,
343 {}
344 );
345 });
346 it('16: should render a simple gitgraph with commit on main branch with id | Vertical Branch', () => {
347 imgSnapshotTest(
348 `gitGraph TB:
349 commit id: "One"
350 commit id: "Two"
351 commit id: "Three"
352 `,
353 {}
354 );
355 });
356 it('17: should render a simple gitgraph with different commitTypes on main branch | Vertical Branch', () => {
357 imgSnapshotTest(
358 `gitGraph TB:
359 commit id: "Normal Commit"
360 commit id: "Reverse Commit" type: REVERSE
361 commit id: "Highlight Commit" type: HIGHLIGHT
362 `,
363 {}
364 );
365 });
366 it('18: should render a simple gitgraph with tags commitTypes on main branch | Vertical Branch', () => {
367 imgSnapshotTest(
368 `gitGraph TB:
369 commit id: "Normal Commit with tag" tag: "v1.0.0"
370 commit id: "Reverse Commit with tag" type: REVERSE tag: "RC_1"
371 commit id: "Highlight Commit" type: HIGHLIGHT tag: "8.8.4"
372 `,
373 {}
374 );
375 });
376 it('19: should render a simple gitgraph with two branches | Vertical Branch', () => {
377 imgSnapshotTest(
378 `gitGraph TB:
379 commit id: "1"
380 commit id: "2"
381 branch develop
382 checkout develop
383 commit id: "3"
384 commit id: "4"
385 checkout main
386 commit id: "5"
387 commit id: "6"
388 `,
389 {}
390 );
391 });
392 it('20: should render a simple gitgraph with two branches and merge commit | Vertical Branch', () => {
393 imgSnapshotTest(
394 `gitGraph TB:
395 commit id: "1"
396 commit id: "2"
397 branch develop
398 checkout develop
399 commit id: "3"
400 commit id: "4"
401 checkout main
402 merge develop
403 commit id: "5"
404 commit id: "6"
405 `,
406 {}
407 );
408 });
409 it('21: should render a simple gitgraph with three branches and tagged merge commit | Vertical Branch', () => {
410 imgSnapshotTest(
411 `gitGraph TB:
412 commit id: "1"
413 commit id: "2"
414 branch nice_feature
415 checkout nice_feature
416 commit id: "3"
417 checkout main
418 commit id: "4"
419 checkout nice_feature
420 branch very_nice_feature
421 checkout very_nice_feature
422 commit id: "5"
423 checkout main
424 commit id: "6"
425 checkout nice_feature
426 commit id: "7"
427 checkout main
428 merge nice_feature id: "12345" tag: "my merge commit"
429 checkout very_nice_feature
430 commit id: "8"
431 checkout main
432 commit id: "9"
433 `,
434 {}
435 );
436 });
437 it('22: should render a simple gitgraph with more than 8 branches & overriding variables | Vertical Branch', () => {
438 imgSnapshotTest(
439 `%%{init: { 'logLevel': 'debug', 'theme': 'default' , 'themeVariables': {
440 'gitBranchLabel0': '#ffffff',
441 'gitBranchLabel1': '#ffffff',
442 'gitBranchLabel2': '#ffffff',
443 'gitBranchLabel3': '#ffffff',
444 'gitBranchLabel4': '#ffffff',
445 'gitBranchLabel5': '#ffffff',
446 'gitBranchLabel6': '#ffffff',
447 'gitBranchLabel7': '#ffffff',
448 } } }%%
449 gitGraph TB:
450 checkout main
451 branch branch1
452 branch branch2
453 branch branch3
454 branch branch4
455 branch branch5
456 branch branch6
457 branch branch7
458 branch branch8
459 branch branch9
460 checkout branch1
461 commit id: "1"
462 `,
463 {}
464 );
465 });
466 it('23: should render a simple gitgraph with rotated labels | Vertical Branch', () => {
467 imgSnapshotTest(
468 `%%{init: { 'logLevel': 'debug', 'theme': 'default' , 'gitGraph': {
469 'rotateCommitLabel': true
470 } } }%%
471 gitGraph TB:
472 commit id: "75f7219e83b321cd3fdde7dcf83bc7c1000a6828"
473 commit id: "0db4784daf82736dec4569e0dc92980d328c1f2e"
474 commit id: "7067e9973f9eaa6cd4a4b723c506d1eab598e83e"
475 commit id: "66972321ad6c199013b5b31f03b3a86fa3f9817d"
476 `,
477 {}
478 );
479 });
480 it('24: should render a simple gitgraph with horizontal labels | Vertical Branch', () => {
481 imgSnapshotTest(
482 `%%{init: { 'logLevel': 'debug', 'theme': 'default' , 'gitGraph': {
483 'rotateCommitLabel': false
484 } } }%%
485 gitGraph TB:
486 commit id: "Alpha"
487 commit id: "Beta"
488 commit id: "Gamma"
489 commit id: "Delta"
490 `,
491 {}
492 );
493 });
494 it('25: should render a simple gitgraph with cherry pick commit | Vertical Branch', () => {
495 imgSnapshotTest(
496 `
497 gitGraph TB:
498 commit id: "ZERO"
499 branch develop
500 commit id:"A"
501 checkout main
502 commit id:"ONE"
503 checkout develop
504 commit id:"B"
505 checkout main
506 commit id:"TWO"
507 cherry-pick id:"A"
508 commit id:"THREE"
509 checkout develop
510 commit id:"C"
511 `,
512 {}
513 );
514 });
515 it('26: should render a gitgraph with cherry pick commit with custom tag | Vertical Branch', () => {
516 imgSnapshotTest(
517 `
518 gitGraph TB:
519 commit id: "ZERO"
520 branch develop
521 commit id:"A"
522 checkout main
523 commit id:"ONE"
524 checkout develop
525 commit id:"B"
526 checkout main
527 commit id:"TWO"
528 cherry-pick id:"A" tag: "snapshot"
529 commit id:"THREE"
530 checkout develop
531 commit id:"C"
532 `,
533 {}
534 );
535 });
536 it('27: should render a gitgraph with cherry pick commit with no tag | Vertical Branch', () => {
537 imgSnapshotTest(
538 `
539 gitGraph TB:
540 commit id: "ZERO"
541 branch develop
542 commit id:"A"
543 checkout main
544 commit id:"ONE"
545 checkout develop
546 commit id:"B"
547 checkout main
548 commit id:"TWO"
549 cherry-pick id:"A" tag: ""
550 commit id:"THREE"
551 checkout develop
552 commit id:"C"
553 `,
554 {}
555 );
556 });
557 it('28: should render a simple gitgraph with two cherry pick commit | Vertical Branch', () => {
558 imgSnapshotTest(
559 `
560 gitGraph TB:
561 commit id: "ZERO"
562 branch develop
563 commit id:"A"
564 checkout main
565 commit id:"ONE"
566 checkout develop
567 commit id:"B"
568 branch featureA
569 commit id:"FIX"
570 commit id: "FIX-2"
571 checkout main
572 commit id:"TWO"
573 cherry-pick id:"A"
574 commit id:"THREE"
575 cherry-pick id:"FIX"
576 checkout develop
577 commit id:"C"
578 merge featureA
579 `,
580 {}
581 );
582 });
583 it('29: should render commits for more than 8 branches | Vertical Branch', () => {
584 imgSnapshotTest(
585 `
586 gitGraph TB:
587 checkout main
588 %% Make sure to manually set the id of all commits, for consistent visual tests
589 commit id: "1-abcdefg"
590 checkout main
591 branch branch1
592 commit id: "2-abcdefg"
593 checkout main
594 merge branch1
595 branch branch2
596 commit id: "3-abcdefg"
597 checkout main
598 merge branch2
599 branch branch3
600 commit id: "4-abcdefg"
601 checkout main
602 merge branch3
603 branch branch4
604 commit id: "5-abcdefg"
605 checkout main
606 merge branch4
607 branch branch5
608 commit id: "6-abcdefg"
609 checkout main
610 merge branch5
611 branch branch6
612 commit id: "7-abcdefg"
613 checkout main
614 merge branch6
615 branch branch7
616 commit id: "8-abcdefg"
617 checkout main
618 merge branch7
619 branch branch8
620 commit id: "9-abcdefg"
621 checkout main
622 merge branch8
623 branch branch9
624 commit id: "10-abcdefg"
625 `,
626 {}
627 );
628 });
629 it('30: should render a simple gitgraph with three branches,custom merge commit id,tag,type | Vertical Branch', () => {
630 imgSnapshotTest(
631 `gitGraph TB:
632 commit id: "1"
633 commit id: "2"
634 branch nice_feature
635 checkout nice_feature
636 commit id: "3"
637 checkout main
638 commit id: "4"
639 checkout nice_feature
640 branch very_nice_feature
641 checkout very_nice_feature
642 commit id: "5"
643 checkout main
644 commit id: "6"
645 checkout nice_feature
646 commit id: "7"
647 checkout main
648 merge nice_feature id: "customID" tag: "customTag" type: REVERSE
649 checkout very_nice_feature
650 commit id: "8"
651 checkout main
652 commit id: "9"
653 `,
654 {}
655 );
656 });
657 it('31: should render a simple gitgraph with a title | Vertical Branch', () => {
658 imgSnapshotTest(
659 `---
660title: simple gitGraph
661---
662gitGraph TB:
663 commit id: "1-abcdefg"
664`,
665 {}
666 );
667 });
668 it('32: should render a simple gitgraph overlapping commits | Vertical Branch', () => {
669 imgSnapshotTest(
670 `gitGraph TB:
671 commit id:"s1"
672 commit id:"s2"
673 branch branch1
674 commit id:"s3"
675 commit id:"s4"
676 checkout main
677 commit id:"s5"
678 checkout branch1
679 commit id:"s6"
680 commit id:"s7"
681 merge main
682 `,
683 {}
684 );
685 });
686 it('33: should render a simple gitgraph overlapping commits', () => {
687 imgSnapshotTest(
688 `gitGraph
689 commit id:"s1"
690 commit id:"s2"
691 branch branch1
692 commit id:"s3"
693 commit id:"s4"
694 checkout main
695 commit id:"s5"
696 checkout branch1
697 commit id:"s6"
698 commit id:"s7"
699 merge main
700 `,
701 {}
702 );
703 });
704 it('34: should render a simple gitgraph with two branches from same commit', () => {
705 imgSnapshotTest(
706 `gitGraph
707 commit id:"1-abcdefg"
708 commit id:"2-abcdefg"
709 branch feature-001
710 commit id:"3-abcdefg"
711 commit id:"4-abcdefg"
712 checkout main
713 branch feature-002
714 commit id:"5-abcdefg"
715 checkout feature-001
716 merge feature-002
717 `,
718 {}
719 );
720 });
721 it('35: should render a simple gitgraph with two branches from same commit | Vertical Branch', () => {
722 imgSnapshotTest(
723 `gitGraph TB:
724 commit id:"1-abcdefg"
725 commit id:"2-abcdefg"
726 branch feature-001
727 commit id:"3-abcdefg"
728 commit id:"4-abcdefg"
729 checkout main
730 branch feature-002
731 commit id:"5-abcdefg"
732 checkout feature-001
733 merge feature-002
734 `,
735 {}
736 );
737 });
738 it('36: should render GitGraph with branch that is not used immediately', () => {
739 imgSnapshotTest(
740 `gitGraph LR:
741 commit id:"1-abcdefg"
742 branch x
743 checkout main
744 commit id:"2-abcdefg"
745 checkout x
746 commit id:"3-abcdefg"
747 checkout main
748 merge x
749 `,
750 {}
751 );
752 });
753 it('37: should render GitGraph with branch that is not used immediately | Vertical Branch', () => {
754 imgSnapshotTest(
755 `gitGraph TB:
756 commit id:"1-abcdefg"
757 branch x
758 checkout main
759 commit id:"2-abcdefg"
760 checkout x
761 commit id:"3-abcdefg"
762 checkout main
763 merge x
764 `,
765 {}
766 );
767 });
768 it('38: should render GitGraph with branch and sub-branch neither of which used immediately', () => {
769 imgSnapshotTest(
770 `gitGraph LR:
771 commit id:"1-abcdefg"
772 branch x
773 checkout main
774 commit id:"2-abcdefg"
775 checkout x
776 commit id:"3-abcdefg"
777 checkout main
778 merge x
779 checkout x
780 branch y
781 checkout x
782 commit id:"4-abcdefg"
783 checkout y
784 commit id:"5-abcdefg"
785 checkout x
786 merge y
787 `,
788 {}
789 );
790 });
791 it('39: should render GitGraph with branch and sub-branch neither of which used immediately | Vertical Branch', () => {
792 imgSnapshotTest(
793 `gitGraph TB:
794 commit id:"1-abcdefg"
795 branch x
796 checkout main
797 commit id:"2-abcdefg"
798 checkout x
799 commit id:"3-abcdefg"
800 checkout main
801 merge x
802 checkout x
803 branch y
804 checkout x
805 commit id:"4-abcdefg"
806 checkout y
807 commit id:"5-abcdefg"
808 checkout x
809 merge y
810 `,
811 {}
812 );
813 });
814 it('40: should render a simple gitgraph with cherry pick merge commit', () => {
815 imgSnapshotTest(
816 `gitGraph
817 commit id: "ZERO"
818 branch feature
819 branch release
820 checkout feature
821 commit id: "A"
822 commit id: "B"
823 checkout main
824 merge feature id: "M"
825 checkout release
826 cherry-pick id: "M" parent:"B"`
827 );
828 });
829 it('41: should render default GitGraph with parallelCommits set to false', () => {
830 imgSnapshotTest(
831 `gitGraph
832 commit id:"1-abcdefg"
833 commit id:"2-abcdefg"
834 branch develop
835 commit id:"3-abcdefg"
836 commit id:"4-abcdefg"
837 checkout main
838 branch feature
839 commit id:"5-abcdefg"
840 commit id:"6-abcdefg"
841 checkout main
842 commit id:"7-abcdefg"
843 commit id:"8-abcdefg"
844 `,
845 { gitGraph: { parallelCommits: false } }
846 );
847 });
848 it('42: should render GitGraph with parallel commits', () => {
849 imgSnapshotTest(
850 `gitGraph
851 commit id:"1-abcdefg"
852 commit id:"2-abcdefg"
853 branch develop
854 commit id:"3-abcdefg"
855 commit id:"4-abcdefg"
856 checkout main
857 branch feature
858 commit id:"5-abcdefg"
859 commit id:"6-abcdefg"
860 checkout main
861 commit id:"7-abcdefg"
862 commit id:"8-abcdefg"
863 `,
864 { gitGraph: { parallelCommits: true } }
865 );
866 });
867 it('43: should render GitGraph with parallel commits | Vertical Branch', () => {
868 imgSnapshotTest(
869 `gitGraph TB:
870 commit id:"1-abcdefg"
871 commit id:"2-abcdefg"
872 branch develop
873 commit id:"3-abcdefg"
874 commit id:"4-abcdefg"
875 checkout main
876 branch feature
877 commit id:"5-abcdefg"
878 commit id:"6-abcdefg"
879 checkout main
880 commit id:"7-abcdefg"
881 commit id:"8-abcdefg"
882 `,
883 { gitGraph: { parallelCommits: true } }
884 );
885 });
886 it('44: should render GitGraph with unconnected branches and no parallel commits', () => {
887 imgSnapshotTest(
888 `gitGraph
889 branch dev
890 branch v2
891 branch feat
892 commit id:"1-abcdefg"
893 commit id:"2-abcdefg"
894 checkout main
895 commit id:"3-abcdefg"
896 checkout dev
897 commit id:"4-abcdefg"
898 checkout v2
899 commit id:"5-abcdefg"
900 checkout main
901 commit id:"6-abcdefg"
902 `,
903 { gitGraph: { parallelCommits: false } }
904 );
905 });
906 it('45: should render GitGraph with unconnected branches and parallel commits', () => {
907 imgSnapshotTest(
908 `gitGraph
909 branch dev
910 branch v2
911 branch feat
912 commit id:"1-abcdefg"
913 commit id:"2-abcdefg"
914 checkout main
915 commit id:"3-abcdefg"
916 checkout dev
917 commit id:"4-abcdefg"
918 checkout v2
919 commit id:"5-abcdefg"
920 checkout main
921 commit id:"6-abcdefg"
922 `,
923 { gitGraph: { parallelCommits: true } }
924 );
925 });
926 it('46: should render GitGraph with unconnected branches and parallel commits | Vertical Branch', () => {
927 imgSnapshotTest(
928 `gitGraph TB:
929 branch dev
930 branch v2
931 branch feat
932 commit id:"1-abcdefg"
933 commit id:"2-abcdefg"
934 checkout main
935 commit id:"3-abcdefg"
936 checkout dev
937 commit id:"4-abcdefg"
938 checkout v2
939 commit id:"5-abcdefg"
940 checkout main
941 commit id:"6-abcdefg"
942 `,
943 { gitGraph: { parallelCommits: true } }
944 );
945 });
946 it('46: should render GitGraph with merge back and merge forward', () => {
947 imgSnapshotTest(
948 `gitGraph LR:
949 commit id:"1-abcdefg"
950
951 branch branch-A
952 branch branch-B
953 commit id:"2-abcdefg"
954
955 checkout branch-A
956 merge branch-B
957
958 checkout branch-B
959 merge branch-A
960 `,
961 { gitGraph: { parallelCommits: true } }
962 );
963 });
964 it('47: should render GitGraph with merge back and merge forward | Vertical Branch', () => {
965 imgSnapshotTest(
966 `gitGraph TB:
967 commit id:"1-abcdefg"
968
969 branch branch-A
970 branch branch-B
971 commit id:"2-abcdefg"
972
973 checkout branch-A
974 merge branch-B
975
976 checkout branch-B
977 merge branch-A
978 `,
979 { gitGraph: { parallelCommits: true } }
980 );
981 });
982 it('48: should render GitGraph with merge on a new branch | Vertical Branch', () => {
983 imgSnapshotTest(
984 `gitGraph LR:
985 commit id:"1-abcdefg"
986
987 branch branch-B order: 2
988 commit id:"2-abcdefg"
989
990 branch branch-A
991 merge main
992
993 checkout branch-B
994 merge branch-A
995 `,
996 { gitGraph: { parallelCommits: true } }
997 );
998 });
999 it('49: should render GitGraph with merge on a new branch | Vertical Branch', () => {
1000 imgSnapshotTest(
1001 `gitGraph TB:
1002 commit id:"1-abcdefg"
1003
1004 branch branch-B order: 2
1005 commit id:"2-abcdefg"
1006
1007 branch branch-A
1008 merge main
1009
1010 checkout branch-B
1011 merge branch-A
1012 `,
1013 { gitGraph: { parallelCommits: true } }
1014 );
1015 });
1016 describe('Git-Graph Bottom-to-Top Orientation Tests', () => {
1017 it('50: should render a simple gitgraph with commit on main branch | Vertical Branch - Bottom-to-top', () => {
1018 imgSnapshotTest(
1019 `gitGraph BT:
1020 commit id: "1"
1021 commit id: "2"
1022 commit id: "3"
1023 `,
1024 {}
1025 );
1026 });
1027 it('51: should render a simple gitgraph with commit on main branch with id | Vertical Branch - Bottom-to-top', () => {
1028 imgSnapshotTest(
1029 `gitGraph BT:
1030 commit id: "One"
1031 commit id: "Two"
1032 commit id: "Three"
1033 `,
1034 {}
1035 );
1036 });
1037 it('52: should render a simple gitgraph with different commitTypes on main branch | Vertical Branch - Bottom-to-top', () => {
1038 imgSnapshotTest(
1039 `gitGraph BT:
1040 commit id: "Normal Commit"
1041 commit id: "Reverse Commit" type: REVERSE
1042 commit id: "Highlight Commit" type: HIGHLIGHT
1043 `,
1044 {}
1045 );
1046 });
1047 it('53: should render a simple gitgraph with tags commitTypes on main branch | Vertical Branch - Bottom-to-top', () => {
1048 imgSnapshotTest(
1049 `gitGraph BT:
1050 commit id: "Normal Commit with tag" tag: "v1.0.0"
1051 commit id: "Reverse Commit with tag" type: REVERSE tag: "RC_1"
1052 commit id: "Highlight Commit" type: HIGHLIGHT tag: "8.8.4"
1053 `,
1054 {}
1055 );
1056 });
1057 it('54: should render a simple gitgraph with two branches | Vertical Branch - Bottom-to-top', () => {
1058 imgSnapshotTest(
1059 `gitGraph BT:
1060 commit id: "1"
1061 commit id: "2"
1062 branch develop
1063 checkout develop
1064 commit id: "3"
1065 commit id: "4"
1066 checkout main
1067 commit id: "5"
1068 commit id: "6"
1069 `,
1070 {}
1071 );
1072 });
1073 it('55: should render a simple gitgraph with two branches and merge commit | Vertical Branch - Bottom-to-top', () => {
1074 imgSnapshotTest(
1075 `gitGraph BT:
1076 commit id: "1"
1077 commit id: "2"
1078 branch develop
1079 checkout develop
1080 commit id: "3"
1081 commit id: "4"
1082 checkout main
1083 merge develop
1084 commit id: "5"
1085 commit id: "6"
1086 `,
1087 {}
1088 );
1089 });
1090 it('56: should render a simple gitgraph with three branches and tagged merge commit | Vertical Branch - Bottom-to-top', () => {
1091 imgSnapshotTest(
1092 `gitGraph BT:
1093 commit id: "1"
1094 commit id: "2"
1095 branch nice_feature
1096 checkout nice_feature
1097 commit id: "3"
1098 checkout main
1099 commit id: "4"
1100 checkout nice_feature
1101 branch very_nice_feature
1102 checkout very_nice_feature
1103 commit id: "5"
1104 checkout main
1105 commit id: "6"
1106 checkout nice_feature
1107 commit id: "7"
1108 checkout main
1109 merge nice_feature id: "12345" tag: "my merge commit"
1110 checkout very_nice_feature
1111 commit id: "8"
1112 checkout main
1113 commit id: "9"
1114 `,
1115 {}
1116 );
1117 });
1118 it('57: should render a simple gitgraph with more than 8 branches & overriding variables | Vertical Branch - Bottom-to-top', () => {
1119 imgSnapshotTest(
1120 `%%{init: { 'logLevel': 'debug', 'theme': 'default' , 'themeVariables': {
1121 'gitBranchLabel0': '#ffffff',
1122 'gitBranchLabel1': '#ffffff',
1123 'gitBranchLabel2': '#ffffff',
1124 'gitBranchLabel3': '#ffffff',
1125 'gitBranchLabel4': '#ffffff',
1126 'gitBranchLabel5': '#ffffff',
1127 'gitBranchLabel6': '#ffffff',
1128 'gitBranchLabel7': '#ffffff',
1129 } } }%%
1130 gitGraph BT:
1131 checkout main
1132 branch branch1
1133 branch branch2
1134 branch branch3
1135 branch branch4
1136 branch branch5
1137 branch branch6
1138 branch branch7
1139 branch branch8
1140 branch branch9
1141 checkout branch1
1142 commit id: "1"
1143 `,
1144 {}
1145 );
1146 });
1147 it('58: should render a simple gitgraph with rotated labels | Vertical Branch - Bottom-to-top', () => {
1148 imgSnapshotTest(
1149 `%%{init: { 'logLevel': 'debug', 'theme': 'default' , 'gitGraph': {
1150 'rotateCommitLabel': true
1151 } } }%%
1152 gitGraph BT:
1153 commit id: "75f7219e83b321cd3fdde7dcf83bc7c1000a6828"
1154 commit id: "0db4784daf82736dec4569e0dc92980d328c1f2e"
1155 commit id: "7067e9973f9eaa6cd4a4b723c506d1eab598e83e"
1156 commit id: "66972321ad6c199013b5b31f03b3a86fa3f9817d"
1157 `,
1158 {}
1159 );
1160 });
1161 it('59: should render a simple gitgraph with horizontal labels | Vertical Branch - Bottom-to-top', () => {
1162 imgSnapshotTest(
1163 `%%{init: { 'logLevel': 'debug', 'theme': 'default' , 'gitGraph': {
1164 'rotateCommitLabel': false
1165 } } }%%
1166 gitGraph BT:
1167 commit id: "Alpha"
1168 commit id: "Beta"
1169 commit id: "Gamma"
1170 commit id: "Delta"
1171 `,
1172 {}
1173 );
1174 });
1175 it('60: should render a simple gitgraph with cherry pick commit | Vertical Branch - Bottom-to-top', () => {
1176 imgSnapshotTest(
1177 `
1178 gitGraph BT:
1179 commit id: "ZERO"
1180 branch develop
1181 commit id:"A"
1182 checkout main
1183 commit id:"ONE"
1184 checkout develop
1185 commit id:"B"
1186 checkout main
1187 commit id:"TWO"
1188 cherry-pick id:"A"
1189 commit id:"THREE"
1190 checkout develop
1191 commit id:"C"
1192 `,
1193 {}
1194 );
1195 });
1196 it('61: should render a gitgraph with cherry pick commit with custom tag | Vertical Branch - Bottom-to-top', () => {
1197 imgSnapshotTest(
1198 `
1199 gitGraph BT:
1200 commit id: "ZERO"
1201 branch develop
1202 commit id:"A"
1203 checkout main
1204 commit id:"ONE"
1205 checkout develop
1206 commit id:"B"
1207 checkout main
1208 commit id:"TWO"
1209 cherry-pick id:"A" tag: "snapshot"
1210 commit id:"THREE"
1211 checkout develop
1212 commit id:"C"
1213 `,
1214 {}
1215 );
1216 });
1217 it('62: should render a gitgraph with cherry pick commit with no tag | Vertical Branch - Bottom-to-top', () => {
1218 imgSnapshotTest(
1219 `
1220 gitGraph BT:
1221 commit id: "ZERO"
1222 branch develop
1223 commit id:"A"
1224 checkout main
1225 commit id:"ONE"
1226 checkout develop
1227 commit id:"B"
1228 checkout main
1229 commit id:"TWO"
1230 cherry-pick id:"A" tag: ""
1231 commit id:"THREE"
1232 checkout develop
1233 commit id:"C"
1234 `,
1235 {}
1236 );
1237 });
1238 it('63: should render a simple gitgraph with two cherry pick commit | Vertical Branch - Bottom-to-top', () => {
1239 imgSnapshotTest(
1240 `
1241 gitGraph BT:
1242 commit id: "ZERO"
1243 branch develop
1244 commit id:"A"
1245 checkout main
1246 commit id:"ONE"
1247 checkout develop
1248 commit id:"B"
1249 branch featureA
1250 commit id:"FIX"
1251 commit id: "FIX-2"
1252 checkout main
1253 commit id:"TWO"
1254 cherry-pick id:"A"
1255 commit id:"THREE"
1256 cherry-pick id:"FIX"
1257 checkout develop
1258 commit id:"C"
1259 merge featureA
1260 `,
1261 {}
1262 );
1263 });
1264 it('64: should render commits for more than 8 branches | Vertical Branch - Bottom-to-top', () => {
1265 imgSnapshotTest(
1266 `
1267 gitGraph BT:
1268 checkout main
1269 %% Make sure to manually set the id of all commits, for consistent visual tests
1270 commit id: "1-abcdefg"
1271 checkout main
1272 branch branch1
1273 commit id: "2-abcdefg"
1274 checkout main
1275 merge branch1
1276 branch branch2
1277 commit id: "3-abcdefg"
1278 checkout main
1279 merge branch2
1280 branch branch3
1281 commit id: "4-abcdefg"
1282 checkout main
1283 merge branch3
1284 branch branch4
1285 commit id: "5-abcdefg"
1286 checkout main
1287 merge branch4
1288 branch branch5
1289 commit id: "6-abcdefg"
1290 checkout main
1291 merge branch5
1292 branch branch6
1293 commit id: "7-abcdefg"
1294 checkout main
1295 merge branch6
1296 branch branch7
1297 commit id: "8-abcdefg"
1298 checkout main
1299 merge branch7
1300 branch branch8
1301 commit id: "9-abcdefg"
1302 checkout main
1303 merge branch8
1304 branch branch9
1305 commit id: "10-abcdefg"
1306 `,
1307 {}
1308 );
1309 });
1310 it('65: should render a simple gitgraph with three branches,custom merge commit id,tag,type | Vertical Branch - Bottom-to-top', () => {
1311 imgSnapshotTest(
1312 `gitGraph BT:
1313 commit id: "1"
1314 commit id: "2"
1315 branch nice_feature
1316 checkout nice_feature
1317 commit id: "3"
1318 checkout main
1319 commit id: "4"
1320 checkout nice_feature
1321 branch very_nice_feature
1322 checkout very_nice_feature
1323 commit id: "5"
1324 checkout main
1325 commit id: "6"
1326 checkout nice_feature
1327 commit id: "7"
1328 checkout main
1329 merge nice_feature id: "customID" tag: "customTag" type: REVERSE
1330 checkout very_nice_feature
1331 commit id: "8"
1332 checkout main
1333 commit id: "9"
1334 `,
1335 {}
1336 );
1337 });
1338 it('66: should render a simple gitgraph with a title | Vertical Branch - Bottom-to-top', () => {
1339 imgSnapshotTest(
1340 `---
1341 title: simple gitGraph
1342 ---
1343 gitGraph BT:
1344 commit id: "1-abcdefg"
1345 `,
1346 {}
1347 );
1348 });
1349 it('67: should render a simple gitgraph overlapping commits | Vertical Branch - Bottom-to-top', () => {
1350 imgSnapshotTest(
1351 `gitGraph BT:
1352 commit id:"s1"
1353 commit id:"s2"
1354 branch branch1
1355 commit id:"s3"
1356 commit id:"s4"
1357 checkout main
1358 commit id:"s5"
1359 checkout branch1
1360 commit id:"s6"
1361 commit id:"s7"
1362 merge main
1363 `,
1364 {}
1365 );
1366 });
1367 it('68: should render a simple gitgraph with two branches from same commit | Vertical Branch - Bottom-to-top', () => {
1368 imgSnapshotTest(
1369 `gitGraph BT:
1370 commit id:"1-abcdefg"
1371 commit id:"2-abcdefg"
1372 branch feature-001
1373 commit id:"3-abcdefg"
1374 commit id:"4-abcdefg"
1375 checkout main
1376 branch feature-002
1377 commit id:"5-abcdefg"
1378 checkout feature-001
1379 merge feature-002
1380 `,
1381 {}
1382 );
1383 });
1384 it('69: should render GitGraph with branch that is not used immediately | Vertical Branch - Bottom-to-top', () => {
1385 imgSnapshotTest(
1386 `gitGraph BT:
1387 commit id:"1-abcdefg"
1388 branch x
1389 checkout main
1390 commit id:"2-abcdefg"
1391 checkout x
1392 commit id:"3-abcdefg"
1393 checkout main
1394 merge x
1395 `,
1396 {}
1397 );
1398 });
1399 it('70: should render GitGraph with branch and sub-branch neither of which used immediately | Vertical Branch - Bottom-to-top', () => {
1400 imgSnapshotTest(
1401 `gitGraph BT:
1402 commit id:"1-abcdefg"
1403 branch x
1404 checkout main
1405 commit id:"2-abcdefg"
1406 checkout x
1407 commit id:"3-abcdefg"
1408 checkout main
1409 merge x
1410 checkout x
1411 branch y
1412 checkout x
1413 commit id:"4-abcdefg"
1414 checkout y
1415 commit id:"5-abcdefg"
1416 checkout x
1417 merge y
1418 `,
1419 {}
1420 );
1421 });
1422 it('71: should render GitGraph with parallel commits | Vertical Branch - Bottom-to-top', () => {
1423 imgSnapshotTest(
1424 `gitGraph BT:
1425 commit id:"1-abcdefg"
1426 commit id:"2-abcdefg"
1427 branch develop
1428 commit id:"3-abcdefg"
1429 commit id:"4-abcdefg"
1430 checkout main
1431 branch feature
1432 commit id:"5-abcdefg"
1433 commit id:"6-abcdefg"
1434 checkout main
1435 commit id:"7-abcdefg"
1436 commit id:"8-abcdefg"
1437 `,
1438 { gitGraph: { parallelCommits: true } }
1439 );
1440 });
1441 it('72: should render GitGraph with unconnected branches and parallel commits | Vertical Branch - Bottom-to-top', () => {
1442 imgSnapshotTest(
1443 `gitGraph BT:
1444 branch dev
1445 branch v2
1446 branch feat
1447 commit id:"1-abcdefg"
1448 commit id:"2-abcdefg"
1449 checkout main
1450 commit id:"3-abcdefg"
1451 checkout dev
1452 commit id:"4-abcdefg"
1453 checkout v2
1454 commit id:"5-abcdefg"
1455 checkout main
1456 commit id:"6-abcdefg"
1457 `,
1458 { gitGraph: { parallelCommits: true } }
1459 );
1460 });
1461 it('73: should render a simple gitgraph with three branches and tagged merge commit using switch instead of checkout', () => {
1462 imgSnapshotTest(
1463 `gitGraph
1464 commit id: "1"
1465 commit id: "2"
1466 branch nice_feature
1467 switch nice_feature
1468 commit id: "3"
1469 switch main
1470 commit id: "4"
1471 switch nice_feature
1472 branch very_nice_feature
1473 switch very_nice_feature
1474 commit id: "5"
1475 switch main
1476 commit id: "6"
1477 switch nice_feature
1478 commit id: "7"
1479 switch main
1480 merge nice_feature id: "12345" tag: "my merge commit"
1481 switch very_nice_feature
1482 commit id: "8"
1483 switch main
1484 commit id: "9"
1485 `,
1486 {}
1487 );
1488 });
1489 it('74: should render commits for more than 8 branches using switch instead of checkout', () => {
1490 imgSnapshotTest(
1491 `
1492 gitGraph
1493 switch main
1494 %% Make sure to manually set the id of all commits, for consistent visual tests
1495 commit id: "1-abcdefg"
1496 switch main
1497 branch branch1
1498 commit id: "2-abcdefg"
1499 switch main
1500 merge branch1
1501 branch branch2
1502 commit id: "3-abcdefg"
1503 switch main
1504 merge branch2
1505 branch branch3
1506 commit id: "4-abcdefg"
1507 switch main
1508 merge branch3
1509 branch branch4
1510 commit id: "5-abcdefg"
1511 switch main
1512 merge branch4
1513 branch branch5
1514 commit id: "6-abcdefg"
1515 switch main
1516 merge branch5
1517 branch branch6
1518 commit id: "7-abcdefg"
1519 switch main
1520 merge branch6
1521 branch branch7
1522 commit id: "8-abcdefg"
1523 switch main
1524 merge branch7
1525 branch branch8
1526 commit id: "9-abcdefg"
1527 switch main
1528 merge branch8
1529 branch branch9
1530 commit id: "10-abcdefg"
1531 `,
1532 {}
1533 );
1534 });
1535 it('75: should render a gitGraph with multiple tags on a merge commit on bottom-to-top orientation', () => {
1536 imgSnapshotTest(
1537 `gitGraph BT:
1538 commit id: "ZERO"
1539 branch develop
1540 commit id:"A"
1541 checkout main
1542 commit id:"ONE"
1543 checkout develop
1544 commit id:"B"
1545 checkout main
1546 merge develop id:"Release 1.0" type:HIGHLIGHT tag: "SAML v2.0" tag: "OpenID v1.1"
1547 commit id:"TWO"
1548 checkout develop
1549 commit id:"C"`,
1550 {}
1551 );
1552 });
1553 });
1554 it('76: should render a gitGraph with multiple tags on a merge commit on left-to-right orientation', () => {
1555 imgSnapshotTest(
1556 `gitGraph
1557 commit id: "ZERO"
1558 branch develop
1559 commit id:"A"
1560 checkout main
1561 commit id:"ONE"
1562 checkout develop
1563 commit id:"B"
1564 checkout main
1565 merge develop id:"Release 1.0" type:HIGHLIGHT tag: "SAML v2.0" tag: "OpenID v1.1"
1566 commit id:"TWO"
1567 checkout develop
1568 commit id:"C"`,
1569 {}
1570 );
1571 });
1572
1573 describe('showBranches and showCommitLabel directives', () => {
1574 it('77: should show branch lines when showBranches is true (default)', () => {
1575 imgSnapshotTest(
1576 `---
1577 config:
1578 gitGraph:
1579 showBranches: true
1580 showCommitLabel: true
1581 rotateCommitLabel: false
1582 parallelCommits: false
1583 ---
1584 gitGraph
1585 commit id: "1"
1586 commit id: "2"
1587 branch develop
1588 checkout develop
1589 commit id: "3"
1590 commit id: "4"
1591 checkout main
1592 commit id: "5"
1593 commit id: "6"
1594 `,
1595 {}
1596 );
1597 });
1598
1599 it('78: should hide branch lines when showBranches is false', () => {
1600 imgSnapshotTest(
1601 `---
1602 config:
1603 gitGraph:
1604 showBranches: false
1605 showCommitLabel: true
1606 rotateCommitLabel: false
1607 parallelCommits: false
1608 ---
1609 gitGraph
1610 commit id: "1"
1611 commit id: "2"
1612 branch develop
1613 checkout develop
1614 commit id: "3"
1615 commit id: "4"
1616 checkout main
1617 commit id: "5"
1618 commit id: "6"
1619 `,
1620 {}
1621 );
1622 });
1623
1624 it('79: should show commit labels when showCommitLabel is true (default)', () => {
1625 imgSnapshotTest(
1626 `---
1627 config:
1628 gitGraph:
1629 showBranches: true
1630 showCommitLabel: true
1631 rotateCommitLabel: false
1632 parallelCommits: false
1633 ---
1634 gitGraph
1635 commit id: "1"
1636 commit id: "2"
1637 branch develop
1638 checkout develop
1639 commit id: "3"
1640 commit id: "4"
1641 checkout main
1642 commit id: "5"
1643 commit id: "6"
1644 `,
1645 {}
1646 );
1647 });
1648
1649 it('80: should hide commit labels when showCommitLabel is false', () => {
1650 imgSnapshotTest(
1651 `---
1652 config:
1653 gitGraph:
1654 showBranches: true
1655 showCommitLabel: false
1656 rotateCommitLabel: false
1657 parallelCommits: false
1658 ---
1659 gitGraph
1660 commit id: "1"
1661 commit id: "2"
1662 branch develop
1663 checkout develop
1664 commit id: "3"
1665 commit id: "4"
1666 checkout main
1667 commit id: "5"
1668 commit id: "6"
1669 `,
1670 {}
1671 );
1672 });
1673
1674 it('81: should show both branches and commit labels when both directives are true (default)', () => {
1675 imgSnapshotTest(
1676 `---
1677 config:
1678 gitGraph:
1679 showBranches: true
1680 showCommitLabel: true
1681 rotateCommitLabel: false
1682 parallelCommits: false
1683 ---
1684 gitGraph
1685 commit id: "1"
1686 commit id: "2"
1687 branch develop
1688 checkout develop
1689 commit id: "3"
1690 commit id: "4"
1691 checkout main
1692 commit id: "5"
1693 commit id: "6"
1694 `,
1695 {}
1696 );
1697 });
1698
1699 it('82: should hide both branches and commit labels when both directives are false', () => {
1700 imgSnapshotTest(
1701 `---
1702 config:
1703 gitGraph:
1704 showBranches: false
1705 showCommitLabel: false
1706 rotateCommitLabel: false
1707 parallelCommits: false
1708 ---
1709 gitGraph
1710 commit id: "1"
1711 commit id: "2"
1712 branch develop
1713 checkout develop
1714 commit id: "3"
1715 commit id: "4"
1716 checkout main
1717 commit id: "5"
1718 commit id: "6"
1719 `,
1720 {}
1721 );
1722 });
1723
1724 it('83: should show branch lines with merge commits when showBranches is true', () => {
1725 imgSnapshotTest(
1726 `---
1727 config:
1728 gitGraph:
1729 showBranches: true
1730 showCommitLabel: true
1731 rotateCommitLabel: false
1732 parallelCommits: false
1733 ---
1734 gitGraph
1735 commit id: "1"
1736 commit id: "2"
1737 branch develop
1738 checkout develop
1739 commit id: "3"
1740 commit id: "4"
1741 checkout main
1742 merge develop
1743 commit id: "5"
1744 commit id: "6"
1745 `,
1746 {}
1747 );
1748 });
1749
1750 it('84: should hide branch lines with merge commits when showBranches is false', () => {
1751 imgSnapshotTest(
1752 `---
1753 config:
1754 gitGraph:
1755 showBranches: false
1756 showCommitLabel: true
1757 rotateCommitLabel: false
1758 parallelCommits: false
1759 ---
1760 gitGraph
1761 commit id: "1"
1762 commit id: "2"
1763 branch develop
1764 checkout develop
1765 commit id: "3"
1766 commit id: "4"
1767 checkout main
1768 merge develop
1769 commit id: "5"
1770 commit id: "6"
1771 `,
1772 {}
1773 );
1774 });
1775
1776 it('85: should show commit labels with tags when showCommitLabel is true', () => {
1777 imgSnapshotTest(
1778 `---
1779 config:
1780 gitGraph:
1781 showBranches: true
1782 showCommitLabel: true
1783 rotateCommitLabel: false
1784 parallelCommits: false
1785 ---
1786 gitGraph
1787 commit id: "1" tag: "v1.0"
1788 commit id: "2"
1789 branch develop
1790 checkout develop
1791 commit id: "3" tag: "v1.1"
1792 commit id: "4"
1793 checkout main
1794 merge develop tag: "v2.0"
1795 commit id: "5"
1796 `,
1797 {}
1798 );
1799 });
1800
1801 it('86: should hide commit labels with tags when showCommitLabel is false', () => {
1802 imgSnapshotTest(
1803 `---
1804 config:
1805 gitGraph:
1806 showBranches: true
1807 showCommitLabel: false
1808 rotateCommitLabel: false
1809 parallelCommits: false
1810 ---
1811 gitGraph
1812 commit id: "1" tag: "v1.0"
1813 commit id: "2"
1814 branch develop
1815 checkout develop
1816 commit id: "3" tag: "v1.1"
1817 commit id: "4"
1818 checkout main
1819 merge develop tag: "v2.0"
1820 commit id: "5"
1821 `,
1822 {}
1823 );
1824 });
1825
1826 it('87: should show branches with TB orientation when showBranches is true', () => {
1827 imgSnapshotTest(
1828 `---
1829 config:
1830 gitGraph:
1831 showBranches: true
1832 showCommitLabel: true
1833 rotateCommitLabel: false
1834 parallelCommits: false
1835 ---
1836 gitGraph TB:
1837 commit id: "1"
1838 commit id: "2"
1839 branch develop
1840 checkout develop
1841 commit id: "3"
1842 commit id: "4"
1843 checkout main
1844 commit id: "5"
1845 `,
1846 {}
1847 );
1848 });
1849
1850 it('88: should hide branches with TB orientation when showBranches is false', () => {
1851 imgSnapshotTest(
1852 `---
1853 config:
1854 gitGraph:
1855 showBranches: false
1856 showCommitLabel: true
1857 rotateCommitLabel: false
1858 parallelCommits: false
1859 ---
1860 gitGraph TB:
1861 commit id: "1"
1862 commit id: "2"
1863 branch develop
1864 checkout develop
1865 commit id: "3"
1866 commit id: "4"
1867 checkout main
1868 commit id: "5"
1869 `,
1870 {}
1871 );
1872 });
1873
1874 it('89: should show commit labels with BT orientation when showCommitLabel is true', () => {
1875 imgSnapshotTest(
1876 `---
1877 config:
1878 gitGraph:
1879 showBranches: true
1880 showCommitLabel: true
1881 rotateCommitLabel: false
1882 parallelCommits: false
1883 ---
1884 gitGraph BT:
1885 commit id: "1"
1886 commit id: "2"
1887 branch develop
1888 checkout develop
1889 commit id: "3"
1890 commit id: "4"
1891 checkout main
1892 commit id: "5"
1893 `,
1894 {}
1895 );
1896 });
1897
1898 it('90: should hide commit labels with BT orientation when showCommitLabel is false', () => {
1899 imgSnapshotTest(
1900 `---
1901 config:
1902 gitGraph:
1903 showBranches: true
1904 showCommitLabel: false
1905 rotateCommitLabel: false
1906 parallelCommits: false
1907 ---
1908 gitGraph BT:
1909 commit id: "1"
1910 commit id: "2"
1911 branch develop
1912 checkout develop
1913 commit id: "3"
1914 commit id: "4"
1915 checkout main
1916 commit id: "5"
1917 `,
1918 {}
1919 );
1920 });
1921
1922 it('91: should render with rotateCommitLabel set to true', () => {
1923 imgSnapshotTest(
1924 `---
1925 config:
1926 gitGraph:
1927 showBranches: true
1928 showCommitLabel: true
1929 rotateCommitLabel: true
1930 parallelCommits: false
1931 ---
1932 gitGraph
1933 commit id: "Alpha"
1934 commit id: "Beta"
1935 branch develop
1936 checkout develop
1937 commit id: "Gamma"
1938 commit id: "Delta"
1939 checkout main
1940 commit id: "Epsilon"
1941 `,
1942 {}
1943 );
1944 });
1945
1946 it('92: should render with rotateCommitLabel set to false', () => {
1947 imgSnapshotTest(
1948 `---
1949 config:
1950 gitGraph:
1951 showBranches: true
1952 showCommitLabel: true
1953 rotateCommitLabel: false
1954 parallelCommits: false
1955 ---
1956 gitGraph
1957 commit id: "Alpha"
1958 commit id: "Beta"
1959 branch develop
1960 checkout develop
1961 commit id: "Gamma"
1962 commit id: "Delta"
1963 checkout main
1964 commit id: "Epsilon"
1965 `,
1966 {}
1967 );
1968 });
1969
1970 it('93: should render with parallelCommits set to true', () => {
1971 imgSnapshotTest(
1972 `---
1973 config:
1974 gitGraph:
1975 showBranches: true
1976 showCommitLabel: true
1977 rotateCommitLabel: false
1978 parallelCommits: true
1979 ---
1980 gitGraph
1981 commit id: "1"
1982 commit id: "2"
1983 branch develop
1984 branch feature
1985 checkout develop
1986 commit id: "3"
1987 checkout feature
1988 commit id: "4"
1989 checkout main
1990 commit id: "5"
1991 checkout develop
1992 commit id: "6"
1993 checkout feature
1994 commit id: "7"
1995 `,
1996 {}
1997 );
1998 });
1999
2000 it('94: should render with parallelCommits set to false', () => {
2001 imgSnapshotTest(
2002 `---
2003 config:
2004 gitGraph:
2005 showBranches: true
2006 showCommitLabel: true
2007 rotateCommitLabel: false
2008 parallelCommits: false
2009 ---
2010 gitGraph
2011 commit id: "1"
2012 commit id: "2"
2013 branch develop
2014 branch feature
2015 checkout develop
2016 commit id: "3"
2017 checkout feature
2018 commit id: "4"
2019 checkout main
2020 commit id: "5"
2021 checkout develop
2022 commit id: "6"
2023 checkout feature
2024 commit id: "7"
2025 `,
2026 {}
2027 );
2028 });
2029
2030 it('95: should render with custom mainBranchName', () => {
2031 imgSnapshotTest(
2032 `---
2033 config:
2034 gitGraph:
2035 showBranches: true
2036 showCommitLabel: true
2037 rotateCommitLabel: false
2038 parallelCommits: false
2039 mainBranchName: 'trunk'
2040 ---
2041 gitGraph
2042 commit id: "1"
2043 commit id: "2"
2044 branch develop
2045 checkout develop
2046 commit id: "3"
2047 commit id: "4"
2048 checkout trunk
2049 commit id: "5"
2050 commit id: "6"
2051 `,
2052 {}
2053 );
2054 });
2055
2056 it('96: should render with custom mainBranchOrder', () => {
2057 imgSnapshotTest(
2058 `---
2059 config:
2060 gitGraph:
2061 showBranches: true
2062 showCommitLabel: true
2063 rotateCommitLabel: false
2064 parallelCommits: false
2065 mainBranchOrder: 2
2066 ---
2067 gitGraph
2068 commit id: "1"
2069 branch feature1
2070 branch feature2
2071 checkout feature1
2072 commit id: "2"
2073 checkout feature2
2074 commit id: "3"
2075 checkout main
2076 commit id: "4"
2077 `,
2078 {}
2079 );
2080 });
2081 });
2082});
2083