Mocha2This is an actively developed version of Mocha and Mocha-Latte VSCode plugins. Runs Mocha tests, all or selected. Then prints the result to an output window. This is a maintained, bugfixed fork of the Mocha extension. Unlike the original, it also works on Mac and Linux. To use "Mocha Latte", uninstall the "Mocha" extension. This extension is inspired by Node.js Tools for Visual Studio. UsageTo run Mocha tests:
You can run tests by:
How it worksBy default, this extensions will discover tests by searching for Because your tests may requires a newer version of Node.js than the one powering Visual Studio Code, thus, this extension will attempt to find your installed Node.js and use it for your tests. It will search for the installed Node.js as indicated by environmental variable When the test is being run, we will add When you ask to run the test under cursor position, the extension will parse the current file and look for matching tests or suites.
If the file contains tests or suites defined using template strings or via dynamic generation, the regular expression Fit yourselfNo one shoe could fit everyone. You may need to turn some switches on to fit your project. Please file us an issue if you think there is a better way to fit you and the others. Configuring Mocha optionsUnder File > Preferences > Workspace Settings, you can configure Mocha options, e.g. run in "tdd" mode, detect/ignore leaks, etc.
Setting a keyboard shortcutTo quickly run tests, you can create a keyboard shortcut under File > Preferences > Keyboard Shortcuts. For example, the following JSON will run all tests with
Following commands are also supported:
ContributionsLove this extension? Star us and rate us! Want to make this extension even more awesome? Send us your wish. Hate how it is working? File an issue to us. |