There are a number of tests in the PowerShell test suite that depend on a file asset in a way that depends on the specific bytes of the file. These tests fail on platforms that somehow differ from the expected encodings. For example, my Git configuration converts LF line endings to CRLF locally on Windows when checking out (and converts back on check-in), which is the default Git configuration on Windows, but because of this and Windows introducing a BOM, my file hashes come out differently.
I've made a small list of the tests I see failing on my machine because of this:
There might be a couple more tests like this too (I will update if I find any).
For the string/encoding-dependent tests, my suggestion is to use byte streams directly instead.
Steps to reproduce
cd $powershellBuildDir
Import-Module ./build.psm1
cd ./test/powershell/Modules/Microsoft.PowerShell.Utility
Start-PSPester Get-FileHash.Tests.ps1
Expected behavior
Get-FileHash tests pass.
Actual behavior
Hashes all come out differently

Environment data
> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.1
PSEdition Core
GitCommitId v6.0.1-261-g71cb49a99d00ae4257e63f6564fd122325b64a48
OS Microsoft Windows 10.0.16299
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
There are a number of tests in the PowerShell test suite that depend on a file asset in a way that depends on the specific bytes of the file. These tests fail on platforms that somehow differ from the expected encodings. For example, my Git configuration converts LF line endings to CRLF locally on Windows when checking out (and converts back on check-in), which is the default Git configuration on Windows, but because of this and Windows introducing a BOM, my file hashes come out differently.
I've made a small list of the tests I see failing on my machine because of this:
$longtextlike in the Write-Error tests have a similar outcomeThere might be a couple more tests like this too (I will update if I find any).
For the string/encoding-dependent tests, my suggestion is to use byte streams directly instead.
Steps to reproduce
Expected behavior
Get-FileHash tests pass.
Actual behavior
Hashes all come out differently
Environment data