![]() ![]() The test runner is expected to use console.log // to report the results back to the caller. // You can provide your own test runner if you want to override it by exporting // a function run(testRoot: string, clb: (error:Error) => void) that the extension // host can call to run the tests. By default the test runner in use is Mocha based. // PLEASE DO NOT MODIFY / DELETE UNLESS YOU KNOW WHAT YOU ARE DOING // // This file is providing the test runner to use when running extension tests. If you haven’t used it before, all you need to do is run the following commands in a terminal: The only difference between the TS and JS setups is that the tests will be in test/ in JS setups and src/test/ in TS setups. For this article, I will assume you are writing the extension with Typescript. ![]() ![]() ![]() It scaffolds up all of the various default dependencies and template folders for a new VS Code extension. The easiest way not just to setup testing but setting up a standard environment for VS Code Extension development is through the official Yeoman Generator. With the question of “what should I test in my extension?”, I would say it depends, but some good guidelines are if you have a chunk of code that does just one thing and isn’t trivial, write some unit tests for it, and have a few e2e or integration tests for the key features of your extension. I will cover my experience and some tricks to know when testing your extensions. With VS Code, the environment supports capabilities from simple unit tests to full-blown e2e testing. Testing your VS Code extensions Septem7 minutes to readĪs I’ve been developing extensions for VS Code, writing tests has become useful to make sure the extension is doing what it is supposed to. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |