Skip to content

Commit

Permalink
test: publishing (#67)
Browse files Browse the repository at this point in the history
* add publishing tests

* lint
  • Loading branch information
vaind authored Oct 23, 2024
1 parent c85b27c commit dbb82d1
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
testResults.xml
temp
32 changes: 32 additions & 0 deletions tests/publishing.tests.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Describe 'Publishing' {
It 'Test-ModuleManifest' {
Test-ModuleManifest -Path "$PSScriptRoot/../modules/Sentry/Sentry.psd1" -Verbose
}

It 'Publish-Module' {
$tempModuleDir = "$PSScriptRoot/temp/Sentry"
Remove-Item $tempModuleDir -Recurse -ErrorAction SilentlyContinue
Copy-Item "$PSScriptRoot/../modules/Sentry" -Destination $tempModuleDir -Recurse

# Update version in the module manifest
$content = Get-Content "$tempModuleDir/Sentry.psd1"
$changes = 0
for ($i = 0; $i -lt $content.Length; $i++)
{
if ($content[$i] -match "^(\s*ModuleVersion\s*=\s*)'[^']*'\s*$")
{
$content[$i] = $matches[1] + "'9.9.9'"
$changes++
}
if ($content[$i] -match "^(\s*Prerelease\s*=\s*)'[^']*'\s*$")
{
$content[$i] = $matches[1] + "'test'"
$changes++
}
}
$changes | Should -Be 2
$content | Out-File "$tempModuleDir/Sentry.psd1"

Publish-Module -Path $tempModuleDir -NuGetApiKey 'test' -Verbose -WhatIf
}
}

0 comments on commit dbb82d1

Please sign in to comment.