diff --git a/CHANGELOG.md b/CHANGELOG.md index ef08af41..25805d64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ - Added `Documentation and Examples` section to Readme.md file - see [issue #259](https://github.com/PowerShell/xNetworking/issues/259). +- Prevent unit tests from DSCResource.Tests from running during test + execution - fixes [Issue #264](https://github.com/PowerShell/xNetworking/issues/264). ## 5.1.0.0 diff --git a/Tests/TestHarness.psm1 b/Tests/TestHarness.psm1 index d9046d61..8a0b0e96 100644 --- a/Tests/TestHarness.psm1 +++ b/Tests/TestHarness.psm1 @@ -41,7 +41,21 @@ function Invoke-TestHarness # DSC Common Tests if ($PSBoundParameters.ContainsKey('DscTestsPath') -eq $true) { - $testsToRun += @( $DscTestsPath ) + $getChildItemParameters = @{ + Path = $DscTestsPath + Recurse = $true + Filter = '*.Tests.ps1' + } + + # Get all tests '*.Tests.ps1'. + $commonTestFiles = Get-ChildItem @getChildItemParameters + + # Remove DscResource.Tests unit and integration tests. + $commonTestFiles = $commonTestFiles | Where-Object -FilterScript { + $_.FullName -notmatch 'DSCResource.Tests\\Tests' + } + + $testsToRun += @( $commonTestFiles.FullName ) } $results = Invoke-Pester -Script $testsToRun `