11BeforeAll {
2-
2+ if ($null -eq $env: BHProjectPath ) {
3+ $path = Join-Path - Path $PSScriptRoot - ChildPath ' ..\build.ps1'
4+ . $path - Task Build
5+ }
36 # NEW: Pre-Specify RegEx Matching Patterns
4- $gitTagMatchRegEx = ' tag:\s?.(\d+(\.\d+)*)' # NOTE - was 'tag:\s*(\d+(?:\.\d+)*)' previously
5- $changelogTagMatchRegEx = " ^##\s\[(?<Version>(\d+\.){1,3}\d+)\]"
6-
7- $moduleName = $env: BHProjectName
8- $manifest = Import-PowerShellDataFile - Path $env: BHPSModuleManifest
9- $outputDir = Join-Path - Path $ENV: BHProjectPath - ChildPath ' Output'
10- $outputModDir = Join-Path - Path $outputDir - ChildPath $env: BHProjectName
11- $outputModVerDir = Join-Path - Path $outputModDir - ChildPath $manifest.ModuleVersion
7+ $gitTagMatchRegEx = ' tag:\s?.(\d+(\.\d+)*)' # NOTE - was 'tag:\s*(\d+(?:\.\d+)*)' previously
8+ $changelogTagMatchRegEx = " ^##\s\[(?<Version>(\d+\.){1,3}\d+)\]"
9+
10+ $moduleName = $env: BHProjectName
11+ $manifest = Import-PowerShellDataFile - Path $env: BHPSModuleManifest
12+ $outputDir = Join-Path - Path $ENV: BHProjectPath - ChildPath ' Output'
13+ $outputModDir = Join-Path - Path $outputDir - ChildPath $env: BHProjectName
14+ $outputModVerDir = Join-Path - Path $outputModDir - ChildPath $manifest.ModuleVersion
1215 $outputManifestPath = Join-Path - Path $outputModVerDir - Child " $ ( $moduleName ) .psd1"
13- $manifestData = Test-ModuleManifest - Path $outputManifestPath - Verbose:$false - ErrorAction Stop - WarningAction SilentlyContinue
16+ $manifestData = Test-ModuleManifest - Path $outputManifestPath - Verbose:$false - ErrorAction Stop - WarningAction SilentlyContinue
1417
15- $changelogPath = Join-Path - Path $env: BHProjectPath - Child ' CHANGELOG.md'
18+ $changelogPath = Join-Path - Path $env: BHProjectPath - Child ' CHANGELOG.md'
1619 $changelogVersion = Get-Content $changelogPath | ForEach-Object {
1720 if ($_ -match $changelogTagMatchRegEx ) {
1821 $changelogVersion = $matches.Version
1922 break
2023 }
2124 }
2225
23- $script :manifest = $null
26+ $script :manifest = $null
2427}
2528Describe ' Module manifest' {
2629
@@ -51,15 +54,15 @@ Describe 'Module manifest' {
5154 }
5255
5356 It ' Has a valid guid' {
54- {[guid ]::Parse($manifestData.Guid )} | Should -Not - Throw
57+ { [guid ]::Parse($manifestData.Guid ) } | Should -Not - Throw
5558 }
5659
5760 It ' Has a valid copyright' {
5861 $manifestData.CopyRight | Should -Not - BeNullOrEmpty
5962 }
6063
6164 It ' Has a valid version in the changelog' {
62- $changelogVersion | Should -Not - BeNullOrEmpty
65+ $changelogVersion | Should -Not - BeNullOrEmpty
6366 $changelogVersion -as [Version ] | Should -Not - BeNullOrEmpty
6467 }
6568
@@ -72,7 +75,7 @@ Describe 'Module manifest' {
7275Describe ' Git tagging' - Skip {
7376 BeforeAll {
7477 $gitTagVersion = $null
75-
78+
7679 # Ensure to only pull in a single git executable (in case multiple git's are found on path).
7780 if ($git = (Get-Command git - CommandType Application - ErrorAction SilentlyContinue)[0 ]) {
7881 $thisCommit = & $git log -- decorate -- oneline HEAD~1 ..HEAD
@@ -81,7 +84,7 @@ Describe 'Git tagging' -Skip {
8184 }
8285
8386 It ' Is tagged with a valid version' {
84- $gitTagVersion | Should -Not - BeNullOrEmpty
87+ $gitTagVersion | Should -Not - BeNullOrEmpty
8588 $gitTagVersion -as [Version ] | Should -Not - BeNullOrEmpty
8689 }
8790
0 commit comments