@@ -9,27 +9,37 @@ Describe "Build-Module" {
99 $parameters [" SourcePath" ].ParameterType | Should - Be ([string ])
1010 $parameters [" SourcePath" ].Attributes.Where{$_ -is [Parameter ]}.Mandatory | Should - Be $false
1111 }
12+ It " throws if the SourcePath doesn't exist" {
13+ { Build-Module - SourcePath TestDrive:\NoSuchPath } | Should - Throw " Source must point to a valid module"
14+ }
1215
1316 It " has an optional string parameter for the OutputDirectory" {
1417 $parameters.ContainsKey (" OutputDirectory" ) | Should - Be $true
1518 $parameters [" OutputDirectory" ].ParameterType | Should - Be ([string ])
1619 $parameters [" OutputDirectory" ].Attributes.Where{$_ -is [Parameter ]}.Mandatory | Should - Be $false
1720 }
1821
19- It " has an optional parameter for setting the Version" {
22+ It " has an optional parameter for setting the Version" {
2023 $parameters.ContainsKey (" Version" ) | Should - Be $true
2124 $parameters [" Version" ].ParameterType | Should - Be ([version ])
2225 $parameters [" Version" ].ParameterSets.Keys | Should -Not - Be " __AllParameterSets"
2326 }
2427
25- It " has an optional parameter for setting the Encoding" {
28+ It " has an optional parameter for setting the Encoding" {
2629 $parameters.ContainsKey (" Encoding" ) | Should - Be $true
2730 # Note that in PS Core, we can't use encoding types for parameters
2831 $parameters [" Encoding" ].ParameterType | Should - Be ([string ])
2932 $parameters [" Encoding" ].Attributes.Where{$_ -is [Parameter ]}.Mandatory | Should - Be $false
3033 }
3134
32- It " has an optional string parameter for a Prefix" {
35+ It " Warns if you set the encoding to anything but UTF8" {
36+ $warns = @ ()
37+ # Note: Using WarningAction Stop just to avoid testing anything else here ;)
38+ try { Build-Module - Encoding ASCII - WarningAction Stop - WarningVariable + warns } catch {}
39+ $warns.Message | Should -Match " recommend you build your script modules with UTF8 encoding"
40+ }
41+
42+ It " has an optional string parameter for a Prefix" {
3343 $parameters.ContainsKey (" Prefix" ) | Should - Be $true
3444 $parameters [" Prefix" ].ParameterType | Should - Be ([string ])
3545 $parameters [" Prefix" ].Attributes.Where{$_ -is [Parameter ]}.Mandatory | Should - Be $false
0 commit comments