-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Add ConciseView for $ErrorView #10641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
fa8b2f7
Initial changes to new error view
SteveL-MSFT ae20c6f
make $ErrorView an enum. Move Analytic view entirely to formatxml. …
SteveL-MSFT 71e4893
rename Analytic to Concise and fix it so invocation name doesn't show…
SteveL-MSFT 8471e8e
use command name as reason if it exists to different multiple cmdlets…
SteveL-MSFT e88a02d
rename enum to include View suffix
SteveL-MSFT c38c601
move vt100 helpers as private function to Get-ConciseViewPositionMess…
SteveL-MSFT 63421fb
add tests
SteveL-MSFT 2dfad59
remove unused variable
SteveL-MSFT 9c0411e
fix redirection test
SteveL-MSFT 313d37a
fix test failures
SteveL-MSFT 2c73723
another attempt to fix write-error test that fails in CI but not locally
SteveL-MSFT e2c9ee8
fix redirection in write-error test
SteveL-MSFT fde04e2
address Ilya's comments
SteveL-MSFT a9e5b46
fix consolehost test
SteveL-MSFT b7ec14b
Change `At` to `In`. Add highlight to where error is in line
SteveL-MSFT deba3af
change `In` to lowercase
SteveL-MSFT f5738eb
add verification of line number
SteveL-MSFT fe59da5
make the error message flow better in concise mode
SteveL-MSFT 0284146
fix case where message is multiple lines
SteveL-MSFT 3500ff3
fix so message is already error color
SteveL-MSFT adee296
when showing error with line, replace newlines so the message lines u…
SteveL-MSFT 30e1bc8
fix small alignment issue
SteveL-MSFT 4066273
fix some rendering of parser messages
SteveL-MSFT ba92741
make `error in` text in error color, fix rendering of long error mess…
SteveL-MSFT 4951806
Update test/powershell/Host/ConsoleHost.Tests.ps1
SteveL-MSFT f03a0a1
address Jim's comments
SteveL-MSFT File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
226 changes: 207 additions & 19 deletions
226
...m.Management.Automation/FormatAndOutput/DefaultFormatters/PowerShellCore_format_ps1xml.cs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. | ||
|
|
||
| Describe 'Tests for $ErrorView' -Tag CI { | ||
|
|
||
| It '$ErrorView is an enum' { | ||
| $ErrorView | Should -BeOfType [System.Management.Automation.ErrorView] | ||
| } | ||
|
|
||
| It '$ErrorView should have correct default value' { | ||
| $expectedDefault = 'NormalView' | ||
|
|
||
| if ((Get-ExperimentalFeature -Name PSErrorView).Enabled) { | ||
| $expectedDefault = 'ConciseView' | ||
| } | ||
|
|
||
| $ErrorView | Should -BeExactly $expectedDefault | ||
| } | ||
|
|
||
| Context 'ConciseView tests' { | ||
|
|
||
| It 'Cmdlet error should be one line of text' { | ||
| Get-Item (New-Guid) -ErrorVariable e -ErrorAction SilentlyContinue | ||
| ($e | Out-String).Trim().Count | Should -Be 1 | ||
| } | ||
|
|
||
| It 'Script error should contain path to script and line for error' { | ||
| $testScript = @' | ||
| [cmdletbinding()] | ||
| param() | ||
| $a = 1 | ||
| 123) | ||
| $b = 2 | ||
| '@ | ||
|
|
||
| $testScriptPath = Join-Path -Path $TestDrive -ChildPath 'test.ps1' | ||
| Set-Content -Path $testScriptPath -Value $testScript | ||
| $e = { & $testScriptPath } | Should -Throw -ErrorId 'UnexpectedToken' -PassThru | ||
| $e | Out-String | Should -BeLike "*$testScriptPath*" | ||
SteveL-MSFT marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| # validate line number is shown | ||
| $e | Out-String | Should -BeLike '* 4 *' | ||
| } | ||
|
|
||
| It "Remote errors show up correctly" { | ||
| Start-Job -ScriptBlock { get-item (new-guid) } | Wait-Job | Receive-Job -ErrorVariable e -ErrorAction SilentlyContinue | ||
| ($e | Out-String).Trim().Count | Should -Be 1 | ||
| } | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.