public void ParsingEmptyGitHistory()
        {
            var commits = Array.Empty <CommitInfoWrapper>();

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
            result.Version.Commits.ShouldBe(0);
        }
Beispiel #2
0
        public void ParseSingleFixTagCommit()
        {
            var commits = new[]
            {
                new CommitInfoWrapper(true, "1.0.1", "fix: some kind of bugfix"),
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
        }
Beispiel #3
0
        public void ParseSingleFeatureTagCommit()
        {
            var commits = new[]
            {
                new CommitInfoWrapper(true, "1.1.0", "feat: some kind of new feature")
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
        }
Beispiel #4
0
        public void ParseNonChangelogCommit()
        {
            var commits = new[]
            {
                new CommitInfoWrapper(true, "1.0.1", "chore: some update"),
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
        }
        public void ParsingTagWithoutPreviousCommits()
        {
            var commits = new[]
            {
                new CommitInfoWrapper(true, "1.5.2", "feat: some feature")
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
            result.Version.Commits.ShouldBe(1);
        }
        public void ParsingSingleFeatureCommit()
        {
            var commits = new[]
            {
                new CommitInfoWrapper("feat: some kind of awesome feature"),
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
            result.Version.Commits.ShouldBe(1);
        }
        public void ParsingSingleFixCommit()
        {
            var commits = new[]
            {
                new CommitInfoWrapper("fix: correct unintentional bug"),
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
            result.Version.Commits.ShouldBe(1);
        }
        public void ParsingUnstableTaggedFeatureCommit()
        {
            var commits = new[]
            {
                new CommitInfoWrapper(true, "1.3.0-alpha.1", "feat: some awesome feature")
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
            result.Version.Commits.ShouldBe(1);
        }
        public void ParsingTaggedCommitWithoutVersion()
        {
            var commits = new[]
            {
                new CommitInfoWrapper(true, "invalid", "feat: test commit")
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
            result.Version.Commits.ShouldBe(1);
        }
        public void ParsingTaggedNonAlphaCommit()
        {
            var commits = new[]
            {
                new CommitInfoWrapper(true, "1.3.3-beta.5", "fix: yup this happened")
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
            result.Version.Commits.ShouldBe(1);
        }
        public void ParsingMultipleUnstableFeatureCommitsWithTag()
        {
            var commits = new[]
            {
                new CommitInfoWrapper(true, "1.4.4-alpha.1", "feat: awesome: tag commit"),
                new CommitInfoWrapper("feat: this is just a commit")
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
            result.Version.Commits.ShouldBe(2);
        }
        public void ParsingCommitWithBreakingBody()
        {
            var commits = new[]
            {
                new CommitInfoWrapper("feat: some new feature\n\nSome body\n\nBREAKING CHANGE: Important breaking change"),
                new CommitInfoWrapper(true, "1.0.0", "docs: update changelog")
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
            result.Version.Commits.ShouldBe(1);
        }
        public void ParsingMergeCommitAfterTag()
        {
            var commits = new[]
            {
                new CommitInfoWrapper("Merge master into develop"),
                new CommitInfoWrapper(true, "1.3.5", "feat: awesome")
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
            result.Version.Commits.ShouldBe(1);
        }
        public void ParsingSingleFixCommitWithPreviousTagSuggfixTag(string tagSuffix)
        {
            var commits = new[]
            {
                new CommitInfoWrapper("fix: something"),
                new CommitInfoWrapper(true, $"v1.3.1-{tagSuffix}.2", "docs: update changelog")
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result.ToString(), s => s.Replace("-" + tagSuffix, "-tag-suffix"));
            result.Version.Commits.ShouldBe(1);
        }
        public void ParsingTagWithLowerVersionThanPreviousTag()
        {
            var commits = new[]
            {
                new CommitInfoWrapper(true, "2.1.0", "fix: major breaking change"),
                new CommitInfoWrapper(true, "3.0.0", "feat!: previous breaking")
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
            result.Version.Commits.ShouldBe(1);
        }
Beispiel #16
0
        public void ParsingMultipeCommitTypes()
        {
            var commits = new[]
            {
                new CommitInfoWrapper("feat: some kind of new feature"),
                new CommitInfoWrapper("fix(scoping): some kind of bug fix"),
                new CommitInfoWrapper("refactor!: renamed a method in the public API")
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
        }
        public void ParsingSingleFixCommitWithPreviousTag()
        {
            var commits = new[]
            {
                new CommitInfoWrapper("fix: correct code"),
                new CommitInfoWrapper(true, "3.1.1", "docs: update changelog")
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
            result.Version.Commits.ShouldBe(1);
        }
        public void ParsingSingleFeatureWithPreviousTag()
        {
            var commits = new[]
            {
                new CommitInfoWrapper("feat: some kind of awesome feature"),
                new CommitInfoWrapper(true, "1.2.3", "docs: update changelog")
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
            result.Version.Commits.ShouldBe(1);
        }
        public void ParsingBreakingFeatureCommit()
        {
            var commits = new[]
            {
                new CommitInfoWrapper("feat!: this is a major breaking change"),
                new CommitInfoWrapper(true, "v1.2.0", "docs: update changelog")
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
            result.Version.Commits.ShouldBe(1);
        }
Beispiel #20
0
        public void ParsingCommitsWithIssueReferences(string closeType)
        {
            var commits = new[]
            {
                new CommitInfoWrapper(true, "1.0.0", "docs: update changelog"),
                new CommitInfoWrapper($"feat: some feature\n\n{closeType} #54\n{closeType} #43"),
                new CommitInfoWrapper($"chore: some chore\n\n{closeType} #22")
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
        }
Beispiel #21
0
        public void ParsingMergeCommits()
        {
            var commits = new[]
            {
                new CommitInfoWrapper(true, "1.0.0", "docs: update changelog"),
                new CommitInfoWrapper("Merge develop into master"),
                new CommitInfoWrapper("feat: some feature"),
                new CommitInfoWrapper("(build) not considered")
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
        }
        public void ParsingTaggedMergeCommit()
        {
            var commits = new[]
            {
                new CommitInfoWrapper(true, "0.3.0", "Merge branch 'release/0.3.0' into master"),
                new CommitInfoWrapper("feat: include embedded pdb files to fully enable deterministic builds for addin"),
                new CommitInfoWrapper(true, "0.2.0", "Merge branch 'release/0.2.0' into master")
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
            result.Version.Commits.ShouldBe(2);
        }
        public void ParsingTagWithPastFeatureCommits()
        {
            var commits = new[]
            {
                new CommitInfoWrapper(true, "1.0.0", "docs: update changelog"),
                new CommitInfoWrapper("feat: some kind of awesome new feature"),
                new CommitInfoWrapper("chore: just some non-source maintainance")
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
            result.Version.Commits.ShouldBe(3);
        }
        public void ParsingMultipleFeatureCommitsWithPreviousTag()
        {
            var commits = new[]
            {
                new CommitInfoWrapper("feat: awesomesouce"),
                new CommitInfoWrapper("feat: best new feature ever creted"),
                new CommitInfoWrapper(true, "2.4.4", "docs: update changelog")
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
            result.Version.Commits.ShouldBe(2);
        }
        public void ParsingNonBumpingCommits()
        {
            var commits = new[]
            {
                new CommitInfoWrapper("chore: some kind of update"),
                new CommitInfoWrapper("build: build changes"),
                new CommitInfoWrapper(true, "refs/tags/1.3.3", "feat: important new feature"),
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
            result.Version.Commits.ShouldBe(2);
        }
        public void ParsingNonBumpingCommitsSinceTag()
        {
            var commits = new[]
            {
                new CommitInfoWrapper("chore: something"),
                new CommitInfoWrapper("build: build related only"),
                new CommitInfoWrapper(true, "1.7.0", "feat: awesome")
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
            result.Version.Commits.ShouldBe(2);
        }
Beispiel #27
0
        public void ParsingBreakingChangeAndBody()
        {
            var commits = new[]
            {
                new CommitInfoWrapper(true, "2.0.0", "chore: some update"),
                new CommitInfoWrapper(
                    @"refactor!: renamed a method in the public API

AweSomeName was renamed to AwesomeNameAsync"
                    )
            };

            var parser = new CommitParser(this.defaultConfig, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
        }
        public void ParsingWithConfiguredTagSuffix(string tagSuffix)
        {
            var commits = new[]
            {
                new CommitInfoWrapper("fix: correct my code")
            };

            var config = new Config
            {
                Tag = tagSuffix
            };
            var parser = new CommitParser(config, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result.ToString(), s => s.Replace("-" + tagSuffix, "-tag-suffix"));
            result.Version.Commits.ShouldBe(1);
        }
        public void ParsingCommitWithEmptyTagSuffixAndNoPreviousTag()
        {
            var commits = new[]
            {
                new CommitInfoWrapper("feat: some kind of feature")
            };

            var config = new Config
            {
                Tag = string.Empty
            };
            var parser = new CommitParser(config, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result);
            result.Version.Commits.ShouldBe(1);
        }
        public void ParsingWithConfiguredNextVersion(string nextVersion)
        {
            var commits = new[]
            {
                new CommitInfoWrapper("feat: awesome feature")
            };

            var config = new Config
            {
                NextVersion = nextVersion
            };
            var parser = new CommitParser(config, this.repository, this.writer);

            var result = parser.ParseVersionFromCommits(commits);

            Approvals.Verify(result.ToString(), s => s.Replace(nextVersion + "-", "next-version-"));
            result.Version.Commits.ShouldBe(1);
        }