Skip to content

Commit

Permalink
Split back into 2 describes
Browse files Browse the repository at this point in the history
  • Loading branch information
james-garriss committed Nov 22, 2024
1 parent 78a3a73 commit efa89c4
Showing 1 changed file with 17 additions and 26 deletions.
43 changes: 17 additions & 26 deletions Testing/workflow/Invoke-PSSA.Tests.ps1
Original file line number Diff line number Diff line change
@@ -1,36 +1,27 @@
# The purpose of this test is to verify that PSSA is working.

# Suppress PSSA warnings here at the root of the test file.
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidGlobalVars', '')]
param()

BeforeDiscovery {
# Source the function
. $PSScriptRoot/../../utils/workflow/Invoke-PSSA.ps1
# Invoke PSSA
$RepoRootPath = Join-Path -Path $PSScriptRoot -ChildPath '..\..' -Resolve
$global:Output = Invoke-PSSA -DebuggingMode $false -RepoPath $RepoRootPath 6>&1
}

Describe "PSSA Invoke" {
Describe "PSSA Install Check" {
It "PSSA should be installed" {
# # Source the function
# . $PSScriptRoot/../../utils/workflow/Invoke-PSSA.ps1
# # Invoke PSSA
# $RepoRootPath = Join-Path -Path $PSScriptRoot -ChildPath '..\..' -Resolve
# Invoke-PSSA -DebuggingMode $false -RepoPath $RepoRootPath
# Source the function
. $PSScriptRoot/../../utils/workflow/Invoke-PSSA.ps1
# Invoke PSSA
$RepoRootPath = Join-Path -Path $PSScriptRoot -ChildPath '..\..' -Resolve
Invoke-PSSA -DebuggingMode $false -RepoPath $RepoRootPath
$Module = Get-Module -ListAvailable -Name 'PSScriptAnalyzer'
$Module | Should -Not -BeNullOrEmpty
}
}

Describe "PSSA Output Check" {
It "PSSA should write output" {
# # Source the function
# . $PSScriptRoot/../../utils/workflow/Invoke-PSSA.ps1
# # Invoke PSSA
# $RepoRootPath = Join-Path -Path $PSScriptRoot -ChildPath '..\..' -Resolve
# $Output = Invoke-PSSA -DebuggingMode $false -RepoPath $RepoRootPath 6>&1
$global:Output | Should -Not -BeNullOrEmpty
# Source the function
. $PSScriptRoot/../../utils/workflow/Invoke-PSSA.ps1
# Invoke PSSA
$RepoRootPath = Join-Path -Path $PSScriptRoot -ChildPath '..\..' -Resolve
$Output = Invoke-PSSA -DebuggingMode $false -RepoPath $RepoRootPath 6>&1
$Output | Should -Not -BeNullOrEmpty
# Note: This is a little bit fragile. It only work as long as one of these two
# summary statements is the final output.
$global:Output | Select-Object -Last 1 | Should -BeIn @("Problems were found in the PowerShell scripts.", "No problems were found in the PowerShell scripts.")
# summary statements is the final output written.
$Output | Select-Object -Last 1 | Should -BeIn @("Problems were found in the PowerShell scripts.", "No problems were found in the PowerShell scripts.")
}
}

0 comments on commit efa89c4

Please sign in to comment.