Fabito
Fabito

Reputation: 1224

Pester 5.0 including ps1 file

In version 4 I was using pester and in the begging of the test script I have this:

. "$PSScriptRoot\..\Utilities.ps1"

Reading the Pester docs it is now saying to use everything before "Describe" into "BeforeAll" so I have done this:

BeforeAll {
    . "$PSScriptRoot\..\Utilities.ps1"
}

My problem is that the functions declared in the Utilities.ps1 are not visible for the tests, so I assume I should call that in another way. How should be the correct way to import another ps1 from a pester ps1 test script?

Upvotes: 0

Views: 89

Answers (1)

Fabito
Fabito

Reputation: 1224

The problem I had happened because I have code added in the "Describe" block. Moving the code to the "It" block worked for me.

Upvotes: 0

Related Questions