pnp / PnP-PowerShell

SharePoint PnP PowerShell CmdLets
https://pnp.github.io/powershell
Other
990 stars 663 forks source link

[BUG] GitHub Actions Pester Tests now all fail with 3.24.2008.1 #2881

Open NikCharlebois opened 4 years ago

NikCharlebois commented 4 years ago

Reporting an Issue or Missing Feature

Issue

Expected behavior

Pester Unit Tests executed in the context of a GitHub action should all pass

Info

As part of the Microsoft365DSC project, we run several Pester Unit Tests to validate our SPO modules. All SPO modules use PnP under the cover. Since the latest version, all SPO tests fail. If I take the same PR, and roll back to 3.23.2007.1 then they all succeed, therefore I believe the new version is what's causing the issue. The Unit tests have not changed on our end in over 3 months. I have confirmed that both 3.24.2008.0 and 3.24.2008.1 are having the issue.

The error thrown is the following (it happens for every PnP cmdlet used in our tests). RuntimeException: Unable to find type [SharePointPnP.PowerShell.Commands.Base.PipeBinds.AppMetadataPipeBind]. PSInvalidCastException: Cannot convert value "Get-PnPApp" to type "System.Management.Automation.CommandMetadata". Error: "Unable to find type [SharePointPnP.PowerShell.Commands.Base.PipeBinds.AppMetadataPipeBind]." RuntimeException: Cannot convert value "Get-PnPApp" to type "System.Management.Automation.CommandMetadata". Error: "Unable to find type [SharePointPnP.PowerShell.Commands.Base.PipeBinds.AppMetadataPipeBind]."

NikCharlebois commented 4 years ago

Looks like the issue is coming from the parameters definition. I've written a script a while ago that automatically reverse engineers all cmdlets from a module into Pester Stubs. In previous version, Parameters were all in the shape of:

SharePointPnP.PowerShell.Commands.Base.PipeBinds

Whereas with the new versions they are: PnP.PowerShell.Commands.Base.PipeBinds

NikCharlebois commented 4 years ago

Just to be clear, we've updated all of our stubs in Microsoft365DSC and this is no longer a blocker. Just wanted to keep you posted about the issue and its source in case you run into similar problems with other customers.