Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should expand relative paths in Pester path properties #121

Open
johlju opened this issue Apr 1, 2022 · 2 comments
Open

Should expand relative paths in Pester path properties #121

johlju opened this issue Apr 1, 2022 · 2 comments
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.

Comments

@johlju
Copy link
Member

johlju commented Apr 1, 2022

If the property OutputPath is used in the build.yaml with a relative path (to the project path), it will not be made an absolute path by the task, meaning in this case, the test result file end up in the wrong place.

DscTest:
  Pester:
    Configuration:
      TestResult:
        OutputPath: ./output/testResults/NUnitXml_HQRM_Tests.xml

The variable $DscTestOutputFolder is set to the absolute path of the projects './output/testResults' folder here:

if (-not (Split-Path -IsAbsolute $DscTestOutputFolder))
{
$DscTestOutputFolder = Join-Path -Path $OutputDirectory -ChildPath $DscTestOutputFolder
}

So here for each property that is a path, e.g. OutputPath, should be checked whether it is an absolute path. If not, join the relative path with the path in the variable above.

foreach ($propertyName in $propertyNames)

@johlju johlju added bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community. labels Apr 1, 2022
@gaelcolas
Copy link
Member

To expand the path as needed, we could use Get-SamplerAbsolutePath. Either copy the code or add dependency.

@johlju
Copy link
Member Author

johlju commented Jun 6, 2022

Get-SamplerAbsolutePath is a public function in Sampler so we can just use that. Maybe we should add Sampler to RequiredModules too:

RequiredModules = @()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

No branches or pull requests

2 participants