@@ -52,21 +52,22 @@ Describe "Regression test for #55: I can pass SourceDirectories" -Tag Integratio
5252}
5353
5454Describe " Regression test for #55: I can pass SourceDirectories and PublicFilter" - Tag Integration, Regression {
55- $Output = Build-Module $PSScriptRoot \Source1\build.psd1 - SourceDirectories " Private" - PublicFilter " P*\*" - Passthru
56- $Module = [IO.Path ]::ChangeExtension($Output.Path , " psm1" )
55+ BeforeAll {
56+ $Output = Build-Module $PSScriptRoot \Source1\build.psd1 - SourceDirectories " Private" - PublicFilter " Pub*\*" - Passthru
57+ $Module = [IO.Path ]::ChangeExtension($Output.Path , " psm1" )
58+ $Metadata = Import-Metadata $Output.Path
59+ }
5760
5861 It " Should not put the module's DefaultCommandPrefix into the psm1 as code. Duh!" {
5962 $Module | Should -Not - FileContentMatch ' ^Source$'
6063 }
6164
62- $Metadata = Import-Metadata $Output.Path
63-
6465 It " Should not have any FunctionsToExport if SourceDirectories don't match the PublicFilter" {
65- $Metadata.FunctionsToExport | Should - Be @ ( " Get-TestNotExportedAliases " , " GetFinale " , " GetPreview " )
66+ $Metadata.FunctionsToExport | Should - BeNullOrEmpty
6667 }
6768
6869 It " Should update AliasesToExport in the manifest" {
69- $Metadata.AliasesToExport | Should - Be @ (" GF " , " GP " )
70+ $Metadata.AliasesToExport | Should - Be @ (" Get-MyAlias " )
7071 }
7172
7273 It " Should de-dupe and move using statements to the top of the file" {
@@ -111,6 +112,36 @@ Describe "Supports building without a build.psd1" -Tag Integration {
111112 $Build.Output = Build-Module @BuildParameters - Passthru
112113 }
113114
115+ It " Works even based on current path" {
116+ $BuildParameters = @ {
117+ OutputDirectory = " TestDrive:\Result1"
118+ VersionedOutputDirectory = $true
119+ }
120+ Push-Location TestDrive:\Source1
121+ try {
122+ $Build.Output = Build-Module @BuildParameters - Passthru
123+ } finally {
124+ Pop-Location
125+ }
126+ }
127+
128+ # This test case for coverage of "If we found more than one module info"
129+ It " Ignores extra manifest files" {
130+ $BuildParameters = @ {
131+ OutputDirectory = " TestDrive:\Result1"
132+ VersionedOutputDirectory = $true
133+ }
134+ Push-Location TestDrive:\Source1
135+ New-Item SubModule - ItemType Directory
136+ Copy-Item Source1.psd1 .\SubModule\SubModule.psd1
137+
138+ try {
139+ $Build.Output = Build-Module @BuildParameters - Passthru
140+ } finally {
141+ Pop-Location
142+ }
143+ }
144+
114145 It " Creates the same module as with a build.psd1" {
115146 $Build.Metadata = Import-Metadata $Build.Output.Path
116147 Get-Content $Build.Output.Path | Should - Be $ManifestContent
@@ -126,7 +157,6 @@ Describe "Supports building without a build.psd1" -Tag Integration {
126157 }
127158}
128159
129-
130160Describe " Defaults to VersionedOutputDirectory" - Tag Integration {
131161 Copy-Item $PSScriptRoot \Source1 TestDrive:\Source1 - Recurse
132162 # This is the old build, with a build.psd1
@@ -176,8 +206,6 @@ Describe "Defaults to VersionedOutputDirectory" -Tag Integration {
176206 }
177207}
178208
179-
180-
181209Describe " Supports building discovering the module without a build.psd1" - Tag Integration {
182210 Copy-Item $PSScriptRoot \Source1 TestDrive:\source - Recurse
183211
0 commit comments