When using the codelens "Run Tests" or "Debug Tests", the integrated terminal working directly immediately changes to the folder where the test is located before running PesterStub.ps1. It should stay in the context that it was in and just run the pester stub.
It is very annoying to have to change back to the directory I was in every time I click "Run Test" or "Debug Test"
Demo (Note the path change before InvokePesterStub even starts):
I'm assuming the CWD on the debug adapter request is what is changing the directory, though I am not sure. Since we are sending full paths in the InvokePesterStub request, the CWD should either not be set (if that will signal to PSES to use the existing directory, not sure?), or set to the current directory of the integrated terminal.
Adjusting this code will not affect the Run Code (F8) and other sections, which I assume it was copied from.
Issue Description
When using the codelens "Run Tests" or "Debug Tests", the integrated terminal working directly immediately changes to the folder where the test is located before running PesterStub.ps1. It should stay in the context that it was in and just run the pester stub.
It is very annoying to have to change back to the directory I was in every time I click "Run Test" or "Debug Test"
Demo (Note the path change before InvokePesterStub even starts):
Relevant Log Line
Relevant (?) Code:
https://github.com/PowerShell/vscode-powershell/blob/ed7de2fdb126d41a5cd902f87fc167daa9017bcb/src/features/PesterTests.ts#L93-L97
Recommendation
I'm assuming the CWD on the debug adapter request is what is changing the directory, though I am not sure. Since we are sending full paths in the InvokePesterStub request, the CWD should either not be set (if that will signal to PSES to use the existing directory, not sure?), or set to the current directory of the integrated terminal.
Adjusting this code will not affect the Run Code (F8) and other sections, which I assume it was copied from.
Willing to PR if flagged as up-for-graps.
Attached Logs
EditorServices.zip
Follow the instructions in the README about capturing and sending logs.
Environment Information
Visual Studio Code
PowerShell Information
Visual Studio Code Extensions
Visual Studio Code Extensions(Click to Expand)
|Extension|Author|Version| |---|---|---| |azure-account|ms-vscode|0.9.7| |better-align|wwm|1.1.6| |bracket-pair-colorizer-2|CoenraadS|0.2.0| |change-case|hjdarnel|1.0.2| |emojisense|bierner|0.8.0| |errorlens|usernamehw|3.2.5| |even-better-toml|tamasfe|0.11.1| |filter-lines|earshinov|0.2.0| |gistfs|vsls-contrib|0.2.6| |git-graph|mhutchie|1.29.0| |gitlens|eamodio|11.3.0| |gitmoji-vscode|Vtrois|1.0.5| |indent-rainbow|oderwat|7.5.0| |markdown-checkbox|bierner|0.1.3| |powershell-preview|ms-vscode|2021.2.1| |quicktype|quicktype|12.0.46| |remote-containers|ms-vscode-remote|0.165.1| |remote-ssh-nightly|ms-vscode-remote|2021.3.36900| |TabOut|albert|0.2.0| |todo-tree|Gruntfuggly|0.0.208| |vscode-azureresourcegroups|ms-azuretools|0.3.0| |vscode-bicep|ms-azuretools|0.3.126| |vscode-docker|ms-azuretools|1.11.0| |vscode-dotnet-runtime|ms-dotnettools|1.0.0| |vscode-drawio|hediet|1.4.0| |vscode-github-actions|cschleiden|0.17.0| |vscode-icons|vscode-icons-team|11.2.0| |vscode-opennewinstance|chrisdias|0.0.7| |vscode-peacock|johnpapa|3.9.1| |vscode-pull-request-github|GitHub|0.24.0| |vscode-sort-json|richie5um2|1.20.0| |vscode-yaml|redhat|0.17.0| |vsliveshare|ms-vsliveshare|1.0.4018| |vsliveshare-audio|ms-vsliveshare|0.1.91|