0

I am comparing two files which looks exactly alike, and when I test locally there is no problem, but when i run the test in my azure pipeline, the test fails and says it does not look alike.

I have no idea why or what to do for debugging?

    Context "Azure Hierarchy" {
        It "Article is updated" {
            $FileContent = Get-Content $AzureHierarchyDocsFilePath
            Compare-Object -ReferenceObject $AzureHierarchy -DifferenceObject $FileContent -CaseSensitive |
            Should -BeNullOrEmpty 
        }
    }
Nadia Hansen
  • 697
  • 2
  • 6
  • 16
  • What is `$AzureHierarchy`? Is it actually an array of strings, similar to output of `Get-Content`? – zett42 Apr 10 '22 at 19:29
  • no $AzureHierarchy it is not an array of strings, but just one string that contains all the lines – Nadia Hansen Apr 10 '22 at 20:16
  • I this case I would use parameter `-Raw` for reading `$FileContent`, so it will be a single string as well and you don't need `Compare-Object` anymore. E. g. `Get-Content $AzureHierarchyDocsFilePath -Raw | Should -BeExactly $AzureHierarchy` – zett42 Apr 10 '22 at 20:29

0 Answers0