-
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
Possibly misleading comment suggesting importing the extension #194
Comments
I'm not sure the tests share the same VM context with the actual extension either. That means global variables in the extension's code are not accessible to the tests which make it quite a bit harder to test. As the VS Code API is quite lacking in terms of automating stuff for testing. |
They do, that is the intention of the sample I think. I can update it. |
Weird cause I have some global variable that I'm setting in |
OK. I think I see the problem. I'm using the webpack template and it seems to build the extension into |
Yea, that's the main challenge with #186 In one of my extensions built with esbuild, I was dealing with the same situation. Commands executed in the same extension host will return the original object (i.e. not json serialized versions) so I have a test-only command that gets the global I need in my tests. https://github.com/connor4312/nodejs-testing/blob/94d013a46a3abdf066b9ff83a65557ef2f51c1cf/src/test/util.ts#L11-L14 |
It looks to be enough to just override the extension entry point to |
both example test files (sample/test/suite1/extension.test.ts, sample/test/suite2/extension.test.ts) have a comment
I interpret this to mean that the activate method of the extension needs to be manually invoked. I believe this is the most natural interpretation. But that contradicts how the Extension Host starts up with the extension already.
I think what the comment is trying to say is that I can import my extension to test the supporting functions, classes, etc, I implemented and exported from the extension. Is this correct? if so, would it be reasonable to update the comment:
// as well as import your custom feature APIs from your extension for testing it
(Btw, I see the same thing in https://github.com/microsoft/vscode-extension-samples/blob/main/helloworld-test-sample/src/test/suite/extension.test.ts)
The text was updated successfully, but these errors were encountered: