-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Add vscode tasks to run tests in current file/project #43434
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the recommendation for tasks like these if we want them to run on mac and linux? Is there a way to call the bash versions of these in those cases? |
vscode does have an answer for this: https://code.visualstudio.com/Docs/editor/tasks#_operating-system-specific-properties. however that seems to imply writing the script again in bash. is that the right thing to do? any chance of using cross platform powershell for this? |
scripts/vscode-run-tests.ps1
Outdated
Set-Location $fileInfo.Directory | ||
|
||
try | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Powershell coding style puts braces on same line
scripts/vscode-run-tests.ps1
Outdated
if ($files) | ||
{ | ||
Pop-Location | ||
$dotnetPath = Resolve-Path "$PSScriptRoot/../.dotnet/dotnet.exe" -Relative |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did u consider importing the build-utils script which has our definitive way of grabbing the dotnet binary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do this so I can use this on Linux.
pwsh is available for linux, and is how I generate compiler code. Can you add using that for Linux and I'll give it a try? |
Thanks for the feedback. I'll pull it down on my Mac and make sure it works nicely on there. This test failure is a new one to me: |
I opted for a solution that uses a local 'dotnet tool' install of PowerShell. It requires running |
Personally I already have pwsh installed, but that's really w/e, I only have it installed for this repo. |
c84167a
to
a0c8994
Compare
solved 2 lingering issues:
I think this is in a pretty good place now. The test running scripts in particular I am finding invaluable when working in vscode. I also extracted out the bit that finds the project file and modified the "build directory" task to just build the "current project" based on what file you have open. /cc @jaredpar |
dotnet-tools.json
Outdated
"commands": [ | ||
"dotnet-format" | ||
] | ||
}, | ||
"powershell": { | ||
"version": "6.2.4", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7.0 has been out for a month, we should probably use that.
This PR adds a couple of vscode tasks to improve developer productivity.
(running all tests is still best handled by Test.cmd)
The task will also write the test results to an html file in TestResults. This should be useful for keeping track of which tests were failing or sifting through test runs with many failures.
I didn't make the task try to search for .vbproj files because VB doesn't work that well in vscode. You are better off going to full VS if you need to work in VB.
Here's a demo: