1+ $ProjectRoot = (Resolve-Path " $PSScriptRoot \.." ).path
2+ $ModuleName = Split-Path $ProjectRoot - Leaf
3+ $ModuleRoot = Join-Path - Path $ProjectRoot - ChildPath $ModuleName - AdditionalChildPath " $ModuleName .psm1"
4+ $ManifestRoot = Join-Path - Path $ProjectRoot - ChildPath $ModuleName - AdditionalChildPath " $ModuleName .psd1"
5+ $Functions = Join-Path - Path $ProjectRoot - ChildPath $ModuleName - AdditionalChildPath Functions
6+ $Helpers = Join-Path - Path $ProjectRoot - ChildPath $ModuleName - AdditionalChildPath Helpers
7+
18BeforeAll {
9+ # Write-Host 'BeforeAll'
210 Try {
311 Import-module PSScriptAnalyzer - ErrorAction STOP
412 }
@@ -9,7 +17,6 @@ BeforeAll {
917 Install-Module - Name PSScriptAnalyzer - Force
1018 }
1119
12- # $Scripts = Get-ChildItem -Include *.ps1 -Exclude *WiP.ps1 -Recurse
1320 $ProjectRoot = (Resolve-Path " $PSScriptRoot \.." ).path
1421 $ModuleName = Split-Path $ProjectRoot - Leaf
1522 $ModuleRoot = Join-Path - Path $ProjectRoot - ChildPath $ModuleName - AdditionalChildPath " $ModuleName .psm1"
@@ -22,6 +29,8 @@ Describe "General project validation: $ModuleName" -Tag 'Module_Validation' {
2229
2330 Context ' Project should be viable' {
2431
32+ # Write-Host 'Context: Project should be viable'
33+
2534 It " Test-Path $ProjectRoot should be True" {
2635 Test-Path $ProjectRoot | Should - Be $True
2736 }
@@ -37,20 +46,18 @@ Describe "General project validation: $ModuleName" -Tag 'Module_Validation' {
3746 it ' Passes all default PSScriptAnalyzer rules' {
3847 Invoke-ScriptAnalyzer - Path $ManifestRoot - ExcludeRule PSUseToExportFieldsInManifest | should - BeNullOrEmpty
3948 }
40-
41-
4249 }
4350}
4451
4552Describe " Validating commands are viable" - Tag ' Command_Validation' {
4653
4754 Context ' Public functions should be viable' {
55+ # Write-Host 'Context: Public functions should be viable'
4856
49- BeforeAll {
50- $AllFunctions = Get-ChildItem - Path $Functions - Include * .ps1 - Recurse
51- $TestCase = $AllFunctions | Foreach-Object {@ {file = $_ }}
52- }
53-
57+ # Write-Host "Functions path: $Functions"
58+ $AllFunctions = Get-ChildItem - Path $Functions - Include * .ps1 - Recurse
59+ $TestCase = $AllFunctions | Foreach-Object {@ {file = $_ }}
60+ # Write-Host "Test cases generated: $($TestCase | Out-String)"
5461
5562 It " Script <file> should be valid powershell" - TestCases $TestCase {
5663 param ($File )
@@ -94,10 +101,10 @@ Describe "Validating commands are viable" -Tag 'Command_Validation' {
94101
95102 Context ' Private helpers should be viable' {
96103
97- BeforeAll {
98- $AllHelpers = Get-ChildItem - Path $Functions - Include * .ps1 - Recurse
99- $TestCase = $AllHelpers | Foreach-Object {@ {file = $_ }}
100- }
104+ # Write-Host 'Context: Private helpers should be viable'
105+ $AllHelpers = Get-ChildItem - Path $Functions - Include * .ps1 - Recurse
106+ $TestCase = $AllHelpers | Foreach-Object {@ {file = $_ }}
107+ # Write-Host "Test cases generated: $($TestCase | Out-String)"
101108
102109 It " Script <file> should be valid powershell" - TestCases $TestCase {
103110 param ($File )
@@ -115,8 +122,5 @@ Describe "Validating commands are viable" -Tag 'Command_Validation' {
115122 param ($File )
116123 Test-Path $File.Fullname | Should - Be $True
117124 }
118-
119-
120125 }
121-
122126}
0 commit comments