PowerShell / WindowsCompatibility

Module that allows Windows PowerShell Modules to be used from PSCore6
Other
137 stars 33 forks source link

Test failures on Windows PS 5.1 #6

Closed SteveL-MSFT closed 6 years ago

SteveL-MSFT commented 6 years ago

There's no reason this module couldn't work on Windows PowerShell 5.1, however, there's currently 3 test failures:

Describing Test the Windows PowerShell Compatibility Session functions
  [-] Import-WinModule Microsoft.PowerShell.Management should import new commands but not overwrite existing ones 2.66s
    Expected exactly 'Script', but got Manifest.
    78:         $cmd2.Module.ModuleType | Should -BeExactly "Script"
    at <ScriptBlock>, C:\Users\slee\repos\WindowsPowerShellCompatibilityPack\Tests\CompatibilitySession.Tests.ps1: line 78
  [-] Compare-WinModule should return a non-null collection of modules 52.17s
    Expected a value, but got $null or empty.
    102:         $modules | Should -Not -BeNullOrEmpty
    at <ScriptBlock>, C:\Users\slee\repos\WindowsPowerShellCompatibilityPack\Tests\CompatibilitySession.Tests.ps1: line 10
2
  [-] Copy-WinModule should copy the specified module to the destination path 26.57s
    ParameterBindingException: A positional parameter cannot be found that accepts argument 'PnpDevice.psd1'.
    at <ScriptBlock>, C:\Users\slee\repos\WindowsPowerShellCompatibilityPack\Tests\CompatibilitySession.Tests.ps1: line 11
6
markekraus commented 6 years ago

The Import-WinModule Microsoft.PowerShell.Management should import new commands but not overwrite existing ones test wont work as in on windows because it was originally made to work on core where Get-EventLog is unavailable so it is imported. I think this test should be skipped on Windows Powershell. Microsoft.PowerShell.Management is in the NeverClobberList so this test would never import any of the commands as they would clobber.

markekraus commented 6 years ago

Compare-WinModule should return a non-null collection of modules fails because on Windows PowerShell the result will always be null. It is supposed to return modules that are on the Windows PowerShell session that are not available on current sessions. On Windows PowerShell those are the same environment, so they should always match.

markekraus commented 6 years ago

Copy-WinModule should copy the specified module to the destination path fails because line 118

$psd1File = Join-Path $tempDirToUse PnpDevice PnpDevice.psd1

That works on PSCore but not 5.1.

BrucePay commented 6 years ago

@SteveL-MSFT This module makes no sense under 5.1 and wasn't intended to work there. That's why i set the compatible edition to be core. Why did you change it?

SteveL-MSFT commented 6 years ago

@BrucePay the .Net Windows Compat Pack is absolutely needed for Windows PowerShell if the module is built targeting .Net Std and Windows Compat Pack. Also, rModule can be used against a remote target from Windows PowerShell.

SteveL-MSFT commented 6 years ago

This is no longer relevant