Skip to content

Fix test for -WorkingDirectory when $PROFILE doesn't exist - #8152

Merged
Aditya Patwardhan (adityapatwardhan) merged 1 commit into
PowerShell:masterfrom
SteveL-MSFT:workingdirectory-test
Oct 31, 2018
Merged

Aditya Patwardhan (adityapatwardhan) merged 1 commit into
PowerShell:masterfrom
SteveL-MSFT:workingdirectory-test

Conversation

@SteveL-MSFT

@SteveL-MSFT Steve Lee (SteveL-MSFT) commented Oct 31, 2018

Copy link
Copy Markdown
Member

PR Summary

Test expected $PROFILE to exist, but doesn't exist on CI systems. Part of the path to $PROFILE doesn't exist so we forcibly create $PROFILE with full path. Add checks if it exists and if not, make sure to remove test $PROFILE.

PR Checklist

fix test when $PROFILE doesn't exist
$currentProfile = Get-Content $PROFILE
}
else {
New-Item -ItemType File -Path $PROFILE -Force

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
New-Item -ItemType File -Path $PROFILE -Force
$null = New-Item -ItemType File -Path $PROFILE -Force

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging as this comment is non-blocking.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
New-Item -ItemType File -Path $PROFILE -Force
New-Item -ItemType File -Path $PROFILE -Force > $null

😉

@adityapatwardhan
Aditya Patwardhan (adityapatwardhan) merged commit 1eec123 into PowerShell:master Oct 31, 2018
@SteveL-MSFT
Steve Lee (SteveL-MSFT) deleted the workingdirectory-test branch March 10, 2020 21:01
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj-contribs/PowerShell that referenced this pull request Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants