Skip to content

Commit fe1a799

Browse files
committed
Fix test
1 parent 6496881 commit fe1a799

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

build.ps1

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -579,12 +579,7 @@ if ($Test) {
579579
(Get-Module -Name Pester -ListAvailable).Path
580580
}
581581

582-
if ($IsWindows) {
583-
$file = Get-ChildItem -Filter win_powershell.tests.ps1 -Recurse
584-
Invoke-Pester -Path $file -Output Detailed -ErrorAction Stop
585-
} else {
586-
Invoke-Pester -Output Detailed -ErrorAction Stop
587-
}
582+
Invoke-Pester -Output Detailed -ErrorAction Stop
588583
}
589584

590585
function Find-MakeAppx() {

extensions/powershell/convertDscResource.psm1

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ if ($Script:IsPowerShellCore)
66
{
77
Import-Module -Name 'PSDesiredStateConfiguration' -RequiredVersion 1.1 -UseWindowsPowerShell -WarningAction SilentlyContinue
88
}
9-
Import-Module -Name 'PSDesiredStateConfiguration' -MinimumVersion 2.0.7 -Prefix 'Pwsh'
9+
Import-Module -Name 'PSDesiredStateConfiguration' -MinimumVersion 2.0.7 -Prefix 'Pwsh' -WarningAction SilentlyContinue
1010
}
1111

1212
function Write-DscTrace {
@@ -81,7 +81,6 @@ function Build-DscConfigDocument
8181
{
8282
$dependsOnString = "[resourceId('$("{0}/{1}" -f $previousGroupHash.ModuleName, $previousGroupHash.ResourceName)','$($previousGroupHash.ResourceInstanceName)')]"
8383

84-
Write-Verbose -Message "Found '$dependsOnstring' for resource: $($dscObject.ResourceInstanceName)"
8584
# add it to the object
8685
$resource | Add-Member -MemberType NoteProperty -Name 'dependsOn' -Value @($dependsOnString)
8786
}
@@ -200,7 +199,6 @@ function ConvertTo-DscObject
200199
}
201200
else
202201
{
203-
Write-Verbose -Message "Loading DSC resources from module '$($moduleToLoad.ModuleName)'" -Verbose
204202
$currentResources = Get-DSCResource -Module $moduleToLoad.ModuleName
205203
}
206204

extensions/powershell/win_powershell.tests.ps1

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ BeforeDiscovery {
88
$isElevated = $principal.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)
99

1010
if ($env:GITHUB_ACTION) {
11+
$script:currentModulePaths = $env:PSModulePath
1112
Write-Verbose -Message "Running in GitHub Actions" -Verbose
1213
# Uninstall the PSDesiredStateConfiguration module as this requires v1.1 and the build script installs it
1314
Uninstall-PSResource -Name 'PSDesiredStateConfiguration' -Version 2.0.7 -ErrorAction Stop
@@ -62,3 +63,11 @@ configuration InvalidConfiguration {
6263
$content | Should -Match "No DSC resources found in the imported modules."
6364
}
6465
}
66+
67+
AfterAll {
68+
if ($IsWindows -and $env:GITHUB_ACTION) {
69+
Install-PSResource -Name 'PSDesiredStateConfiguration' -Version 2.0.7 -ErrorAction Stop -TrustRepository -Reinstall
70+
}
71+
72+
$env:PSModulePath = $script:currentModulePaths
73+
}

0 commit comments

Comments
 (0)