Skip to content

Commit 6a6687c

Browse files
authored
Merge pull request #3960 from HHobeck/feature/enable-ignored-unit-tests
Enable ignored unit tests
2 parents 61bcef9 + ff3e1a2 commit 6a6687c

File tree

27 files changed

+441
-792
lines changed

27 files changed

+441
-792
lines changed

docs/input/docs/reference/configuration.md

+11-12
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ branches:
105105
of-merged-branch: true
106106
when-current-commit-tagged: false
107107
track-merge-target: false
108-
regex: ^releases?[/-]
108+
regex: ^releases?[/-](?<BranchName>.+)
109109
source-branches:
110110
- develop
111111
- main
@@ -153,7 +153,7 @@ branches:
153153
increment: Inherit
154154
prevent-increment:
155155
when-current-commit-tagged: false
156-
regex: ^hotfix(es)?[/-]
156+
regex: ^hotfix(es)?[/-](?<BranchName>.+)
157157
source-branches:
158158
- release
159159
- main
@@ -168,7 +168,7 @@ branches:
168168
prevent-increment:
169169
of-merged-branch: true
170170
track-merge-target: false
171-
regex: ^support[/-]
171+
regex: ^support[/-](?<BranchName>.+)
172172
source-branches:
173173
- main
174174
is-source-branch-for: []
@@ -209,7 +209,6 @@ is-source-branch-for: []
209209
tracks-release-branches: false
210210
is-release-branch: false
211211
is-main-branch: false
212-
213212
```
214213

215214
The supported built-in configuration for the `GitHubFlow` workflow (`workflow: GitHubFlow/v1`) looks like:
@@ -257,7 +256,7 @@ branches:
257256
of-merged-branch: true
258257
when-current-commit-tagged: false
259258
track-merge-target: false
260-
regex: ^releases?[/-]
259+
regex: ^releases?[/-](?<BranchName>.+)
261260
source-branches:
262261
- main
263262
- release
@@ -370,7 +369,7 @@ branches:
370369
- main
371370
pre-release-weight: 30000
372371
pull-request:
373-
mode: ManualDeployment
372+
mode: ContinuousDelivery
374373
label: PullRequest
375374
increment: Inherit
376375
label-number-pattern: '[/-](?<number>\d+)'
@@ -379,17 +378,16 @@ branches:
379378
- main
380379
pre-release-weight: 30000
381380
unknown:
382-
mode: ManualDeployment
383-
increment: Inherit
381+
increment: Patch
384382
regex: (?<BranchName>.+)
383+
prevent-increment:
384+
when-current-commit-tagged: false
385385
source-branches:
386386
- main
387-
- feature
388-
- hotfix
389-
- pull-request
387+
pre-release-weight: 30000
390388
ignore:
391389
sha: []
392-
mode: ManualDeployment
390+
mode: ContinuousDelivery
393391
label: '{BranchName}'
394392
increment: Inherit
395393
prevent-increment:
@@ -403,6 +401,7 @@ regex: ''
403401
tracks-release-branches: false
404402
is-release-branch: false
405403
is-main-branch: false
404+
406405
```
407406

408407
The details of the available options are as follows:

src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ branches:
5454
of-merged-branch: true
5555
when-current-commit-tagged: false
5656
track-merge-target: false
57-
regex: ^releases?[/-]
57+
regex: ^releases?[/-](?<BranchName>.+)
5858
source-branches:
5959
- develop
6060
- main
@@ -102,7 +102,7 @@ branches:
102102
increment: Inherit
103103
prevent-increment:
104104
when-current-commit-tagged: false
105-
regex: ^hotfix(es)?[/-]
105+
regex: ^hotfix(es)?[/-](?<BranchName>.+)
106106
source-branches:
107107
- release
108108
- main
@@ -117,7 +117,7 @@ branches:
117117
prevent-increment:
118118
of-merged-branch: true
119119
track-merge-target: false
120-
regex: ^support[/-]
120+
regex: ^support[/-](?<BranchName>.+)
121121
source-branches:
122122
- main
123123
is-source-branch-for: []

src/GitVersion.Configuration/SupportedWorkflows/GitFlow/v1.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ branches:
5454
of-merged-branch: true
5555
when-current-commit-tagged: false
5656
track-merge-target: false
57-
regex: ^releases?[/-]
57+
regex: ^releases?[/-](?<BranchName>.+)
5858
source-branches:
5959
- develop
6060
- main
@@ -102,7 +102,7 @@ branches:
102102
increment: Inherit
103103
prevent-increment:
104104
when-current-commit-tagged: false
105-
regex: ^hotfix(es)?[/-]
105+
regex: ^hotfix(es)?[/-](?<BranchName>.+)
106106
source-branches:
107107
- release
108108
- main
@@ -117,7 +117,7 @@ branches:
117117
prevent-increment:
118118
of-merged-branch: true
119119
track-merge-target: false
120-
regex: ^support[/-]
120+
regex: ^support[/-](?<BranchName>.+)
121121
source-branches:
122122
- main
123123
is-source-branch-for: []

src/GitVersion.Configuration/SupportedWorkflows/GitHubFlow/v1.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ branches:
4040
of-merged-branch: true
4141
when-current-commit-tagged: false
4242
track-merge-target: false
43-
regex: ^releases?[/-]
43+
regex: ^releases?[/-](?<BranchName>.+)
4444
source-branches:
4545
- main
4646
- release

src/GitVersion.Configuration/SupportedWorkflows/TrunkBased/v1.yml

+6-7
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ branches:
4545
- main
4646
pre-release-weight: 30000
4747
pull-request:
48-
mode: ManualDeployment
48+
mode: ContinuousDelivery
4949
label: PullRequest
5050
increment: Inherit
5151
label-number-pattern: '[/-](?<number>\d+)'
@@ -54,17 +54,16 @@ branches:
5454
- main
5555
pre-release-weight: 30000
5656
unknown:
57-
mode: ManualDeployment
58-
increment: Inherit
57+
increment: Patch
5958
regex: (?<BranchName>.+)
59+
prevent-increment:
60+
when-current-commit-tagged: false
6061
source-branches:
6162
- main
62-
- feature
63-
- hotfix
64-
- pull-request
63+
pre-release-weight: 30000
6564
ignore:
6665
sha: []
67-
mode: ManualDeployment
66+
mode: ContinuousDelivery
6867
label: '{BranchName}'
6968
increment: Inherit
7069
prevent-increment:

src/GitVersion.Configuration/TrunkBasedConfigurationBuilder.cs

+10-8
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ private TrunkBasedConfigurationBuilder()
2626
VersionInBranchPattern = ConfigurationConstants.DefaultVersionInBranchPattern,
2727
TagPreReleaseWeight = ConfigurationConstants.DefaultTagPreReleaseWeight,
2828
UpdateBuildNumber = ConfigurationConstants.DefaultUpdateBuildNumber,
29-
DeploymentMode = DeploymentMode.ManualDeployment,
29+
DeploymentMode = DeploymentMode.ContinuousDelivery,
3030
RegularExpression = string.Empty,
3131
Label = ConfigurationConstants.BranchNamePlaceholder,
3232
Increment = IncrementStrategy.Inherit,
@@ -96,7 +96,7 @@ private TrunkBasedConfigurationBuilder()
9696
{
9797
Increment = IncrementStrategy.Inherit,
9898
RegularExpression = PullRequestBranch.RegexPattern,
99-
DeploymentMode = DeploymentMode.ManualDeployment,
99+
DeploymentMode = DeploymentMode.ContinuousDelivery,
100100
SourceBranches =
101101
[
102102
this.MainBranch.Name
@@ -108,15 +108,17 @@ private TrunkBasedConfigurationBuilder()
108108

109109
WithBranch(UnknownBranch.Name).WithConfiguration(new BranchConfiguration
110110
{
111+
Increment = IncrementStrategy.Patch,
111112
RegularExpression = UnknownBranch.RegexPattern,
112-
DeploymentMode = DeploymentMode.ManualDeployment,
113-
Increment = IncrementStrategy.Inherit,
114113
SourceBranches =
115114
[
116-
this.MainBranch.Name,
117-
this.FeatureBranch.Name,
118-
this.PullRequestBranch.Name
119-
]
115+
this.MainBranch.Name
116+
],
117+
PreventIncrement = new PreventIncrementConfiguration()
118+
{
119+
WhenCurrentCommitTagged = false
120+
},
121+
PreReleaseWeight = 30000
120122
});
121123
}
122124
}

src/GitVersion.Core.Tests/Core/RepositoryStoreTests.cs

-1
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ public void GetBranchesContainingCommitThrowsDirectlyOnNullCommit()
213213
}
214214

215215
[Test]
216-
[Ignore("Needs more investigations.")]
217216
public void FindCommitBranchWasBranchedFromShouldReturnNullIfTheRemoteIsTheOnlySource()
218217
{
219218
using var fixture = new RemoteRepositoryFixture();

src/GitVersion.Core.Tests/IntegrationTests/ReleaseBranchScenarios.cs

+5-2
Original file line numberDiff line numberDiff line change
@@ -452,17 +452,20 @@ public void CommitBeetweenMergeReleaseToDevelopShouldNotResetCount()
452452
}
453453

454454
[Test]
455-
[Ignore("Needs investigation")]
456455
public void ReleaseBranchShouldUseBranchNameVersionDespiteBumpInPreviousCommit()
457456
{
457+
var configuration = GitFlowConfigurationBuilder.New
458+
.WithSemanticVersionFormat(SemanticVersionFormat.Loose)
459+
.Build();
460+
458461
using var fixture = new EmptyRepositoryFixture();
459462
fixture.Repository.MakeATaggedCommit("1.0");
460463
fixture.Repository.MakeACommit("+semver:major");
461464
fixture.Repository.MakeACommit();
462465

463466
fixture.BranchTo("release/2.0");
464467

465-
fixture.AssertFullSemver("2.0.0-beta.1+2");
468+
fixture.AssertFullSemver("2.0.0-beta.1+2", configuration);
466469
}
467470

468471
[Test]

src/GitVersion.Core.Tests/IntegrationTests/TrunkBasedDevelopmentScenarios.cs

-21
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,6 @@ private static GitFlowConfigurationBuilder GetConfigurationBuilder() => GitFlowC
3636
.WithSourceBranches("main")
3737
);
3838

39-
[Test]
40-
[Ignore("Support of multiple tunks are not implemented at the moment.")]
41-
public void VerifyNonMainMainlineVersionIdenticalAsMain()
42-
{
43-
var configuration = GetConfigurationBuilder().Build();
44-
45-
using var fixture = new EmptyRepositoryFixture();
46-
fixture.Repository.MakeACommit("1");
47-
48-
fixture.BranchTo("feature/foo", "foo");
49-
fixture.MakeACommit("2 +semver: major");
50-
fixture.Checkout(MainBranch);
51-
fixture.MergeNoFF("feature/foo");
52-
53-
fixture.AssertFullSemver("1.0.0", configuration);
54-
55-
fixture.BranchTo("support/1.0", "support");
56-
57-
fixture.AssertFullSemver("1.0.0", configuration);
58-
}
59-
6039
[Test]
6140
public void MergedFeatureBranchesToMainImpliesRelease()
6241
{

src/GitVersion.Core.Tests/TrunkBased/TrunkBasedScenariosWithAGitHubFlow+GivenAFeatureBranchWithOneCommitBranchedFromMainWhenCommitBTaggedAsStable.cs

+8-12
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ public string GetVersionWithNoLabelOnMain(
148148
return fixture!.GetVersion(trunkBased).FullSemVer;
149149
}
150150

151-
[Ignore("Enable if WithTakeIncrementedVersion(TakeIncrementedVersion.TakeAlwaysIncrementedVersion) feature has been implemented!")]
152151
[TestCase(IncrementStrategy.None, IncrementStrategy.None, null, ExpectedResult = "0.0.0-1+0")]
153152
[TestCase(IncrementStrategy.None, IncrementStrategy.Patch, null, ExpectedResult = "0.0.1-1+0")]
154153
[TestCase(IncrementStrategy.None, IncrementStrategy.Minor, null, ExpectedResult = "0.1.0-1+0")]
@@ -232,11 +231,11 @@ public string GetVersionWithNoLabelOnMain(
232231
[TestCase(IncrementStrategy.Major, IncrementStrategy.Patch, "{BranchName}", ExpectedResult = "0.0.1-foo.1+0")]
233232
[TestCase(IncrementStrategy.Major, IncrementStrategy.Minor, "{BranchName}", ExpectedResult = "0.1.0-foo.1+0")]
234233
[TestCase(IncrementStrategy.Major, IncrementStrategy.Major, "{BranchName}", ExpectedResult = "1.0.0-foo.1+0")]
235-
public string GetVersionWithNoLabelOnMainAndTakeAlwaysIncrementedVersion(
234+
public string GetVersionWithNoLabelAndPreventIncrementWhenCurrentCommitTaggedFalseOnMain(
236235
IncrementStrategy incrementOnMain, IncrementStrategy increment, string? label)
237236
{
238237
IGitVersionConfiguration trunkBased = TrunkBasedBuilder
239-
//.WithTakeIncrementedVersion(TakeIncrementedVersion.TakeAlwaysIncrementedVersion)
238+
.WithPreventIncrementWhenCurrentCommitTagged(false)
240239
.WithBranch("main", _ => _.WithIncrement(incrementOnMain).WithLabel(null))
241240
.WithBranch("feature", _ => _.WithIncrement(increment).WithLabel(label))
242241
.Build();
@@ -358,7 +357,6 @@ public string GetVersionWithEmptyLabelOnMain(
358357
return fixture!.GetVersion(trunkBased).FullSemVer;
359358
}
360359

361-
[Ignore("Enable if WithTakeIncrementedVersion(TakeIncrementedVersion.TakeAlwaysIncrementedVersion) feature has been implemented!")]
362360
[TestCase(IncrementStrategy.None, IncrementStrategy.None, null, ExpectedResult = "0.0.0-1+0")]
363361
[TestCase(IncrementStrategy.None, IncrementStrategy.Patch, null, ExpectedResult = "0.0.1-1+0")]
364362
[TestCase(IncrementStrategy.None, IncrementStrategy.Minor, null, ExpectedResult = "0.1.0-1+0")]
@@ -442,11 +440,11 @@ public string GetVersionWithEmptyLabelOnMain(
442440
[TestCase(IncrementStrategy.Major, IncrementStrategy.Patch, "{BranchName}", ExpectedResult = "0.0.1-foo.1+0")]
443441
[TestCase(IncrementStrategy.Major, IncrementStrategy.Minor, "{BranchName}", ExpectedResult = "0.1.0-foo.1+0")]
444442
[TestCase(IncrementStrategy.Major, IncrementStrategy.Major, "{BranchName}", ExpectedResult = "1.0.0-foo.1+0")]
445-
public string GetVersionWithEmptyLabelOnMainAndTakeAlwaysIncrementedVersion(
443+
public string GetVersionWithEmptyLabelAndPreventIncrementWhenCurrentCommitTaggedFalseOnMain(
446444
IncrementStrategy incrementOnMain, IncrementStrategy increment, string? label)
447445
{
448446
IGitVersionConfiguration trunkBased = TrunkBasedBuilder
449-
//.WithTakeIncrementedVersion(TakeIncrementedVersion.TakeAlwaysIncrementedVersion)
447+
.WithPreventIncrementWhenCurrentCommitTagged(false)
450448
.WithBranch("main", _ => _.WithIncrement(incrementOnMain).WithLabel(string.Empty))
451449
.WithBranch("feature", _ => _.WithIncrement(increment).WithLabel(label))
452450
.Build();
@@ -568,7 +566,6 @@ public string GetVersionWithLabelFooOnMain(
568566
return fixture!.GetVersion(trunkBased).FullSemVer;
569567
}
570568

571-
[Ignore("Enable if WithTakeIncrementedVersion(TakeIncrementedVersion.TakeAlwaysIncrementedVersion) feature has been implemented!")]
572569
[TestCase(IncrementStrategy.None, IncrementStrategy.None, null, ExpectedResult = "0.0.0-1+0")]
573570
[TestCase(IncrementStrategy.None, IncrementStrategy.Patch, null, ExpectedResult = "0.0.1-1+0")]
574571
[TestCase(IncrementStrategy.None, IncrementStrategy.Minor, null, ExpectedResult = "0.1.0-1+0")]
@@ -652,11 +649,11 @@ public string GetVersionWithLabelFooOnMain(
652649
[TestCase(IncrementStrategy.Major, IncrementStrategy.Patch, "{BranchName}", ExpectedResult = "0.0.1-foo.1+0")]
653650
[TestCase(IncrementStrategy.Major, IncrementStrategy.Minor, "{BranchName}", ExpectedResult = "0.1.0-foo.1+0")]
654651
[TestCase(IncrementStrategy.Major, IncrementStrategy.Major, "{BranchName}", ExpectedResult = "1.0.0-foo.1+0")]
655-
public string GetVersionWithLabelFooOnMainAndTakeAlwaysIncrementedVersion(
652+
public string GetVersionWithLabelFooAndPreventIncrementWhenCurrentCommitTaggedFalseOnMain(
656653
IncrementStrategy incrementOnMain, IncrementStrategy increment, string? label)
657654
{
658655
IGitVersionConfiguration trunkBased = TrunkBasedBuilder
659-
//.WithTakeIncrementedVersion(TakeIncrementedVersion.TakeAlwaysIncrementedVersion)
656+
.WithPreventIncrementWhenCurrentCommitTagged(false)
660657
.WithBranch("main", _ => _.WithIncrement(incrementOnMain).WithLabel("foo"))
661658
.WithBranch("feature", _ => _.WithIncrement(increment).WithLabel(label))
662659
.Build();
@@ -778,7 +775,6 @@ public string GetVersionWithLabelBarOnMain(
778775
return fixture!.GetVersion(trunkBased).FullSemVer;
779776
}
780777

781-
[Ignore("Enable if WithTakeIncrementedVersion(TakeIncrementedVersion.TakeAlwaysIncrementedVersion) feature has been implemented!")]
782778
[TestCase(IncrementStrategy.None, IncrementStrategy.None, null, ExpectedResult = "0.0.0-1+0")]
783779
[TestCase(IncrementStrategy.None, IncrementStrategy.Patch, null, ExpectedResult = "0.0.1-1+0")]
784780
[TestCase(IncrementStrategy.None, IncrementStrategy.Minor, null, ExpectedResult = "0.1.0-1+0")]
@@ -862,11 +858,11 @@ public string GetVersionWithLabelBarOnMain(
862858
[TestCase(IncrementStrategy.Major, IncrementStrategy.Patch, "{BranchName}", ExpectedResult = "0.0.1-foo.1+0")]
863859
[TestCase(IncrementStrategy.Major, IncrementStrategy.Minor, "{BranchName}", ExpectedResult = "0.1.0-foo.1+0")]
864860
[TestCase(IncrementStrategy.Major, IncrementStrategy.Major, "{BranchName}", ExpectedResult = "1.0.0-foo.1+0")]
865-
public string GetVersionWithLabelBarOnMainAndTakeAlwaysIncrementedVersion(
861+
public string GetVersionWithLabelBarAndPreventIncrementWhenCurrentCommitTaggedFalseOnMain(
866862
IncrementStrategy incrementOnMain, IncrementStrategy increment, string? label)
867863
{
868864
IGitVersionConfiguration trunkBased = TrunkBasedBuilder
869-
//.WithTakeIncrementedVersion(TakeIncrementedVersion.TakeAlwaysIncrementedVersion)
865+
.WithPreventIncrementWhenCurrentCommitTagged(false)
870866
.WithBranch("main", _ => _.WithIncrement(incrementOnMain).WithLabel("bar"))
871867
.WithBranch("feature", _ => _.WithIncrement(increment).WithLabel(label))
872868
.Build();

src/GitVersion.Core.Tests/TrunkBased/TrunkBasedScenariosWithAGitHubFlow+GivenAFeatureBranchWithOneCommitWhenCommitTaggedAsPreRelease.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ public string GetVersion(IncrementStrategy increment, string? label)
5858
return fixture!.GetVersion(trunkBased).FullSemVer;
5959
}
6060

61-
[Ignore("Enable if WithTakeIncrementedVersion(TakeIncrementedVersion.TakeAlwaysIncrementedVersion) feature has been implemented!")]
6261
[TestCase(IncrementStrategy.None, null, ExpectedResult = "0.0.0-5+0")]
6362
[TestCase(IncrementStrategy.Patch, null, ExpectedResult = "0.0.0-5+0")]
6463
[TestCase(IncrementStrategy.Minor, null, ExpectedResult = "0.0.0-5+0")]
@@ -78,10 +77,10 @@ public string GetVersion(IncrementStrategy increment, string? label)
7877
[TestCase(IncrementStrategy.Patch, "bar", ExpectedResult = "0.0.1-bar.1+1")]
7978
[TestCase(IncrementStrategy.Minor, "bar", ExpectedResult = "0.1.0-bar.1+1")]
8079
[TestCase(IncrementStrategy.Major, "bar", ExpectedResult = "1.0.0-bar.1+1")]
81-
public string GetVersionWithTakeAlwaysIncrementedVersion(IncrementStrategy increment, string? label)
80+
public string GetVersionWithPreventIncrementWhenCurrentCommitTaggedFalse(IncrementStrategy increment, string? label)
8281
{
8382
IGitVersionConfiguration trunkBased = TrunkBasedBuilder
84-
//.WithTakeIncrementedVersion(TakeIncrementedVersion.TakeAlwaysIncrementedVersion)
83+
.WithPreventIncrementWhenCurrentCommitTagged(false)
8584
.WithBranch("feature", _ => _.WithIncrement(increment).WithLabel(label))
8685
.Build();
8786

0 commit comments

Comments
 (0)