Loading Pester from path

I am attempting to load Pester from a path within my build system. The idea is that unit tests will be run on developer machines without requiring Pester to be installed on the dev machine, and instead i have a nuget in the repo with the contents of the exact version of pester i wish to use.

I am running into an interesting problem however loading pester from a path. When i do so, pester no longer respects Tags. I have been able to isolate it to the following simple repro, any help understanding how this is happening would be great. The repro assumes you have installed the 4.3.1 module of pester.


  1. Browse to C:\Program Files\WindowsPowerShell\Modules\Pester\4.3.1 and make a copy of pester into some other path (in my case “C:\Program Files\WindowsPowerShell\Modules\Pester\4.3.1.Copy” )
  2. Create a simple test which loads pester from a path rather than by name.
Import-Module "C:\Program Files\WindowsPowerShell\Modules\Pester\4.3.1.Copy\Pester.psd1"

Describe "pester tests." -Tag DevEnvironment `
    Context "Sanity test." `
        It "1 should be 1" `
            1 | should be 1
  1. Run Invoke-Pester against this file excluding the tag so the test should not be run. Result: When pester is loaded as a path the tag is ignored and the test is run anyway, if you load pester by name in the test “Ipmo Pester” then it works. The code is identical since it was a copy of the original.
# runs test anyway when it should not.
invoke-pester -tag Unit -ExcludeTag DevEnvironment -Script .\Test\SimpleRepro.Tests.ps1

Have you logged this as an issue in the Pester repo?

I have now
I wasn’t sure if i was just doing something wrong but from your response I assume this is a pester bug.