Skip to content

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

@MatthewMcD

Description

@MatthewMcD

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 + '\.' }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions