Skip to content

Commit 55d4424

Browse files
committed
Update test
1 parent 1129edc commit 55d4424

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

dsc/tests/dsc_extension_discover.tests.ps1

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,23 @@ Describe 'Discover extension tests' {
2424
$out = dsc extension list | ConvertFrom-Json
2525
$LASTEXITCODE | Should -Be 0
2626
if ($IsWindows) {
27-
$out.Count | Should -Be 3 -Because ($out | Out-String)
27+
$out.Count | Should -Be 4 -Because ($out | Out-String)
2828
$out[0].type | Should -Be 'Microsoft.DSC.Extension/Bicep'
2929
$out[0].version | Should -Be '0.1.0'
3030
$out[0].capabilities | Should -BeExactly @('import')
3131
$out[0].manifest | Should -Not -BeNullOrEmpty
32-
$out[1].type | Should -Be 'Microsoft.Windows.Appx/Discover'
32+
$out[1].type | Should -Be 'Microsoft.DSC.Extension/WindowsPowerShell'
3333
$out[1].version | Should -Be '0.1.0'
34-
$out[1].capabilities | Should -BeExactly @('discover')
34+
$out[1].capabilities | Should -BeExactly @('import')
3535
$out[1].manifest | Should -Not -BeNullOrEmpty
36-
$out[2].type | Should -BeExactly 'Test/Discover'
37-
$out[2].version | Should -BeExactly '0.1.0'
36+
$out[2].type | Should -Be 'Microsoft.Windows.Appx/Discover'
37+
$out[2].version | Should -Be '0.1.0'
3838
$out[2].capabilities | Should -BeExactly @('discover')
3939
$out[2].manifest | Should -Not -BeNullOrEmpty
40+
$out[3].type | Should -BeExactly 'Test/Discover'
41+
$out[3].version | Should -BeExactly '0.1.0'
42+
$out[3].capabilities | Should -BeExactly @('discover')
43+
$out[3].manifest | Should -Not -BeNullOrEmpty
4044
} else {
4145
$out.Count | Should -Be 2 -Because ($out | Out-String)
4246
$out[0].type | Should -Be 'Microsoft.DSC.Extension/Bicep'

extensions/powershell/convertDscResource.psm1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ function ConvertTo-DscObject
9898
$Tokens = $null
9999
$ParseErrors = $null
100100

101+
# Load the PSDesiredStateConfiguration module
102+
Import-Module -Name 'PSDesiredStateConfiguration' -RequiredVersion '1.1' -Force -ErrorAction stop -ErrorVariable $importModuleError
103+
if (-not [string]::IsNullOrEmpty($importModuleError)) {
104+
'Could not import PSDesiredStateConfiguration 1.1 in Windows PowerShell. ' + $importModuleError | Write-DscTrace -Operation Error
105+
}
106+
101107
# Remove the module version information.
102108
$start = $Content.ToLower().IndexOf('import-dscresource')
103109
if ($start -ge 0)

0 commit comments

Comments
 (0)