-
-
Notifications
You must be signed in to change notification settings - Fork 78
Migrate Pester test suite from v4 to v5 #164
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
HeyItsGilbert
wants to merge
22
commits into
master
Choose a base branch
from
pester-v5-migration
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
cb96e29
test: migrate Pester test suite from v4 to v5
HeyItsGilbert d2e5f74
chore: ✨ update .gitignore and build scripts
HeyItsGilbert cb45438
fix(requirements): 🔧 downgrade PowerShellBuild version to '0.6.1'
HeyItsGilbert bfcc022
chore(ci): ✨ update CI workflow for improved readability
HeyItsGilbert 10d74a0
chore: ✨ update task definitions in `psakeFile.ps1`
HeyItsGilbert 0a3235f
build: upgrade PowerShellBuild to 0.7.3 and skip doc generation
HeyItsGilbert 5f48f22
test: move Set-StrictMode into BeforeAll/AfterAll in strict mode cont…
HeyItsGilbert 25e336c
test: fix Pester 5 BeforeAll scoping in Help.tests.ps1
HeyItsGilbert ed3d67c
test: move Mock calls from It bodies into BeforeAll blocks
HeyItsGilbert 0453cdc
test: move env var cleanup from It body into AfterEach
HeyItsGilbert 40bbf20
test: add Acceptance tag and timeout to help link validation tests
HeyItsGilbert 7acfadc
test: add -Skip:\$nonWindows to Chocolatey Describe block
HeyItsGilbert 680b484
test: resurrect and fix Package Type install tests
HeyItsGilbert 584c4d7
test: add Get-Dependency edge case and filtering tests
HeyItsGilbert a40c4dc
test: add unit tests for Get-PSDependType, Get-PSDependScript, Instal…
HeyItsGilbert e44a77d
fix: resolve Pester v5 migration test failures
HeyItsGilbert bb9051b
fix: resolve remaining Pester v5 migration failures
HeyItsGilbert 652864c
test: fix Package, Npm, and Chocolatey mock failures in Pester v5
HeyItsGilbert e8c1c54
test: use script: scope qualifier on Package stub injection
HeyItsGilbert 23445bb
Address Copilot suggestions + Docs
HeyItsGilbert 638b553
fix(ci): 🐛 correct path for test results upload
HeyItsGilbert 2fcfaa4
fix: 🐛 update URLs to correct organization
HeyItsGilbert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,4 @@ | ||
| nuget.exe | ||
| nuget.exe | ||
| Output/** | ||
| Tests/Output/** | ||
| Tests/out/** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,111 +1,111 @@ | ||
| @{ | ||
|
|
||
| # Script module or binary module file associated with this manifest. | ||
| RootModule = 'PSDepend.psm1' | ||
| # Script module or binary module file associated with this manifest. | ||
| RootModule = 'PSDepend.psm1' | ||
|
|
||
| # Version number of this module. | ||
| ModuleVersion = '0.3.0' | ||
| # Version number of this module. | ||
| ModuleVersion = '0.3.0' | ||
|
|
||
| # ID used to uniquely identify this module | ||
| GUID = '63ea9e2a-320d-43ff-a11a-4930ca03cce6' | ||
| # ID used to uniquely identify this module | ||
| GUID = '63ea9e2a-320d-43ff-a11a-4930ca03cce6' | ||
|
|
||
| # Author of this module | ||
| Author = 'Warren Frame' | ||
| # Author of this module | ||
| Author = 'Warren Frame' | ||
|
|
||
| # Company or vendor of this module | ||
| #CompanyName = 'Unknown' | ||
| # Company or vendor of this module | ||
| #CompanyName = 'Unknown' | ||
|
|
||
| # Copyright statement for this module | ||
| Copyright = '(c) 2016 Warren F. All rights reserved.' | ||
| # Copyright statement for this module | ||
| Copyright = '(c) 2016 Warren F. All rights reserved.' | ||
|
|
||
| # Description of the functionality provided by this module | ||
| Description = 'PowerShell Dependency Handler' | ||
| # Description of the functionality provided by this module | ||
| Description = 'PowerShell Dependency Handler' | ||
|
|
||
| # Minimum version of the Windows PowerShell engine required by this module | ||
| PowerShellVersion = '3.0' | ||
| # Minimum version of the Windows PowerShell engine required by this module | ||
| PowerShellVersion = '3.0' | ||
|
|
||
| # Name of the Windows PowerShell host required by this module | ||
| # PowerShellHostName = '' | ||
| # Name of the Windows PowerShell host required by this module | ||
| # PowerShellHostName = '' | ||
|
|
||
| # Minimum version of the Windows PowerShell host required by this module | ||
| # PowerShellHostVersion = '' | ||
| # Minimum version of the Windows PowerShell host required by this module | ||
| # PowerShellHostVersion = '' | ||
|
|
||
| # Minimum version of Microsoft .NET Framework required by this module | ||
| # DotNetFrameworkVersion = '' | ||
| # Minimum version of Microsoft .NET Framework required by this module | ||
| # DotNetFrameworkVersion = '' | ||
|
|
||
| # Minimum version of the common language runtime (CLR) required by this module | ||
| # CLRVersion = '' | ||
| # Minimum version of the common language runtime (CLR) required by this module | ||
| # CLRVersion = '' | ||
|
|
||
| # Processor architecture (None, X86, Amd64) required by this module | ||
| # ProcessorArchitecture = '' | ||
| # Processor architecture (None, X86, Amd64) required by this module | ||
| # ProcessorArchitecture = '' | ||
|
|
||
| # Modules that must be imported into the global environment prior to importing this module | ||
| # RequiredModules = @() | ||
| # Modules that must be imported into the global environment prior to importing this module | ||
| # RequiredModules = @() | ||
|
|
||
| # Assemblies that must be loaded prior to importing this module | ||
| # RequiredAssemblies = @() | ||
| # Assemblies that must be loaded prior to importing this module | ||
| # RequiredAssemblies = @() | ||
|
|
||
| # Script files (.ps1) that are run in the caller's environment prior to importing this module. | ||
| # ScriptsToProcess = @() | ||
| # Script files (.ps1) that are run in the caller's environment prior to importing this module. | ||
| # ScriptsToProcess = @() | ||
|
|
||
| # Type files (.ps1xml) to be loaded when importing this module | ||
| # TypesToProcess = @() | ||
| # Type files (.ps1xml) to be loaded when importing this module | ||
| # TypesToProcess = @() | ||
|
|
||
| # Format files (.ps1xml) to be loaded when importing this module | ||
| FormatsToProcess = 'PSDepend.Format.ps1xml' | ||
| # Format files (.ps1xml) to be loaded when importing this module | ||
| FormatsToProcess = 'PSDepend.Format.ps1xml' | ||
|
|
||
| # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess | ||
| # NestedModules = @() | ||
| # Modules to import as nested modules of the module specified in RootModule/ModuleToProcess | ||
| # NestedModules = @() | ||
|
|
||
| # Functions to export from this module | ||
| FunctionsToExport = @('Get-Dependency','Get-PSDependScript','Get-PSDependType','Import-Dependency','Install-Dependency','Invoke-DependencyScript','Invoke-PSDepend','Test-Dependency') | ||
| # Functions to export from this module | ||
| FunctionsToExport = @('Get-Dependency','Get-PSDependScript','Get-PSDependType','Import-Dependency','Install-Dependency','Invoke-DependencyScript','Invoke-PSDepend','Test-Dependency') | ||
|
|
||
| # Cmdlets to export from this module | ||
| CmdletsToExport = '*' | ||
| # Cmdlets to export from this module | ||
| CmdletsToExport = '*' | ||
|
|
||
| # Variables to export from this module | ||
| # VariablesToExport = '*' | ||
| # Variables to export from this module | ||
| # VariablesToExport = '*' | ||
|
|
||
| # Aliases to export from this module | ||
| AliasesToExport = '*' | ||
| # Aliases to export from this module | ||
| AliasesToExport = '*' | ||
|
|
||
| # DSC resources to export from this module | ||
| # DscResourcesToExport = @() | ||
| # DSC resources to export from this module | ||
| # DscResourcesToExport = @() | ||
|
|
||
| # List of all modules packaged with this module | ||
| # ModuleList = @() | ||
| # List of all modules packaged with this module | ||
| # ModuleList = @() | ||
|
|
||
| # List of all files packaged with this module | ||
| # FileList = @() | ||
| # List of all files packaged with this module | ||
| # FileList = @() | ||
|
|
||
| # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. | ||
| PrivateData = @{ | ||
| # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. | ||
| PrivateData = @{ | ||
|
|
||
| PSData = @{ | ||
| PSData = @{ | ||
|
|
||
| # Tags applied to this module. These help with module discovery in online galleries. | ||
| Tags = @('requirements', 'dependencies', 'dependency', 'manager', 'bundle', 'package') | ||
| # Tags applied to this module. These help with module discovery in online galleries. | ||
| Tags = @('requirements', 'dependencies', 'dependency', 'manager', 'bundle', 'package') | ||
|
|
||
| # A URL to the license for this module. | ||
| LicenseUri = 'https://github.com/RamblingCookieMonster/PSDepend/blob/master/LICENSE' | ||
| # A URL to the license for this module. | ||
| LicenseUri = 'https://github.com/PowerShellOrg/PSDepend/blob/master/LICENSE' | ||
|
|
||
| # A URL to the main website for this project. | ||
| ProjectUri = 'https://github.com/RamblingCookieMonster/PSDepend/' | ||
| # A URL to the main website for this project. | ||
| ProjectUri = 'https://github.com/PowerShellOrg/PSDepend/' | ||
|
|
||
| # A URL to an icon representing this module. | ||
| # IconUri = '' | ||
| # A URL to an icon representing this module. | ||
| # IconUri = '' | ||
|
|
||
| # ReleaseNotes of this module | ||
| ReleaseNotes = 'Added various PowerShell Core fixes thanks to @lipkau!' | ||
| # ReleaseNotes of this module | ||
| ReleaseNotes = 'Added various PowerShell Core fixes thanks to @lipkau!' | ||
|
|
||
| } # End of PSData hashtable | ||
| } # End of PSData hashtable | ||
|
|
||
| } # End of PrivateData hashtable | ||
| } # End of PrivateData hashtable | ||
|
|
||
| # HelpInfo URI of this module | ||
| # HelpInfoURI = '' | ||
| # HelpInfo URI of this module | ||
| # HelpInfoURI = '' | ||
|
|
||
| # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. | ||
| # DefaultCommandPrefix = '' | ||
| # Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix. | ||
| # DefaultCommandPrefix = '' | ||
|
|
||
| } |
|
HeyItsGilbert marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,41 @@ | ||
| # Idea from http://stackoverflow.com/questions/7468707/deep-copy-a-dictionary-hashtable-in-powershell | ||
| # borrowed from http://stackoverflow.com/questions/8982782/does-anyone-have-a-dependency-graph-and-topological-sorting-code-snippet-for-pow | ||
| function Get-ClonedObject { | ||
| <# | ||
| .SYNOPSIS | ||
| Clones | ||
|
|
||
| .DESCRIPTION | ||
| Creates a deep copy of the provided object. This is useful for cloning | ||
| dependency objects before passing them to dependency scripts, allowing | ||
| modifications to the clone without affecting the original object. | ||
|
|
||
| .PARAMETER DeepCopyObject | ||
| The source object to copy from. | ||
|
|
||
| .EXAMPLE | ||
| Get-ClonedObject $MyObject | ||
|
|
||
| Get a deep copy of $MyObject. This is used to clone dependency objects | ||
| before passing them to dependency scripts, so that we can modify the object | ||
| without affecting the original. | ||
|
|
||
| .NOTES | ||
| Idea from https://stackoverflow.com/a/7475744 | ||
| borrowed from https://stackoverflow.com/q/8982782 | ||
|
|
||
| BinaryFormatter was removed in .NET 7; use a recursive hashtable clone | ||
| instead | ||
| #> | ||
| param($DeepCopyObject) | ||
| $memStream = new-object IO.MemoryStream | ||
| $formatter = new-object Runtime.Serialization.Formatters.Binary.BinaryFormatter | ||
| $formatter.Serialize($memStream,$DeepCopyObject) | ||
| $memStream.Position=0 | ||
| $formatter.Deserialize($memStream) | ||
| $clone = @{} | ||
| foreach ($key in $DeepCopyObject.Keys) { | ||
| $val = $DeepCopyObject[$key] | ||
| if ($val -is [hashtable]) { | ||
| $clone[$key] = Get-ClonedObject $val | ||
| } elseif ($val -is [array]) { | ||
| $clone[$key] = $val.Clone() | ||
| } else { | ||
| $clone[$key] = $val | ||
| } | ||
| } | ||
| $clone | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.