@@ -11,7 +11,7 @@ AfterEachFeature {
11
11
12
12
Given ' the configuration module is imported with testing paths:' {
13
13
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
15
15
Remove-Module Configuration - ErrorAction Ignore - Force
16
16
Import-Module $ModuleBase \Configuration.psd1 - Args @ ($null , $Table.Enterprise , $Table.User , $Table.Machine ) - Scope Global
17
17
}
@@ -343,14 +343,15 @@ Given "the settings file does not exist" {
343
343
344
344
345
345
# 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" {
347
347
param ($type , $module )
348
348
$ErrorModule = $module
349
349
350
- Mock - Module $ErrorModule Write-$ type { $true } - Verifiable
351
350
# The Metadata module hides itself a little bit
352
351
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
354
355
}
355
356
}
356
357
@@ -366,7 +367,11 @@ When "the (?<type>warning|error|verbose) is logged(?: (?<exactly>exactly) (\d+)
366
367
$param.Times = $count
367
368
}
368
369
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
+ }
370
375
}
371
376
372
377
When " we add a converter that's not a scriptblock" {
@@ -401,8 +406,7 @@ Then "the settings object should have an? (.*) of type (.*)" {
401
406
Then " the settings object's (.*) should (be of type|be) (.*)" {
402
407
param ([String ]$Parameter , [String ]$operator , $Expected )
403
408
$Value = $Settings
404
-
405
- # # Write-Debug ($Settings | Out-String)
409
+ Set-StrictMode - Off
406
410
407
411
foreach ($property in $Parameter.Split (" ." )) {
408
412
$value = $value .$property
0 commit comments