-
Notifications
You must be signed in to change notification settings - Fork 236
Setting to Disable Pester Code Lens #1585
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
Setting to Disable Pester Code Lens #1585
Conversation
@andschwa not sure why this is failing the test, something in the way you mock the settings maybe? |
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.
Is there a way to add a test checking that the provider is (and isn't) enabled via the flag? We might not actually have tests around settings yet, but I'm trying to be intentional about covering all new changes in tests.
src/PowerShellEditorServices/Services/Workspace/LanguageServerSettings.cs
Outdated
Show resolved
Hide resolved
It looks like the actual test itself wasn't fixed. At a quick glance, there's an assertion failing. The input was changed, but not the tests on the output. |
@andschwa That's the thing though, by default it shouldn't be changing the behavior, I didn't write a new test yet, so I'm not sure why it thinks it's not registering the codelens. |
Oh I see, we do have an existing test that asserts the code lens is there (yay!): Lines 747 to 825 in f9bde73
And it looks like the way its written is making for a really bad failure message, but in short from here: Line 759 in f9bde73
I think the collection is empty, which means that this failed: Lines 747 to 757 in f9bde73
|
Thanks for eyeballing it, I'll investigate but again it shouldn't have changed the default behavior so either I goofed or something wrong in the test. |
src/PowerShellEditorServices/Services/Workspace/LanguageServerSettings.cs
Outdated
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/Workspace/LanguageServerSettings.cs
Outdated
Show resolved
Hide resolved
Looking at the rest of the settings file, the Pester class is weird: PowerShellEditorServices/src/PowerShellEditorServices/Services/Workspace/LanguageServerSettings.cs Lines 385 to 389 in f9bde73
This should be: internal class PesterSettings
{ That is, none of the others are public just internal, and this empty constructor is useless. Probably not breaking anything but want to change it while we're in this code? |
Two other things to note is that in the tests, the test you're having to touch is unnecessarily (I think?) parsing JSON in a string into a Lines 251 to 266 in f9bde73
The other thing in here is that the test I just linked is explicitly sending a |
I agree I thought this was super bizarre but with lack of comments as to why it was this way I assumed there was a good reason. |
I checked the Git blame and saw no good reason. Looked like the code was added in a community PR and so was probably just checked as thoroughly as we're doing now. |
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.
Looks like it's working now. Can we add a simple test that asserts thing work as expected with Pester.CodeLens = false
? Also would be happy to have included the change to the Pester
settings class that has a dummy constructor and is for some reason public
.
@andschwa I'll try to work on this tonight or tomorrow, no guarantees though :) |
@andschwa banged on this for a while, everything looks fine after making some additional adjustments, but the Pester Code lens test fails for me even on master with the same error, can you confirm it fails on master for you too? |
src/PowerShellEditorServices/Services/Workspace/LanguageServerSettings.cs
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/Workspace/LanguageServerSettings.cs
Show resolved
Hide resolved
It certainly shouldn't be! Here's the most recent master CI run and it's passing: https://dev.azure.com/powershell/PowerShellEditorServices/_build/results?buildId=87315&view=ms.vss-test-web.build-test-results-tab&runId=1676954&resultId=100001&paneView=debug Sounds like an environment issue? |
@andschwa OK now that I've got both-sides debugging working, it looks like the config change via DidChangeConfiguration is not taking effect and that's why the legacyCodeLens test is failing |
@andschwa should pass but it's in "awaiting approval" status for the MacOS build. |
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.
Hey, this looks fantastic, I'm excited to get this into a preview. @rjmholt Do you have a moment to review?
src/PowerShellEditorServices/Services/Symbols/SymbolsService.cs
Outdated
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/Workspace/LanguageServerSettings.cs
Outdated
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/Workspace/LanguageServerSettings.cs
Outdated
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/Workspace/LanguageServerSettings.cs
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/Workspace/LanguageServerSettings.cs
Show resolved
Hide resolved
|
||
public async Task InitializeAsync() | ||
{ | ||
var factory = new LoggerFactory(); | ||
_psesProcess = new PsesStdioProcess(factory, IsDebugAdapterTests); | ||
await _psesProcess.Start().ConfigureAwait(false); | ||
|
||
Console.WriteLine("PowerShell Editor Services Server started with PID {0}", ProcessId); |
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.
So I'm late back to this, but I thought it looked fishy when I reviewed it...
I think we want to use ITestOutputHelper
for this
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.
The intent is to have a indicator for when I breakpoint right past this which process to attach to for dual-debugging, would the ITestOutputHelper still output that to the vscode debug console at that point?
Allows the Pester Codelens to be disabled so as not to confuse users who want to use an alternate Pester Test Runner
Correlated vscode-powershell PR: PowerShell/vscode-powershell#3613