PoshCode / ModuleBuilder

A PowerShell Module to help scripters write, version, sign, package, and publish.
MIT License
445 stars 54 forks source link

Failed tests after install #100

Closed chscott closed 3 years ago

chscott commented 3 years ago

I followed the readme documentation to clone and build ModuleBuilder. The only deviation from that was to add in Install-RequiredModule.ps1 from https://github.com/PoshCode/ModuleBuilder/pull/98. When I get to Step 5, I get these failed tests:

   Context Moving Using Statements to the beginning of the file
      [+] It should Move all using statements in `n terminated files to the top 139ms
      [+] It should Move all using statements in `r`n terminated files to the top 55ms
      [+] It should Not change the content again if there are no out-of-place using statements 40ms
      [-] It should Move using statements even if types are used 199ms
        Expected 0, but got 3.
        101:             $ErrorFound.Count | Should -Be $ErrorAfter
        at <ScriptBlock>, C:\src\ModuleBuilder\Tests\Private\MoveUsingStatements.Tests.ps1: line 101
      [-] It should Move using statements even when there are (other) parse errors 77ms
        Expected 1, but got 2.
        101:             $ErrorFound.Count | Should -Be $ErrorAfter
        at <ScriptBlock>, C:\src\ModuleBuilder\Tests\Private\MoveUsingStatements.Tests.ps1: line 101
  Describing Convert-LineNumber
    [-] Should map line number 703 in the Module to the matching line the Source 68ms
      RuntimeException: Failed to match module line 703 to .\Public\Build-Module.ps1 line 123.
      Expected 
      But got          # Controls whether or not there is a build or cleanup performed
      at <ScriptBlock>, C:\src\ModuleBuilder\Tests\Public\Convert-LineNumber.Tests.ps1: line 24
    [+] Should map line number 449 in the Module to the matching line the Source 26ms
    [+] Should map line number 208 in the Module to the matching line the Source 13ms
    [+] Should map line number 278 in the Module to the matching line the Source 15ms
    [-] Should map line number 620 in the Module to the matching line the Source 27ms
      RuntimeException: Failed to match module line 620 to .\Public\Build-Module.ps1 line 40.
      Expected     [CmdletBinding(DefaultParameterSetName="SemanticVersion")]
      But got      [Alias("build")]
      at <ScriptBlock>, C:\src\ModuleBuilder\Tests\Public\Convert-LineNumber.Tests.ps1: line 24
    [+] Should throw if the SourceFile doesn't exist 68ms
    [+] Should work with an error PositionMessage 67ms
    [+] Should work with ScriptStackTrace messages 67ms
    [+] Should pass through InputObject for updating objects like CodeCoverage or ErrorRecord 62ms
Jaykul commented 3 years ago

From the test failures you had, it looks like were running into problems with the fix for #96, but I cannot reproduce it at all. From your paste, it looks like you're on Windows, but what version?

I've gone over the ReadMe to see if I can tell what's happening, because obviously it's working for me (and the CI builds are passing, I just merged #98 and that build passed too, I went over the readme just now, and noticed that it doesn't recommend using the test.ps1 script, so I've updated it a tiny bit https://github.com/PoshCode/ModuleBuilder/commit/abb0e09297d55e6c9e3f519b7e177eae1da7f3d9...