Skip to content

Commit

Permalink
Merge pull request #31 from theohbrothers/test/integration-utilize-pe…
Browse files Browse the repository at this point in the history
…ster-for-integration-tests

Test (integration): Utilize Pester for integration tests
  • Loading branch information
joeltimothyoh authored May 11, 2024
2 parents 5a78377 + 3825663 commit daebcce
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 61 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Describe "PSRepositoryReleaseManager" -Tag 'Integration' {
BeforeAll {
$ErrorActionPreference = 'Continue'
$ErrorView = 'NormalView'
$VerbosePreference = 'Continue'
$env:RELEASE_TAG_REF = git describe --tags --abbrev=0
}
BeforeEach {
}
AfterEach {
}
It "Runs Invoke-Generate.ps1 -ReleaseTagRef -ReleaseNotesVariant -ReleaseNotesPath" {
$ReleaseNotesVariant = Get-ChildItem "../src/PSRepositoryReleaseManager/generate/variants" | % { $_.BaseName }
"Release notes variants:" | Write-Verbose
$ReleaseNotesVariant | Write-Host

foreach ($variant in $ReleaseNotesVariant) {
$env:RELEASE_NOTES_VARIANT = $variant
$env:RELEASE_NOTES_PATH = "$(git rev-parse --show-toplevel)/.release-notes.$variant.md"

$stdout = ../src/scripts/ci/Invoke-Generate.ps1 -ReleaseTagRef $env:RELEASE_TAG_REF -ReleaseNotesVariant $env:RELEASE_NOTES_VARIANT -ReleaseNotesPath $env:RELEASE_NOTES_PATH
"Generate notes content:" | Write-Verbose
Get-Content -Path "$stdout" | Out-String -Stream | % { $_.Trim() } | ? { $_ } | Write-Host
}
}
}
58 changes: 0 additions & 58 deletions test/PSRepositoryReleaseManager.Tests.ps1

This file was deleted.

7 changes: 4 additions & 3 deletions test/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@ try {
# Run unit tests
"Running unit tests" | Write-Verbose
$testFailed = $false
$unitResult = Invoke-Pester -Script "$PSScriptRoot\..\src\PSRepositoryReleaseManager" -PassThru
$unitResult = Invoke-Pester -Script "$PSScriptRoot\..\src\PSRepositoryReleaseManager" -Tag 'Unit' -PassThru
if ($unitResult.FailedCount -gt 0) {
"$($unitResult.FailedCount) tests failed." | Write-Warning
$testFailed = $true
}

# Run integration tests
"Running integration tests" | Write-Verbose
$integratedFailedCount = & "$PSScriptRoot\PSRepositoryReleaseManager.Tests.ps1"
if ($integratedFailedCount -gt 0) {
$integratedResult = Invoke-Pester -Script "$PSScriptRoot\..\src\PSRepositoryReleaseManager" -Tag 'Integration' -PassThru
if ($integratedResult.FailedCount -gt 0) {
"$($integratedResult.FailedCount) tests failed." | Write-Warning
$testFailed = $true
}

Expand Down

0 comments on commit daebcce

Please sign in to comment.