-
Notifications
You must be signed in to change notification settings - Fork 61
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
How to test extensions providing code actions? #98
Comments
Agree that an official documentation would be awesome. If it can help: |
Thanks @apupier! That helps a lot. |
@miffels I've stumbled across this issue as I was experiencing the same. I checked various popular extensions and I was shocked to see the lack of tests, and the abundance of the initial yeoman ones: test('Sample test', () => {
assert.strictEqual(-1, [1, 2, 3].indexOf(5));
assert.strictEqual(-1, [1, 2, 3].indexOf(0));
}); 🤯 I've been writing a simple vscode extension and decided for simplicity and speed to just extract login into functions and test those function with jest, which does seem to be working pretty well. Anyways that obviously can take you only so far... In my extension I've added code actions and it would be great to be able to have integration tests which could check if those are properly being shown and at their execution if they update the document in the correct way... So, I just wanted to ask you, have you had any luck with the code action tests? |
Merging into microsoft/vscode#94746 |
Hey,
I am building an extension providing code actions and I am unclear on how to use the API to validate that the plugin loads correctly, that code action providers are registered, that errors are properly reported, quick fixes can be correctly applied, decorators are added etc. It appears to me that this is a documentation/tutorial issue as well: I was shocked to see that none of the extensions I am using implements any such tests in their source code (well, I stopped looking after checking like 10). It would appear I am not the only one having trouble figuring this out, otherwise I cannot explain why people limit themselves to checking if their config loads fine. Is there anything you could share to help me get started? I have a gut feeling that this would involve the extension context, but I am not really sure. The samples in this repo provide very limited value since they appear to be limited to "hello-world-y" Array.indexOf tests. It would be very helpful to have a few more showcases using VSCode APIs.
Cheers,
Michael
The text was updated successfully, but these errors were encountered: