File tree Expand file tree Collapse file tree 3 files changed +27
-7
lines changed Expand file tree Collapse file tree 3 files changed +27
-7
lines changed Original file line number Diff line number Diff line change @@ -579,7 +579,12 @@ if ($Test) {
579
579
(Get-Module - Name Pester - ListAvailable).Path
580
580
}
581
581
582
- Invoke-Pester - Output Detailed - ErrorAction Stop
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
+ }
583
588
}
584
589
585
590
function Find-MakeAppx () {
Original file line number Diff line number Diff line change
1
+ $Script :IsPowerShellCore = $PSVersionTable.PSEdition -eq ' Core'
2
+
3
+ if ($Script :IsPowerShellCore )
4
+ {
5
+ if ($IsWindows )
6
+ {
7
+ Import-Module - Name ' PSDesiredStateConfiguration' - RequiredVersion 1.1 - UseWindowsPowerShell - WarningAction SilentlyContinue
8
+ }
9
+ Import-Module - Name ' PSDesiredStateConfiguration' - MinimumVersion 2.0 .7 - Prefix ' Pwsh'
10
+ }
11
+
1
12
function Write-DscTrace {
2
13
param (
3
14
[Parameter (Mandatory = $false )]
@@ -100,12 +111,12 @@ function ConvertTo-DscObject
100
111
101
112
(Get-Module - Name ' PSDesiredStateConfiguration' - ListAvailable | ConvertTo-Json ) | Write-DscTrace Debug
102
113
103
- # Load the PSDesiredStateConfiguration module
104
- Import-Module - Name ' PSDesiredStateConfiguration' - RequiredVersion ' 1.1' - Force - ErrorAction stop - ErrorVariable $importModuleError
105
- if (-not [string ]::IsNullOrEmpty($importModuleError )) {
106
- ' Could not import PSDesiredStateConfiguration 1.1 in Windows PowerShell. ' + $importModuleError | Write-DscTrace - Operation Error
107
- exit 1
108
- }
114
+ # # Load the PSDesiredStateConfiguration module
115
+ # Import-Module -Name 'PSDesiredStateConfiguration' -RequiredVersion '1.1' -Force -ErrorAction stop -ErrorVariable $importModuleError
116
+ # if (-not [string]::IsNullOrEmpty($importModuleError)) {
117
+ # 'Could not import PSDesiredStateConfiguration 1.1 in Windows PowerShell. ' + $importModuleError | Write-DscTrace -Operation Error
118
+ # exit 1
119
+ # }
109
120
110
121
# Remove the module version information.
111
122
$start = $Content.ToLower ().IndexOf(' import-dscresource' )
Original file line number Diff line number Diff line change @@ -11,6 +11,10 @@ BeforeDiscovery {
11
11
12
12
Describe ' PowerShell extension tests' {
13
13
It ' Example PowerShell file should work' - Skip:(! $IsWindows -or ! $isElevated ) {
14
+ Write-Verbose - Message $env: PSModulePath - Verbose
15
+
16
+ $names = Get-ChildItem " $env: SystemRoot \System32\WindowsPowerShell\v1.0\Modules" | ForEach-Object {Write-Verbose " Found module: $ ( $_.Name ) " } - Verbose
17
+
14
18
$psFile = Resolve-Path - Path " $PSScriptRoot \..\..\dsc\examples\variable.dsc.ps1"
15
19
$out = dsc - l trace config get -f $psFile 2> $TestDrive / error.log | ConvertFrom-Json
16
20
$LASTEXITCODE | Should - Be 0 - Because (Get-Content - Path $TestDrive / error.log - Raw | Out-String )
You can’t perform that action at this time.
0 commit comments