


If you use a transpiler in your project, there are 2 ways to make the tests work in Mocha Test Explorer. Using transpilers (Typescript, Babel, etc.) Run / Debug your tests using the / icons in the Test Explorer or the CodeLenses in your test file.Open the Test view by clicking on the flask icon in the Activity Bar.
#MOCHA KEYBOARD SHORTCUTS HOW TO#
See this article on multi-root workspaces for further details on how to add folders. a single repository with multiple projects in separate sub-folders), you may need to add your project sub-folders to VS Code separately. If you are using a "monorepo" architecture (ie. Ensure that your project's root folder is a VS Code root folder.mocharc.* file or a mocha property in your package.json or a mocha.opts file) Put your Mocha command line options (if you have any) in a mocha configuration file.Install the extension and restart VS Code.Lets you choose test suites or individual tests in the explorer that should be run automatically after each file change.Shows a failed test's log when the test is selected in the explorer.Adds line decorations to the source line where a test failed.Adds Gutter decorations to your test files showing the tests' state.Adds CodeLenses to your test files for starting and debugging tests.Shows a Test Explorer in the Test view in VS Code's sidebar with all detected tests and suites and their state.Mocha Test Explorer for Visual Studio Code
