Skip to content

Pester 4 now fails on strings which match (No issue with Pester 3.4) #702

@nzspambot

Description

@nzspambot

Hi, working on this pull: dsccommunity/WebAdministrationDsc#281

noticed with appveyor now running Pester 4 it is showing weird failures such as:

      [-] Should return the correct verbose message 122ms
        Expected: {Handler with name 'StaticFile' already exist}
        But was:  {Handler with name 'StaticFile' already exist}
        at line: 81 in C:\projects\xwebadministration\Tests\Unit\MSFT_xIISHandler.tests.ps1
        81:                     $result[0] | Should Be ($LocalizedData.HandlerExists -f $Name)
      [+] Should return False 8ms
    Context Handler is Present and Ensure = Absent
      [+] Should return False 103ms
      [+] Should not return a verbose message 14ms
    Context Handler is Present and Ensure = Present
      [-] Should return the correct verbose message 108ms
        Expected: {Handler with name 'StaticFile' is not present as requested}
        But was:  {Handler with name 'StaticFile' is not present as requested}
        at line: 110 in C:\projects\xwebadministration\Tests\Unit\MSFT_xIISHandler.tests.ps1
        110:                     $result[0] | Should Be ($LocalizedData.HandlerNotPresent -f $Name)
      [+] Should return False 7ms
  Describing MSFT_xIISHandler\Set-TargetResource
    Context Ensure = Present and Handler is NOT present
      [+] Should add the handler 167ms
      [-] Should call the right Verbose Message 11ms
        Expected: {Adding handler 'StaticFile'}
        But was:  {Adding handler 'StaticFile'}
        at line: 136 in C:\projects\xwebadministration\Tests\Unit\MSFT_xIISHandler.tests.ps1
        136:                     $message | Should Be ($LocalizedData.AddingHandler -f $mockName)
    Context Ensure = Absent and Handler IS present
      [+] Should add the handler 137ms
      [-] Should call the right Verbose Message 12ms
        Expected: {Removing handler 'StaticFile'}
        But was:  {Removing handler 'StaticFile'}
        at line: 153 in C:\projects\xwebadministration\Tests\Unit\MSFT_xIISHandler.tests.ps1
        153:                     $message | Should Be ($LocalizedData.RemovingHandler -f $mockName)

For some reason Pester thinks the Should Be is not correct. This is also the case for [String]False which fails vs [bool]$false which works

    [-] Changing Default virtualDirectoryDefaults 531ms
      Expected: {false}
      But was:  {False}
      at line: 60 in C:\projects\xwebadministration\Tests\Integration\MSFT_xWebsiteDefaults.Integration.Tests.ps1
      60:             $changedValue | should be $env:PesterVirtualDirectoryDefaults
There is no operation running currently. Stop will return without any action.

Full test output is here: https://ci.appveyor.com/project/PowerShell/xwebadministration/build/1.16.900.0

Full Tests are here: https://github.com/nzspambot/xWebAdministration/tree/xIISRemoteManagement/Tests

Also note the failures are outside of my PR i.e I haven't touched them

thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions