Skip to content

[v6] Inconsistent story for relative paths with BeforeContainer #2838

Description

@fflaten

Checklist

What is the issue?

With Pester.BeforeContianer.ps1 you get:

  • $pwd = Working dir when calling Invoke-Pester. Unstable 👎
  • $PSScriptRoot = Folder for Pester.BeforeContainer. Stable 👍

With Run.BeforeContainer you only get the unstable $pwd as there's no file path to calculate $PSScriptRoot from.

Expected Behavior

Provide a consistent path reference/anchor or recommendation

Steps To Reproduce

$c = New-PesterConfiguration
$c.Run.ScriptBlock = { Describe 'd' { It 'i' {} } }
$c.Run.BeforeContainer = { Write-Host "BeforeContainer script. PSScriptRoot: '$PSScriptRoot' . Pwd: '$pwd'" }
invoke-pester -Configuration $c

Describe your environment

No response

Possible Solution?

Maybe expose RepoRoot as a variable which would stable for all containers?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions