Skip to content

Commit 84709a8

Browse files
committed
Make the "same module" tests more significant
1 parent 3266d6a commit 84709a8

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

Tests/Integration/Source1.Tests.ps1

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,13 @@ Describe "Regression test for #84: Multiple Aliases per command will Export" -Ta
8989

9090
Describe "Supports building without a build.psd1" -Tag Integration {
9191
Copy-Item $PSScriptRoot\Source1 TestDrive:\Source1 -Recurse
92+
# This is the old build, with a build.psd1
93+
$Output = Build-Module TestDrive:\Source1\build.psd1 -Passthru
94+
$ManifestContent = Get-Content $Output.Path
95+
$ModuleContent = Get-Content ([IO.Path]::ChangeExtension($Output.Path, ".psm1"))
96+
Remove-Item (Split-Path $Output.Path) -Recurse
97+
98+
# Then remove the build.psd1 and rebuild it
9299
Remove-Item TestDrive:\Source1\build.psd1
93100

94101
$Build = @{ }
@@ -105,6 +112,8 @@ Describe "Supports building without a build.psd1" -Tag Integration {
105112

106113
It "Creates the same module as with a build.psd1" {
107114
$Build.Metadata = Import-Metadata $Build.Output.Path
115+
Get-Content $Build.Output.Path | Should -Be $ManifestContent
116+
Get-Content ([IO.Path]::ChangeExtension($Build.Output.Path, ".psm1")) | Should -Be $ModuleContent
108117
}
109118

110119
It "Should update AliasesToExport in the manifest" {
@@ -115,26 +124,30 @@ Describe "Supports building without a build.psd1" -Tag Integration {
115124
$Build.Metadata.FunctionsToExport | Should -Be @("Get-Source", "Set-Source")
116125
}
117126
}
118-
Describe "Supports building without a build.psd1 and not specifying a module manifest" -Tag Integration {
127+
Describe "Supports building discovering the module without a build.psd1" -Tag Integration {
119128
Copy-Item $PSScriptRoot\Source1 TestDrive:\source -Recurse
129+
130+
# This is the old build, with a build.psd1
131+
$Output = Build-Module TestDrive:\source\build.psd1 -Passthru
132+
$ManifestContent = Get-Content $Output.Path
133+
$ModuleContent = Get-Content ([IO.Path]::ChangeExtension($Output.Path, ".psm1"))
134+
Remove-Item (Split-Path $Output.Path) -Recurse
135+
136+
# Then remove the build.psd1 and rebuild it
120137
Remove-Item TestDrive:\source\build.psd1
121138

122139
Push-Location -StackName 'IntegrationTest' -Path TestDrive:\
123140

124141
$Build = @{ }
125142

126143
It "No longer fails if there's no build.psd1" {
127-
$BuildParameters = @{
128-
SourcePath = "TestDrive:\source"
129-
OutputDirectory = "TestDrive:\Result1"
130-
VersionedOutputDirectory = $true
131-
}
132-
133-
$Build.Output = Build-Module @BuildParameters -Passthru
144+
$Build.Output = Build-Module -Passthru
134145
}
135146

136147
It "Creates the same module as with a build.psd1" {
137148
$Build.Metadata = Import-Metadata $Build.Output.Path
149+
Get-Content $Build.Output.Path | Should -Be $ManifestContent
150+
Get-Content ([IO.Path]::ChangeExtension($Build.Output.Path, ".psm1")) | Should -Be $ModuleContent
138151
}
139152

140153
It "Should update AliasesToExport in the manifest" {

0 commit comments

Comments
 (0)