Skip to content

Commit 908cd3a

Browse files
committed
cleanup and do not run test in WMF4
1 parent 9a2f490 commit 908cd3a

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

Tests/Engine/ModuleDependencyHandler.tests.ps1

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,21 @@ $directory = Split-Path -Parent $MyInvocation.MyCommand.Path
22

33
Describe "Resolve DSC Resource Dependency" {
44
BeforeAll {
5-
$skipTest = $false
6-
$skipUnitTest = $false # Test that do not require DSC to be installed
7-
if ($IsMacOS -or $testingLibararyUsage -or ($PSversionTable.PSVersion -lt [Version]'5.0.0'))
5+
$skipTest = $false # Test that require DSC to be installed
6+
if ($testingLibararyUsage -or ($PSversionTable.PSVersion -lt [Version]'5.0.0'))
87
{
98
$skipTest = $true
10-
# $skipUnitTest = $true
119
return
1210
}
13-
if ($IsLinux)
11+
if ($IsLinux -or $IsMacOS)
1412
{
1513
$dscIsInstalled = Test-Path /etc/opt/omi/conf/dsc/configuration
1614
if (-not $dscIsInstalled)
1715
{
1816
$skipTest = $true
1917
}
2018
}
19+
2120
$SavedPSModulePath = $env:PSModulePath
2221
$violationFileName = 'MissingDSCResource.ps1'
2322
$violationFilePath = Join-Path $directory $violationFileName
@@ -42,12 +41,12 @@ Describe "Resolve DSC Resource Dependency" {
4241

4342
Context "Module handler class" {
4443
BeforeAll {
45-
if ( $skipTest -and $skipUnitTest ) { return }
44+
if ( $skipTest ) { return }
4645
$moduleHandlerType = [Microsoft.Windows.PowerShell.ScriptAnalyzer.Generic.ModuleDependencyHandler]
4746
$oldEnvVars = Get-Item Env:\* | Sort-Object -Property Key
4847
$oldPSModulePath = $env:PSModulePath
4948
}
50-
It "Sets defaults correctly" -skip:$skipUnitTest {
49+
It "Sets defaults correctly" -Skip:($PSversionTable.PSVersion -lt [Version]'5.0.0') {
5150
$rsp = [runspacefactory]::CreateRunspace()
5251
$rsp.Open()
5352
$depHandler = $moduleHandlerType::new($rsp)
@@ -74,15 +73,15 @@ Describe "Resolve DSC Resource Dependency" {
7473
$rsp.Dispose()
7574
}
7675

77-
It "Keeps the environment variables unchanged" -skip:$skipUnitTest {
76+
It "Keeps the environment variables unchanged" -Skip:($PSversionTable.PSVersion -lt [Version]'5.0.0') {
7877
Test-EnvironmentVariables($oldEnvVars)
7978
}
8079

81-
It "Throws if runspace is null" -skip:$skipUnitTest {
80+
It "Throws if runspace is null" -Skip:($PSversionTable.PSVersion -lt [Version]'5.0.0') {
8281
{$moduleHandlerType::new($null)} | Should -Throw
8382
}
8483

85-
It "Throws if runspace is not opened" -skip:$skipUnitTest {
84+
It "Throws if runspace is not opened" -Skip:($PSversionTable.PSVersion -lt [Version]'5.0.0') {
8685
$rsp = [runspacefactory]::CreateRunspace()
8786
{$moduleHandlerType::new($rsp)} | Should -Throw
8887
$rsp.Dispose()

0 commit comments

Comments
 (0)