mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Add -UseMinimalHeader to Start-Transcript to minimize transcript header (#8402)
This commit is contained in:
@@ -293,4 +293,28 @@ Describe "Start-Transcript, Stop-Transcript tests" -tags "CI" {
|
||||
$transcriptFilePath | Should -Exist
|
||||
$transcriptFilePath | Should -FileContentMatchMultiline $expectedContent
|
||||
}
|
||||
|
||||
It "UseMinimalHeader should reduce length of transcript header" {
|
||||
$script = {
|
||||
Start-Transcript -Path $transcriptFilePath
|
||||
Stop-Transcript
|
||||
}
|
||||
|
||||
$transcriptMinHeaderFilePath = $transcriptFilePath + "_minimal"
|
||||
$scriptMinHeader = {
|
||||
Start-Transcript -Path $transcriptMinHeaderFilePath -UseMinimalHeader
|
||||
Stop-Transcript
|
||||
}
|
||||
|
||||
& $script
|
||||
$transcriptFilePath | Should -Exist
|
||||
$transcriptLength = (Get-Content -Path $transcriptFilePath -Raw).Length
|
||||
|
||||
& $scriptMinHeader
|
||||
$transcriptMinHeaderFilePath | Should -Exist
|
||||
$transcriptMinHeaderLength = (Get-Content -Path $transcriptMinHeaderFilePath -Raw).Length
|
||||
Remove-Item $transcriptMinHeaderFilePath -ErrorAction SilentlyContinue
|
||||
|
||||
$transcriptMinHeaderLength | Should -BeLessThan $transcriptLength
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user