You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the actual value or expected value contain escape character (for example an ANSI sequence) the message are not shown correctly.
Expected Behavior
Should show the special character like escape characters. Also ANSI sequences should not be hidden as they are part of the strings being compared.
Steps To Reproduce
Describe 'Something' {
It 'Escape in expected value should be handled correctly' {
'31;3;5m'| Should-BeString "`e[313;5m"
}
It 'Escape in actual value should be handled correctly' {
"`e31;3;5m"| Should-BeString '[31;3;5m'
}
It 'Escape in both expected and actual value should be handled correctly' {
"`e31;3;5m"| Should-BeString "`e[31;3;5m"
}
}
Outputs:
Starting discovery in 1 files.
Discovery found 11 tests in 30ms.
Running tests.
[-] Something.Escape in expected value should be handled correctly 10ms (9ms|2ms)
Expected [string] '', but got [string] '31;3;5m'.
at '31;3;5m' | Should-BeString "`e[313;5m", /Users/johlju/source/Viscalyx.Common/tests/Unit/Public/ConvertTo-AnsiSequence.tests.ps1:89
[-] Something.Escape in actual value should be handled correctly 24ms (22ms|2ms)
Expected [string] '[31;3;5m', but got [string] '1;3;5m'.
at "`e31;3;5m" | Should-BeString '[31;3;5m', /Users/johlju/source/Viscalyx.Common/tests/Unit/Public/ConvertTo-AnsiSequence.tests.ps1:93
[-] Something.Escape in both expected and actual value should be handled correctly 37ms (30ms|6ms)
Expected [string] '', but got [string] '1;3;5m'.
at "`e31;3;5m" | Should-BeString "`e[31;3;5m", /Users/johlju/source/Viscalyx.Common/tests/Unit/Public/ConvertTo-AnsiSequence.tests.ps1:97
Tests completed in 432ms
Tests Passed: 8, Failed: 3, Skipped: 0, Inconclusive: 0, NotRun: 0
Describe your environment
Pester version : 6.0.0-alpha4 /Users/johlju/source/Viscalyx.Common/output/RequiredModules/Pester/6.0.0/Pester.psm1
PowerShell version : 7.4.4
OS version : Unix 14.6.1
Possible Solution?
Maybe convert special characters in actual and expected value to their unicode equivalent?
Maybe this should go into the Format-Nicely function, so all strings are parsed? 🤔 Otherwise strings in expected and actual could also affect the output in the console (changing colors etc.)
Outputs:
␀␇␈␉␌␍␊␛
The text was updated successfully, but these errors were encountered:
Checklist
What is the issue?
If the actual value or expected value contain escape character (for example an ANSI sequence) the message are not shown correctly.
Expected Behavior
Should show the special character like escape characters. Also ANSI sequences should not be hidden as they are part of the strings being compared.
Steps To Reproduce
Outputs:
Describe your environment
Possible Solution?
Maybe convert special characters in actual and expected value to their unicode equivalent?
Maybe this should go into the
Format-Nicely
function, so all strings are parsed? 🤔 Otherwise strings in expected and actual could also affect the output in the console (changing colors etc.)Outputs:
The text was updated successfully, but these errors were encountered: