Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions PSScriptAnalyzerSettings.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
ExcludeRules = @(
'PSUseShouldProcessForStateChangingFunctions'
'PSUseSingularNouns'
'PSUseApprovedVerbs'
)
}
3 changes: 2 additions & 1 deletion Tests/Unit/Private/Resolve-ModuleSourcePaths.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ Describe 'Resolve-ModuleSourcePaths' {

# Create only a Public dir, no Enums/Classes/Private
New-Item -Path (Join-Path $TempRoot 'Public') -ItemType Directory -Force | Out-Null
Set-Content -Path (Join-Path $TempRoot 'Public' 'Test-Func.ps1') -Value 'function Test-Func { }'
$PublicDir = Join-Path -Path $TempRoot -ChildPath 'Public'
Set-Content -Path (Join-Path -Path $PublicDir -ChildPath 'Test-Func.ps1') -Value 'function Test-Func { }'

$Result = Resolve-ModuleSourcePaths -ModuleRoot $TempRoot
}
Expand Down
14 changes: 12 additions & 2 deletions Tests/Unit/Private/Update-ManifestField.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,19 @@ Describe 'Update-ManifestField' {
BeforeEach {
# Create a fresh copy for each test
Copy-Item -Path $Script:RefManifestPath -Destination $Script:PrereleaseManifestPath -Force
# Uncomment the Prerelease field so Update-ManifestField can locate and replace it
# Ensure the Prerelease field exists and is uncommented.
# PS 5.1 New-ModuleManifest may not generate the Prerelease field at all.
$Content = [System.IO.File]::ReadAllText($Script:PrereleaseManifestPath, [System.Text.Encoding]::UTF8)
$Content = $Content -replace '# Prerelease = ''''', 'Prerelease = '''''
if ($Content -match '# Prerelease = ') {
# PS 7+: uncomment the existing field
$Content = $Content -replace '# Prerelease = ''''', 'Prerelease = '''''
}
elseif ($Content -notmatch '\bPrerelease\s*=') {
# PS 5.1: field missing entirely, inject into PSData section
$PsdMarker = ' } # End of PSData hashtable'
$Injection = " Prerelease = ''" + "`r`n" + "`r`n" + $PsdMarker
$Content = $Content.Replace($PsdMarker, $Injection)
}
[System.IO.File]::WriteAllText($Script:PrereleaseManifestPath, $Content, [System.Text.UTF8Encoding]::new($true))
}

Expand Down