-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
Support running extension tests through cmd line #118
Comments
+1 - I believe atom manage to do this using a similar mechanism to Chromium's browser tests. |
+1 this is on our backlog. however you will not be able to run tests without having a windowing system because in order to provide the VS Code APIs for the tests we still need to open a window. |
This will be supported in the next release with the following syntax: The output goes directly to console and the exit code is set properly. Note: in order for the exit code to function properly you will need vscode@0.10.6 at least as dependency from your extension. |
@jpoon @Tyriar maybe I closed this too early. What you can now do is run tests from the command line but only if code is not already running. This should however be good enough for running extension tests as part of Travis CI. We are actually able to run some of our API tests on Mac and Linux through Travis even though the tests require a real code instance to spawn. |
@Tyriar unfortunately not. |
@bpasero What release should have this? 0.10.2? |
@jpoon no, mid december! |
Thanks @bpasero. It looks like tests that rely on the active window fail ( Unfortunately, I'm running on Windows and can't debug this further (any plans for adding Windows support?). On Travis, I do see these warnings:
|
Yes we have tests that rely on that too, if you have the tests somewhere online I can try to run them on Mac/Linux from the command line to see whats going on. |
Are your tests that rely on Guess I'm doing something wrong on my end then. Our tests are here: https://github.com/VSCodeVim/Vim/tree/master/test |
@jpoon check out our tests that we manage to get run: https://github.com/Microsoft/vscode/tree/master/extensions/vscode-api-tests |
And are those tests working when you run them via Code? |
Yep. Tests work when running with Code. Here's one of the failed builds: https://travis-ci.org/VSCodeVim/Vim/builds/99793291
where line 22 of motion.ts is:
|
@jpoon in that test I am not seeing code that would open a text editor, so I wonder how the tests run green when running inside Code, maybe you can explain: https://github.com/VSCodeVim/Vim/blob/master/test/motion.test.ts Does it make any difference if you run the tests locally using the same command you run in travis? |
💡 -- that was it! When running in Code, it seems as though the tests automatically open a text editor, hence didn't need to do it explicitly. After refactoring my tests to open an editor.... https://travis-ci.org/VSCodeVim/Vim/builds/99801078 🎉 Thanks @bpasero . |
@jpoon very cool! |
Add support for running plugin/extension tests through the command line. This is particularly useful for things like CI. I was able to setup gulp+mocha, but any tests that reference
vscode
doesn't work.Paraphrasing @bpasero, "this is a consequence of having an extension host that runs your plugin. This host is really the entire VS Code app and cannot be emulated from the command line easily. "
The text was updated successfully, but these errors were encountered: