You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: build.ps1
+11-1Lines changed: 11 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -65,6 +65,7 @@ param (
65
65
)
66
66
67
67
$ErrorActionPreference='Stop'
68
+
$ErrorView='NormalView'
68
69
Get-Module Pester |Remove-Module
69
70
70
71
if ($Clean-and$PSVersionTable.PSVersion-lt [version]'5.1') {
@@ -105,6 +106,10 @@ if ($Clean) {
105
106
}
106
107
107
108
functionFormat-NicelyMini ($value) {
109
+
if ($null-eq$value) {
110
+
return'$null'
111
+
}
112
+
108
113
if ($value-is [bool]) {
109
114
if ($value) {
110
115
'$true'
@@ -148,7 +153,12 @@ if ($Clean) {
148
153
foreach ($rin$section.PSObject.Properties.Name) {
149
154
$option=$section.$r
150
155
$default=Format-NicelyMini$option.Default
151
-
$type=$option.Default.GetType() -as [string]
156
+
if ("RepoRoot"-eq$r) {
157
+
# RepoRoot is a special case, because it is not actually an option, but a property that returns the value of the option. This is done to make it easier to use in scripts, but it causes issues when generating help, because it does not have a default value. So we need to get the default value from the actual option.
158
+
$default=Format-NicelyMini'<path of .git>'
159
+
}
160
+
# When the value is null this would throw if we checked the type of default value.
OutputFormat=newStringOption("Format to use for code coverage report. Possible values: JaCoCo, CoverageGutters, Cobertura","JaCoCo");
45
+
OutputFormat=newStringOption("Format to use for code coverage report. Possible values: JaCoCo, Cobertura","JaCoCo");
45
46
OutputPath=newStringOption("Path relative to the current directory where code coverage report is saved.","coverage.xml");
46
47
OutputEncoding=newStringOption("Encoding of the output file.","UTF8");
47
48
Path=newStringArrayOption("Directories or files to be used for code coverage, by default the Path(s) from general settings are used, unless overridden here.",newstring[0]);
@@ -50,6 +51,7 @@ public CodeCoverageConfiguration() : base("Options to enable and configure Peste
50
51
UseBreakpoints=newBoolOption("When false, use Profiler based tracer to do CodeCoverage instead of using breakpoints.",false);
51
52
CoveragePercentTarget=newDecimalOption("Target percent of code coverage that you want to achieve, default 75%.",75m);
52
53
SingleHitBreakpoints=newBoolOption("Remove breakpoint when it is hit. This increases performance of breakpoint based CodeCoverage.",true);
54
+
ReportRoot=newStringOption("Root path for the code coverage report. Uses Run.RepoRoot by default.",null);
@@ -54,7 +56,8 @@ public RunConfiguration(IDictionary configuration) : this()
54
56
configuration.AssignValueIfNotNull<bool>(nameof(PassThru), v =>PassThru=v);
55
57
configuration.AssignValueIfNotNull<bool>(nameof(SkipRun), v =>SkipRun=v);
56
58
configuration.AssignObjectIfNotNull<string>(nameof(SkipRemainingOnFailure), v =>SkipRemainingOnFailure=v);
57
-
configuration.AssignValueIfNotNull<bool>(nameof(FailOnNullOrEmptyForEach), v =>FailOnNullOrEmptyForEach=v);
59
+
configuration.AssignValueIfNotNull<bool>(nameof(FailOnNullOrEmptyForEach), v =>FailOnNullOrEmptyForEach=v);
60
+
configuration.AssignObjectIfNotNull<string>(nameof(RepoRoot), v =>RepoRoot=v);
58
61
}
59
62
}
60
63
@@ -70,7 +73,8 @@ public RunConfiguration(IDictionary configuration) : this()
70
73
PassThru=newBoolOption("Return result object to the pipeline after finishing the test run.",false);
71
74
SkipRun=newBoolOption("Runs the discovery phase but skips run. Use it with PassThru to get object populated with all tests.",false);
72
75
SkipRemainingOnFailure=newStringOption("Skips remaining tests after failure for selected scope, options are None, Run, Container and Block.","None");
73
-
FailOnNullOrEmptyForEach=newBoolOption("Fails discovery when -ForEach is provided $null or @() in a block or test. Can be overridden for a specific Describe/Context/It using -AllowNullOrEmptyForEach.",true);
76
+
FailOnNullOrEmptyForEach=newBoolOption("Fails discovery when -ForEach is provided $null or @() in a block or test. Can be overridden for a specific Describe/Context/It using -AllowNullOrEmptyForEach.",true);
77
+
RepoRoot=newStringOption("Root directory of the repository. Found by searching for the .git directory recursively. When not found, the current working directory is used.",FindRepoRoot());
74
78
}
75
79
76
80
publicStringArrayOptionPath
@@ -248,5 +252,38 @@ public BoolOption FailOnNullOrEmptyForEach
Copy file name to clipboardExpand all lines: src/en-US/about_PesterConfiguration.help.txt
+9-1Lines changed: 9 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -73,6 +73,10 @@ SECTIONS AND OPTIONS
73
73
Type: bool
74
74
Default value: $true
75
75
76
+
RepoRoot: Root directory of the repository. Found by searching for the .git directory recursively. When not found, the current working directory is used.
77
+
Type: string
78
+
Default value: '<path of .git>'
79
+
76
80
Filter:
77
81
Tag: Tags of Describe, Context or It to be run.
78
82
Type: string[]
@@ -99,7 +103,7 @@ SECTIONS AND OPTIONS
99
103
Type: bool
100
104
Default value: $false
101
105
102
-
OutputFormat: Format to use for code coverage report. Possible values: JaCoCo, CoverageGutters, Cobertura
106
+
OutputFormat: Format to use for code coverage report. Possible values: JaCoCo, Cobertura
103
107
Type: string
104
108
Default value: 'JaCoCo'
105
109
@@ -135,6 +139,10 @@ SECTIONS AND OPTIONS
135
139
Type: bool
136
140
Default value: $true
137
141
142
+
ReportRoot: Root path for the code coverage report. Uses Run.RepoRoot by default.
0 commit comments