Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in -match in PesterHelpers/Other/Min-ModuleTests.txt #11

Open
MatthewMcD opened this issue Jan 13, 2019 · 0 comments
Open

Error in -match in PesterHelpers/Other/Min-ModuleTests.txt #11

MatthewMcD opened this issue Jan 13, 2019 · 0 comments
Assignees

Comments

@MatthewMcD
Copy link

Sorry about all the open/closes. I finally figured out the issue in my tests. It stems from the -match statement on line 62:

$publicfunctionTests = $Publicfunctionstests.Where{$_.Name -match $PublicFunction.BaseName }

If you have functions named "Get-MyFunction" and "Get-MyFunctionAdvanced" and you have test files "Get-MyFunction.Test.ps1" and "Get-MyFunctionAdvanced.Test.ps1". The match for "Get-MyFunction" will pick up both test files.

I resolved it with the following so it includes the '.' on the match:

$publicfunctionTests = $Publicfunctionstests.Where{$_.Name -match $PublicFunction.BaseName + '\.' }
@kilasuit kilasuit self-assigned this Feb 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants