@@ -396,6 +396,36 @@ Describe "Test Compress-PSResource" -tags 'CI' {
396396 }
397397 }
398398
399+ It " Compress-PSResource includes .gitkeep files (empty and non-empty)" {
400+ $version = " 1.0.0"
401+ New-ModuleManifest - Path (Join-Path - Path $script :PublishModuleBase - ChildPath " $script :PublishModuleName .psd1" ) - ModuleVersion $version - Description " $script :PublishModuleName module"
402+
403+ # Create 'hidden' directory with .gitkeep files
404+ $hiddenDir = Join-Path - Path $script :PublishModuleBase - ChildPath " hidden"
405+ New-Item - Path $hiddenDir - ItemType Directory - Force
406+
407+ # Create empty .gitkeep file in 'hidden' directory
408+ $hiddenGitkeep = Join-Path - Path $hiddenDir - ChildPath " .gitkeep"
409+ New-Item - Path $hiddenGitkeep - ItemType File - Force
410+
411+ Compress-PSResource - Path $script :PublishModuleBase - DestinationPath $script :repositoryPath
412+
413+ # Extract and verify files are included
414+ $nupkgPath = Join-Path - Path $script :repositoryPath - ChildPath " $script :PublishModuleName .$version .nupkg"
415+ $zipPath = Join-Path - Path $script :repositoryPath - ChildPath " $script :PublishModuleName .$version .zip"
416+ Rename-Item - Path $nupkgPath - NewName $zipPath
417+ $unzippedPath = Join-Path - Path $TestDrive - ChildPath " $script :PublishModuleName -gitkeep-test"
418+ New-Item $unzippedPath - ItemType directory - Force
419+ Expand-Archive - Path $zipPath - DestinationPath $unzippedPath
420+
421+ # Verify both .gitkeep files exist
422+ $extractedHiddenkeep = Join-Path - Path $unzippedPath - ChildPath " hidden" | Join-Path - ChildPath " .gitkeep"
423+
424+ Test-Path - Path $extractedHiddenkeep | Should - Be $True
425+
426+ $null = Remove-Item $unzippedPath - Force - Recurse
427+ }
428+
399429<# Test for Signing the nupkg. Signing doesn't work
400430 It "Compressed Module is able to be signed with a certificate" {
401431 $version = "1.0.0"
0 commit comments