From a8cfece17846874017fd0e5f6c220d77cd94195a Mon Sep 17 00:00:00 2001 From: Cody Duong Date: Fri, 12 Apr 2024 03:38:31 -0500 Subject: [PATCH] Fixes and prep candidate release --- alias-tips/Public/Find-AliasTips.ps1 | 10 ++++++++++ alias-tips/alias-tips.psd1 | 2 +- tests/unit/Find-Alias.tests.ps1 | 12 +++++------- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/alias-tips/Public/Find-AliasTips.ps1 b/alias-tips/Public/Find-AliasTips.ps1 index 3283ad5..34f34ee 100644 --- a/alias-tips/Public/Find-AliasTips.ps1 +++ b/alias-tips/Public/Find-AliasTips.ps1 @@ -23,5 +23,15 @@ function Find-AliasTips { } }) + $script:AliasTipsProxyFunctionRegex, $script:AliasTipsProxyFunctionRegexNoArgs = $null + $jobs = Get-Job -Name "FindAliasTipsJob" -ErrorAction SilentlyContinue + if ($null -ne $jobs) { + foreach ($job in $jobs) { + Stop-Job -Job $job + Remove-Job -Job $job + } + } + Start-RegexThreadJob + Set-Content -Path $AliasTipsHashFile -Value $Value } diff --git a/alias-tips/alias-tips.psd1 b/alias-tips/alias-tips.psd1 index 062ccc9..b88c68a 100644 --- a/alias-tips/alias-tips.psd1 +++ b/alias-tips/alias-tips.psd1 @@ -96,7 +96,7 @@ PrivateData = @{ ReleaseNotes = 'https://github.com/codyduong/powershell-alias-tips/releases' # Prerelease version - Prerelease = "rc1" + Prerelease = "rc2" } # End of PSData hashtable } # End of PrivateData hashtable diff --git a/tests/unit/Find-Alias.tests.ps1 b/tests/unit/Find-Alias.tests.ps1 index 0a6a172..2bf4c34 100644 --- a/tests/unit/Find-Alias.tests.ps1 +++ b/tests/unit/Find-Alias.tests.ps1 @@ -9,14 +9,13 @@ InModuleScope 'alias-tips' { Set-Alias -Name 'as_s' -Value 'as_s_test' # This might cause a problem if you already aliased Out-Null - function as_f { - Out-Null $args + as_base $args } # ENSURE this remains after as_f, that way declaration order doesn't override that as_f is just a better alias recommendation function as_f_long { - Out-Null $args + as_base $args } Find-AliasTips @@ -33,7 +32,7 @@ InModuleScope 'alias-tips' { } it 'simple asf' { - Find-Alias 'Out-Null foo' | + Find-Alias 'as_base foo' | Should -Be 'as_f foo' } @@ -66,14 +65,13 @@ InModuleScope 'alias-tips' { Remove-Item Env:\PESTER -ErrorAction SilentlyContinue Remove-Item alias:as_s -ErrorAction SilentlyContinue + Remove-Item function:as_base -ErrorAction SilentlyContinue Remove-Item function:as_f -ErrorAction SilentlyContinue Remove-Item function:as_f_long -ErrorAction SilentlyContinue - Find-AliasTips - Get-Job -Name "FindAliasTipsJob" -ErrorAction SilentlyContinue | Stop-Job -PassThru | Remove-Job - # Find-AliasTips + Find-AliasTips } } } \ No newline at end of file