22using namespace Microsoft.PackageManagement.Provider.Utility
33param (
44 [switch ]$SkipCodeCoverage ,
5- [switch ]$HideSuccess
5+ [switch ]$HideSuccess ,
66 [switch ]$IncludeVSCodeMarker
77)
88Push-Location $PSScriptRoot
9- $ModuleUnderTest = Split-Path $PSScriptRoot - Leaf
9+ $ModuleName = " ModuleBuilder "
1010
1111# Disable default parameters during testing, just in case
1212$PSDefaultParameterValues += @ {}
@@ -15,10 +15,10 @@ $PSDefaultParameterValues["Disabled"] = $true
1515# Find a built module as a version-numbered folder:
1616$FullModulePath = Get-ChildItem [0 - 9 ]* - Directory | Sort-Object { $_.Name -as [SemanticVersion []] } |
1717 Select-Object - Last 1 - Ov Version |
18- Get-ChildItem - Filter " $ ( $ModuleUnderTest ) .psd1"
18+ Get-ChildItem - Filter " $ ( $ModuleName ) .psd1"
1919
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 ) "
2222 }
2323
2424$Show = if ($HideSuccess ) {
@@ -27,15 +27,15 @@ $Show = if ($HideSuccess) {
2727 " All"
2828}
2929
30- Remove-Module (Split-Path $ModuleUnderTest - Leaf) - ErrorAction Ignore - Force
30+ Remove-Module (Split-Path $ModuleName - Leaf) - ErrorAction Ignore - Force
3131$ModuleUnderTest = Import-Module $FullModulePath - PassThru - Force - DisableNameChecking - Verbose:$false
3232Write-Host " Invoke-Pester for Module $ ( $ModuleUnderTest ) version $ ( $ModuleUnderTest.Version ) "
3333
3434if (-not $SkipCodeCoverage ) {
3535 # 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 }
3737} else {
38- Invoke-Pester ( Join-Path $PSScriptRoot Tests) - Show $Show - PesterOption @ { IncludeVSCodeMarker = $IncludeVSCodeMarker }
38+ Invoke-Pester . / Tests - Show $Show - PesterOption @ { IncludeVSCodeMarker = $IncludeVSCodeMarker }
3939}
4040
4141Pop-Location
0 commit comments