@@ -86,19 +86,18 @@ if ($PSBoundParameters.ContainsKey('additionalModulePath')) {
86
86
Write-Host " Adding additional module path [$additionalModulePath ] to `$ env:PSModulePath"
87
87
$env: PSModulePath = $additionalModulePath + ' ;' + $env: PSModulePath
88
88
}
89
+ $PesterConfig = [PesterConfiguration ]::Default
89
90
90
- $PesterConfig = @ {
91
-
92
- Run = @ {
93
- Path = $TestFolder
94
- PassThru = $true
95
- }
96
- TestResult = @ {
97
- Enabled = $true
98
- OutputFormat = ' NUnit2.5'
99
- OutputPath = $resultsFile
100
- }
91
+ $PesterConfig.run = @ {
92
+ Path = $TestFolder
93
+ PassThru = $true
101
94
}
95
+ $PesterConfig.TestResult = @ {
96
+ Enabled = $true
97
+ OutputFormat = ' NUnit2.5'
98
+ OutputPath = $resultsFile
99
+ }
100
+
102
101
103
102
$Filter = @ {}
104
103
if ($Tag ) {
@@ -110,12 +109,11 @@ if ($ExcludeTag) {
110
109
$Filter.Add (' ExcludeTag' , $ExcludeTag )
111
110
}
112
111
113
- $PesterConfig [ ' Filter' ] = $Filter
112
+ $PesterConfig. Filter = $Filter
114
113
115
- $CodeCoverage = @ {}
116
114
if ($CodeCoverageOutputFile ) {
117
- $CodeCoverage [ ' Enabled' ] = $True
118
- $CodeCoverage [ ' OutputFormat' ] = " JaCoCo"
115
+ $PesterConfig . CodeCoverage. Enabled = $True
116
+ $PesterConfig . CodeCoverage. OutputFormat = " JaCoCo"
119
117
120
118
if (-not $PSBoundParameters.ContainsKey (' CodeCoverageFolder' )) {
121
119
$CodeCoverageFolder = $TestFolder
@@ -124,16 +122,14 @@ if ($CodeCoverageOutputFile) {
124
122
Select-object - ExpandProperty Fullname
125
123
126
124
if ($Files ) {
127
- $CodeCoverage.Add ( ' Path' , $Files )
128
- $CodeCoverage.Add ( ' OutputPath' , $CodeCoverageOutputFile )
125
+ $PesterConfig . CodeCoverage.Path = $Files
126
+ $PesterConfig . CodeCoverage.OutputPath = $CodeCoverageOutputFile
129
127
}
130
128
else {
131
129
Write-Warning - Message " No PowerShell files found under [$CodeCoverageFolder ] to analyse for code coverage."
132
130
}
133
131
}
134
132
135
- $PesterConfig [' CodeCoverage' ] = $CodeCoverage
136
-
137
133
if (-not ([String ]::IsNullOrWhiteSpace($ScriptBlock ))) {
138
134
$ScriptBlockObject = [ScriptBlock ]::Create($ScriptBlock )
139
135
0 commit comments