Skip to content

Commit 3801e54

Browse files
Implement new test for checking module tags
Spaces in modules are not allowed. Wrote a pester test to avoid spaces in module tags
1 parent 0dda868 commit 3801e54

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed
Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Describe "Validating the module manifest" {
1+
Describe "Validating the module manifest" {
22
$moduleRoot = (Resolve-Path "$PSScriptRoot\..\..").Path
33
$manifest = ((Get-Content "$moduleRoot\PSModuleDevelopment.psd1") -join "`n") | Invoke-Expression
44
[version]$moduleVersion = Get-Item "$moduleRoot\PSModuleDevelopment.psm1" | Select-String -Pattern '\$script:PSModuleVersion = "(.*?)"' | ForEach-Object { $_.Matches[0].Groups[1].Value }
@@ -8,41 +8,47 @@
88
$count = (Compare-Object -ReferenceObject $files.BaseName -DifferenceObject $manifest.FunctionsToExport).Count
99
$count | Should be 0
1010
}
11-
11+
1212
It "Exports none of its internal functions" {
1313
$files = Get-ChildItem "$moduleRoot\internal\functions" -Recurse -File -Filter "*.ps1"
1414
$files | Where-Object BaseName -In $manifest.FunctionsToExport | Should Be $null
1515
}
16-
16+
1717
It "Has the same version as the psm1 file" {
1818
([version]$manifest.ModuleVersion) | Should Be $moduleVersion
1919
}
2020
}
21-
21+
2222
Context "Individual file validation" {
2323
It "The root module file exists" {
2424
Test-Path "$moduleRoot\$($manifest.RootModule)" | Should Be $true
2525
}
26-
26+
2727
foreach ($format in $manifest.FormatsToProcess)
2828
{
2929
It "The file $format should exist" {
3030
Test-Path "$moduleRoot\$format" | Should Be $true
3131
}
3232
}
33-
33+
3434
foreach ($type in $manifest.TypesToProcess)
3535
{
3636
It "The file $type should exist" {
3737
Test-Path "$moduleRoot\$type" | Should Be $true
3838
}
3939
}
40-
40+
4141
foreach ($assembly in $manifest.RequiredAssemblies)
4242
{
4343
It "The file $assembly should exist" {
4444
Test-Path "$moduleRoot\$assembly" | Should Be $true
4545
}
4646
}
47+
48+
foreach ($tag in $manifest.PrivateData.PSData.Tags) {
49+
It "Tags should have no spaces in name" {
50+
$tag -match " " | Should -Be $false
51+
}
52+
}
4753
}
48-
}
54+
}

0 commit comments

Comments
 (0)