File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,7 +43,17 @@ function Repair-CodeSceneJaCoCoCoverageFile {
4343 $changed = (Repair-CodeSceneJaCoCoNodePathAttribute - Nodes $document.SelectNodes (' //sourcefile[@name]' ) - AttributeName ' name' ) -or $changed
4444
4545 if ($changed ) {
46- $document.Save ($Path )
46+ $settings = New-Object System.Xml.XmlWriterSettings
47+ $settings.Encoding = New-Object System.Text.UTF8Encoding($false )
48+ $settings.Indent = $false
49+ $settings.NewLineHandling = [System.Xml.NewLineHandling ]::None
50+ $writer = [System.Xml.XmlWriter ]::Create($Path , $settings )
51+ try {
52+ $document.Save ($writer )
53+ } finally {
54+ $writer.Dispose ()
55+ }
56+
4757 Write-Host " Normalized JaCoCo sourcefile paths in '$Path ' so package + sourcefile resolve to repo files."
4858 }
4959}
Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ Describe 'Repair-CodeSceneJaCoCoCoverage' {
5151 [xml ]$rewritten = Get-Content - LiteralPath $coveragePath - Raw
5252 $rewritten.SelectSingleNode (' //class[@sourcefilename]' ).GetAttribute(' sourcefilename' ) | Should - Be ' Foo.ps1'
5353 $rewritten.SelectSingleNode (' //sourcefile[@name]' ).GetAttribute(' name' ) | Should - Be ' Foo.ps1'
54+ [byte []]$bytes = [System.IO.File ]::ReadAllBytes($coveragePath )
55+ $bytes [0 ] | Should - Be 60
5456 }
5557
5658 It ' leaves already normalized filenames unchanged' {
You can’t perform that action at this time.
0 commit comments