Skip to content
Open
Show file tree
Hide file tree
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 May 2, 2026
d2e5f74
chore: ✨ update .gitignore and build scripts
HeyItsGilbert May 2, 2026
cb45438
fix(requirements): 🔧 downgrade PowerShellBuild version to '0.6.1'
HeyItsGilbert May 2, 2026
bfcc022
chore(ci): ✨ update CI workflow for improved readability
HeyItsGilbert May 2, 2026
10d74a0
chore: ✨ update task definitions in `psakeFile.ps1`
HeyItsGilbert May 2, 2026
0a3235f
build: upgrade PowerShellBuild to 0.7.3 and skip doc generation
HeyItsGilbert May 2, 2026
5f48f22
test: move Set-StrictMode into BeforeAll/AfterAll in strict mode cont…
HeyItsGilbert May 3, 2026
25e336c
test: fix Pester 5 BeforeAll scoping in Help.tests.ps1
HeyItsGilbert May 3, 2026
ed3d67c
test: move Mock calls from It bodies into BeforeAll blocks
HeyItsGilbert May 3, 2026
0453cdc
test: move env var cleanup from It body into AfterEach
HeyItsGilbert May 3, 2026
40bbf20
test: add Acceptance tag and timeout to help link validation tests
HeyItsGilbert May 3, 2026
7acfadc
test: add -Skip:\$nonWindows to Chocolatey Describe block
HeyItsGilbert May 3, 2026
680b484
test: resurrect and fix Package Type install tests
HeyItsGilbert May 3, 2026
584c4d7
test: add Get-Dependency edge case and filtering tests
HeyItsGilbert May 3, 2026
a40c4dc
test: add unit tests for Get-PSDependType, Get-PSDependScript, Instal…
HeyItsGilbert May 3, 2026
e44a77d
fix: resolve Pester v5 migration test failures
HeyItsGilbert May 3, 2026
bb9051b
fix: resolve remaining Pester v5 migration failures
HeyItsGilbert May 3, 2026
652864c
test: fix Package, Npm, and Chocolatey mock failures in Pester v5
HeyItsGilbert May 3, 2026
e8c1c54
test: use script: scope qualifier on Package stub injection
HeyItsGilbert May 3, 2026
23445bb
Address Copilot suggestions + Docs
HeyItsGilbert May 3, 2026
638b553
fix(ci): 🐛 correct path for test results upload
HeyItsGilbert May 3, 2026
2fcfaa4
fix: 🐛 update URLs to correct organization
HeyItsGilbert May 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 23 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,50 +1,54 @@
name: CI
permissions:
checks: write
pull-requests: write
contents: read
on:
push:
branches: [master]
branches: [ master ]
paths:
- 'PSDepend/**'
- 'Tests/**'
- 'build.ps1'
- 'psakeFile.ps1'
- 'requirements.psd1'
- "PSDepend/**"
- "Tests/**"
- "build.ps1"
- "psakeFile.ps1"
- "requirements.psd1"
pull_request:
paths:
- 'PSDepend/**'
- 'Tests/**'
- 'build.ps1'
- 'psakeFile.ps1'
- 'requirements.psd1'
- "PSDepend/**"
- "Tests/**"
- "build.ps1"
- "psakeFile.ps1"
- "requirements.psd1"
workflow_dispatch:

jobs:
test:
name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
permissions:
contents: read
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
os: [ ubuntu-latest, windows-latest, macOS-latest ]
steps:
- uses: actions/checkout@v4
- name: Bootstrap and Test
- name: Bootstrap
shell: pwsh
run: ./build.ps1 -Bootstrap -Task Test
run: ./build.ps1 -Bootstrap -Task Init
Comment thread
HeyItsGilbert marked this conversation as resolved.
- name: Test
shell: pwsh
run: ./build.ps1 -Task Test
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: testResults-${{ matrix.os }}
path: ./Output/testResults.xml
path: ./Tests/out/testResults.xml

publish-test-results:
name: Publish Test Results
needs: test
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
if: ${{ !cancelled() }}
steps:
- uses: actions/download-artifact@v4
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
nuget.exe
nuget.exe
Output/**
Tests/Output/**
Tests/out/**
6 changes: 4 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
"powershell.codeFormatting.ignoreOneLineBlock": false,
"powershell.codeFormatting.whitespaceAfterSeparator": false,
"powershell.codeFormatting.whitespaceAroundOperator": false,
"powershell.codeFormatting.whitespaceBeforeOpenParen": false
}
"powershell.codeFormatting.whitespaceBeforeOpenParen": false,
"powershell.codeFormatting.preset": "OTBS",
"powershell.codeFormatting.trimWhitespaceAroundPipe": true
}
142 changes: 71 additions & 71 deletions PSDepend/PSDepend.psd1
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 = ''

}
45 changes: 38 additions & 7 deletions PSDepend/Private/Get-ClonedObject.ps1
Comment thread
HeyItsGilbert marked this conversation as resolved.
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
}
14 changes: 9 additions & 5 deletions PSDepend/Private/Test-PlatformSupport.ps1
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
function Test-PlatformSupport {
[cmdletbinding()]
[CmdletBinding()]
param(
$Type,
[string[]]$Support
[string[]]
$Support
)

# test core/full
if('Core' -eq $PSVersionTable.PSEdition) {
if($Support -notcontains 'core') {
# On Windows with PS Core, 'windows' in Support is sufficient (backwards compat with types
# declared before PS Core on Windows was common)
$windowsCoreOk = $IsWindows -and ($Support -contains 'windows')
if(-not $windowsCoreOk -and $Support -notcontains 'core') {
Write-Verbose "Supported platforms [$Support] for type [$Type] does not contain [core]. Pull requests welcome!"
return $false
}
}
else { # full windows powershell
} else {
# full windows powershell
if($Support -notcontains 'windows') {
Write-Verbose "Supported platforms [$Support] for type [$Type] does not contain [windows]. Pull requests welcome!"
return $false
Expand Down
Loading
Loading