2
2
using namespace Microsoft.PackageManagement.Provider.Utility
3
3
param (
4
4
[switch ]$SkipCodeCoverage ,
5
- [switch ]$HideSuccess
5
+ [switch ]$HideSuccess ,
6
6
[switch ]$IncludeVSCodeMarker
7
7
)
8
8
Push-Location $PSScriptRoot
9
- $ModuleUnderTest = Split-Path $PSScriptRoot - Leaf
9
+ $ModuleName = " ModuleBuilder "
10
10
11
11
# Disable default parameters during testing, just in case
12
12
$PSDefaultParameterValues += @ {}
@@ -15,10 +15,10 @@ $PSDefaultParameterValues["Disabled"] = $true
15
15
# Find a built module as a version-numbered folder:
16
16
$FullModulePath = Get-ChildItem [0 - 9 ]* - Directory | Sort-Object { $_.Name -as [SemanticVersion []] } |
17
17
Select-Object - Last 1 - Ov Version |
18
- Get-ChildItem - Filter " $ ( $ModuleUnderTest ) .psd1"
18
+ Get-ChildItem - Filter " $ ( $ModuleName ) .psd1"
19
19
20
- if (! $FullModulePath ) {
21
- throw " Can't find $ ( $ModuleUnderTest ) .psd1 in $ ( $Version.FullName ) "
20
+ if (! $FullModulePath ) {
21
+ throw " Can't find $ ( $ModuleName ) .psd1 in $ ( $Version.FullName ) "
22
22
}
23
23
24
24
$Show = if ($HideSuccess ) {
@@ -27,15 +27,15 @@ $Show = if ($HideSuccess) {
27
27
" All"
28
28
}
29
29
30
- Remove-Module (Split-Path $ModuleUnderTest - Leaf) - ErrorAction Ignore - Force
30
+ Remove-Module (Split-Path $ModuleName - Leaf) - ErrorAction Ignore - Force
31
31
$ModuleUnderTest = Import-Module $FullModulePath - PassThru - Force - DisableNameChecking - Verbose:$false
32
32
Write-Host " Invoke-Pester for Module $ ( $ModuleUnderTest ) version $ ( $ModuleUnderTest.Version ) "
33
33
34
34
if (-not $SkipCodeCoverage ) {
35
35
# Get code coverage for the psm1 file to a coverage.xml that we can mess with later
36
- Invoke-Pester ( Join-Path $PSScriptRoot Tests) - CodeCoverage $ModuleUnderTest.Path - CodeCoverageOutputFile ./ coverage.xml - Show $Show - PesterOption @ { IncludeVSCodeMarker = $IncludeVSCodeMarker }
36
+ Invoke-Pester . / Tests - CodeCoverage $ModuleUnderTest.Path - CodeCoverageOutputFile ./ coverage.xml - Show $Show - PesterOption @ { IncludeVSCodeMarker = $IncludeVSCodeMarker }
37
37
} else {
38
- Invoke-Pester ( Join-Path $PSScriptRoot Tests) - Show $Show - PesterOption @ { IncludeVSCodeMarker = $IncludeVSCodeMarker }
38
+ Invoke-Pester . / Tests - Show $Show - PesterOption @ { IncludeVSCodeMarker = $IncludeVSCodeMarker }
39
39
}
40
40
41
41
Pop-Location
0 commit comments