Skip to content

Commit bdac96b

Browse files
authored
DscResource.Base: Enable Pester's new code coverage method (#9)
- DscResource.Base - Enable Pester's new code coverage method.
1 parent 7304b2b commit bdac96b

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
55

66
## [Unreleased]
77

8+
### Changed
9+
10+
- DscResource.Base
11+
- Enable Pester's new code coverage method.
12+
813
### Fixed
914

1015
- DscResource.Base

build.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@ Pester:
8989
CoveragePercentTarget: 85
9090
OutputPath: JaCoCo_coverage.xml
9191
OutputEncoding: ascii
92-
# There is a bug in Pester when running unit tests for classes when 'UseBreakpoints' is turned off.
93-
# See error in gist: https://gist.github.com/johlju/c16dfd9587c7e066e8825fc54b33a703
94-
UseBreakpoints: true
92+
UseBreakpoints: false
9593
TestResult:
9694
OutputFormat: NUnitXML
9795
OutputEncoding: ascii

tests/Unit/Classes/ResourceBase.Tests.ps1

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,8 @@ class MyMockResource : ResourceBase
855855
[System.String]
856856
$MyResourceProperty2
857857
858+
MyMockResource () {}
859+
858860
[System.Collections.Hashtable[]] Compare()
859861
{
860862
return $null
@@ -901,6 +903,8 @@ class MyMockResource : ResourceBase
901903
[System.String]
902904
$MyResourceProperty2
903905
906+
MyMockResource () {}
907+
904908
[System.Collections.Hashtable[]] Compare()
905909
{
906910
# Could just return any non-null object, but mocking a real result.
@@ -960,6 +964,8 @@ class MyMockResource : ResourceBase
960964
[System.String]
961965
$MyResourceReadProperty
962966
967+
MyMockResource () {}
968+
963969
[ResourceBase] Get()
964970
{
965971
# Creates a new instance of the mock instance MyMockResource.
@@ -1031,6 +1037,8 @@ class MyMockResource : ResourceBase
10311037
[System.String]
10321038
$MyResourceReadProperty
10331039
1040+
MyMockResource () {}
1041+
10341042
[ResourceBase] Get()
10351043
{
10361044
# Creates a new instance of the mock instance MyMockResource.
@@ -1139,6 +1147,8 @@ class MyMockResource : ResourceBase
11391147
[System.String]
11401148
$MyResourceProperty3
11411149
1150+
MyMockResource () {}
1151+
11421152
# Hidden property to determine whether the method Modify() was called.
11431153
hidden [System.Collections.Hashtable] $mockModifyProperties = @{}
11441154
@@ -1198,6 +1208,8 @@ class MyMockResource : ResourceBase
11981208
# Hidden property to determine whether the method Modify() was called.
11991209
hidden [System.Collections.Hashtable] $mockModifyProperties = @{}
12001210
1211+
MyMockResource () {}
1212+
12011213
[System.Collections.Hashtable[]] Compare()
12021214
{
12031215
return @(
@@ -1262,6 +1274,8 @@ class MyMockResource : ResourceBase
12621274
# Hidden property to determine whether the method Modify() was called.
12631275
hidden [System.Collections.Hashtable] $mockModifyProperties = @{}
12641276
1277+
MyMockResource () {}
1278+
12651279
[System.Collections.Hashtable[]] Compare()
12661280
{
12671281
return @(

0 commit comments

Comments
 (0)