Skip to content

Invoke-Pester for tests, where all of numerus tags are present #608

Description

@vors

Invoke-Pester -Tag @('A', 'B') runs any tests tagged with "A" or "B".

Describe 'foo1' -Tag 'A' {
    It 'should be ok' {
        1 | should be 1
    }
}

Describe 'foo2' -Tag 'B' {
    It 'should be ok' {
        1 | should be 1
    }
}

Describe 'foo3' -Tag @('A', 'B') {
    It 'should fail' {
        1 | should be 1
    }
}

For example, here all 3 tests would be executed.

We have a situation, where it's desirable to run tests when all tags are present.
So in this case, only "foo3" would be run.

Changing the meaning of -Tag in Invoke-Pester is obviously not an option.
I'd like to propose to add a new parameter, maybe -TagAll that enable this scenario.

Invoke-Pester -TagAll @('A', 'B')

At the same time, we may rename -Tag into -TagAny and add alias -Tag to this parameter.
Also, maybe aliasing -ExcludeTag with -TagExclude will make exportability of all these 3 related parameters better.

For the context, I'm working on PowerShell/PowerShell#2280 where I'm adding a new tag "RequireAdminOnWindows" and this tag is orthogonal to our current used tags.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions