Skip to content

Replace Pester tests with xunit tests#1008

Merged
TylerLeonhardt merged 13 commits intoPowerShell:omnisharp-lspfrom
TylerLeonhardt:replace-pester-with-xunit
Aug 19, 2019
Merged

Replace Pester tests with xunit tests#1008
TylerLeonhardt merged 13 commits intoPowerShell:omnisharp-lspfrom
TylerLeonhardt:replace-pester-with-xunit

Conversation

@TylerLeonhardt
Copy link
Member

@TylerLeonhardt TylerLeonhardt commented Aug 16, 2019

This replaces the Pester E2E tests with xunit E2E tests and uses all Omnisharp types (no reliance on PSES.Protocol!)

The biggest problem I had with the Pester tests was that it was so hard to debug them... and the programming model relied too much on timing things perfectly.

I've moved over to xUnit tests as the asynchronous nature of communicating with PSES proved to be really tough with PowerShell.

I think this new model is a little more stable and uses Omnisharp's client so the types are consistant with no reliance on our protocol project.

The tests do exactly what the Pester tests do, just using xunit instead.

This switches to starting PSES via Stdio testing that code path... It might be worthwhile to have a NamedPipe smoke test (that just connects and disconnects)... but that's out of scope for now.

Also, that might have to use Pester because I was experiencing some hanging on Windows getting the NamedPipes working with xUnit.

@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@TylerLeonhardt
Copy link
Member Author

Now the tests don't use a REPL which is probably ideal for our testing environment

@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@PowerShell PowerShell deleted a comment Aug 16, 2019
@TylerLeonhardt
Copy link
Member Author

oops - I tried adding named pipe tests and no dice. Moving to stdio

PowerShellVersionDetails details
= await LanguageClient.SendRequest<PowerShellVersionDetails>("powerShell/getVersion", new GetVersionParams());

if(Environment.GetEnvironmentVariable("PWSH_EXE_NAME") == "powershell")
Copy link
Contributor

Choose a reason for hiding this comment

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

Worth making this a static?

Copy link
Member Author

Choose a reason for hiding this comment

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

done

});
}

[Fact(Skip = "Bug in Newtonsoft that csharp-language-server-protocol will workaround")]
Copy link
Contributor

Choose a reason for hiding this comment

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

Possible to explain what the issue is and/or link to the issue here in a comment?

Copy link
Member Author

Choose a reason for hiding this comment

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

They've fixed the issue :) and the tests are passing now!

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.

2 participants