@@ -11,7 +11,7 @@ AfterEachFeature {
1111
1212Given ' the configuration module is imported with testing paths:' {
1313 param ($Table )
14- $ModuleBase = (Get-Module Configuration - ListAvailable | Sort Version - Descending)[0 ].ModuleBase
14+ $ModuleBase = (Get-Module Configuration - ListAvailable | Sort-Object Version - Descending)[0 ].ModuleBase
1515 Remove-Module Configuration - ErrorAction Ignore - Force
1616 Import-Module $ModuleBase \Configuration.psd1 - Args @ ($null , $Table.Enterprise , $Table.User , $Table.Machine ) - Scope Global
1717}
@@ -343,14 +343,15 @@ Given "the settings file does not exist" {
343343
344344
345345# This step will create verifiable/counting loggable mocks for Write-Warning, Write-Error, Write-Verbose
346- When " we expect an? (?<type>warning|error|verbose) in the (?<module>.*) module" {
346+ Given " we expect an? (?<type>warning|error|verbose) in the (?<module>.*) module" {
347347 param ($type , $module )
348348 $ErrorModule = $module
349349
350- Mock - Module $ErrorModule Write-$ type { $true } - Verifiable
351350 # The Metadata module hides itself a little bit
352351 if ($Type -eq " Error" -and ($ErrorModule -eq " Metadata" )) {
353- Mock - Module $ErrorModule WriteError { Write-Error " Error" - TargetObject $Args }
352+ Mock - Module $ErrorModule WriteError { Write-Host " WriteError: $Message " - Foreground Red } - Verifiable
353+ } else {
354+ Mock - Module $ErrorModule Write-$ type { Write-Host " Write-Error: $Message " - Foreground Red } - Verifiable
354355 }
355356}
356357
@@ -366,7 +367,11 @@ When "the (?<type>warning|error|verbose) is logged(?: (?<exactly>exactly) (\d+)
366367 $param.Times = $count
367368 }
368369
369- Assert-MockCalled - Module $ErrorModule - Command Write-$ type @param
370+ if ($Type -eq " Error" -and ($ErrorModule -eq " Metadata" )) {
371+ Assert-MockCalled - Module $ErrorModule - Command WriteError @param
372+ } else {
373+ Assert-MockCalled - Module $ErrorModule - Command Write-$ type @param
374+ }
370375}
371376
372377When " we add a converter that's not a scriptblock" {
@@ -401,8 +406,7 @@ Then "the settings object should have an? (.*) of type (.*)" {
401406Then " the settings object's (.*) should (be of type|be) (.*)" {
402407 param ([String ]$Parameter , [String ]$operator , $Expected )
403408 $Value = $Settings
404-
405- # # Write-Debug ($Settings | Out-String)
409+ Set-StrictMode - Off
406410
407411 foreach ($property in $Parameter.Split (" ." )) {
408412 $value = $value .$property
0 commit comments