@@ -15,11 +15,11 @@ Begin
1515 {
1616 [CmdletBinding ()] Param ()
1717 $Script :NL = [Environment ]::NewLine
18- $src = Join-Path ( $PSScriptRoot | Split-Path ) src
19- $Script :ModuleName = Join-Path $src * .psd1 | Resolve-Path | Split-Path - LeafBase
18+ $reporoot = $PSScriptRoot | Split-Path # faster than git rev-parse --show-toplevel ?
19+ $Script :ModuleName = Join-Path $reporoot src * .psd1 | Resolve-Path | Split-Path - LeafBase
2020 if (Get-Module $Script :ModuleName ) {Remove-Module $Script :ModuleName }
21- & (Join-Path $PSScriptRoot Build-Module .ps1 )
22- Join-Path $src .publish * .psd1 | Resolve-Path | Import-Module
21+ & (Join-Path $PSScriptRoot Build-ThisModule .ps1 )
22+ Join-Path $reporoot .publish * .psd1 | Resolve-Path | Import-Module
2323 Write-Debug " Imported commands: $ ( Get-Command - Module $Script :ModuleName ) "
2424 }
2525
@@ -73,13 +73,10 @@ $('"@')
7373Tests $Synopsis
7474#>
7575
76- if((Test-Path .changes -Type Leaf) -and
77- !@(Get-Content .changes |Get-Item |Select-Object -ExpandProperty Name |
78- Where-Object {`$ _.StartsWith("`$ ((`$ MyInvocation.MyCommand.Name -split '\.',2)[0]).")})) {return}
76+ if(!(&"`$ PSScriptRoot/../scripts/Test-RelevantTest.ps1")) {return}
7977BeforeAll {
8078 Set-StrictMode -Version Latest
81- `$ module = Join-Path (`$ PSScriptRoot |Split-Path) src .publish *.psd1 |Get-Item
82- Import-Module `$ module -Force
79+ &"`$ PSScriptRoot/../scripts/Import-ThisModule.ps1"
8380}
8481Describe '$Name ' -Tag $Name ,$ ( $Name -replace ' -' , ' ,' ) {
8582 Context '$ ( $Synopsis -replace " '" , " ''" ) ' -Tag Example {
@@ -88,7 +85,7 @@ $($Examples.example |Format-ExampleTest)
8885$ ( $CmdInfo.ParameterSets | Where-Object Name -ne __AllParameterSets | Format-ParameterSetContext )
8986}
9087AfterAll {
91- Remove-Module `$ module.BaseName -Force
88+ &" $PSScriptRoot /../scripts/Remove-ThisModule.ps1"
9289}
9390"@
9491 }
0 commit comments