-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
78a3a73
commit efa89c4
Showing
1 changed file
with
17 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.") | ||
} | ||
} |