Update ConciseView to use TargetObject if applicable (#11075)

This commit is contained in:
Steve Lee
2019-12-10 09:50:51 -08:00
committed by Aditya Patwardhan
parent 25895e34b8
commit 6e4da244c5
2 changed files with 42 additions and 8 deletions
@@ -57,5 +57,14 @@ Describe 'Tests for $ErrorView' -Tag CI {
$e = pwsh -noprofile -command 'function test-myerror { [cmdletbinding()] param() write-error "myError" }; test-myerror -ErrorAction SilentlyContinue; $error[0] | Out-String'
[string]::Join('', $e).Trim() | Should -BeLike "*test-myerror:*myError*" # wildcard due to VT100
}
It "Pester Should shows test file and not pester" {
$testScript = '1 + 1 | Should -Be 3'
$testScriptPath = Join-Path -Path $TestDrive -ChildPath 'mytest.ps1'
Set-Content -Path $testScriptPath -Value $testScript
$e = { & $testScriptPath } | Should -Throw -ErrorId 'PesterAssertionFailed' -PassThru
$e | Out-String | Should -BeLike "*$testScriptPath*"
$e | Out-String | Should -Not -BeLike '*pester*'
}
}
}