

The second even more convenient option is to go to File -> Preferences -> Settings (CTRL+,) and to enable npm.enableScriptExplorer. Fortunately, the IntelliTest feature shipping in the Visual Studio 2015 Enterprise Edition addresses both concerns: it helps you achieve high code coverage at a fraction of the cost. It can even be considered too expensive to do at all. You can simply run your script with npm run my-script. Writing a suit of unit tests that exhaustively exercise and validate the logic of the code under test is not easy. Thereby, the terminal is conveniently started in your project’s working directory. The first is to open a terminal in VS Code with Terminal -> New Terminal (CTRL+Shift+ö).

You have several ways to start one of the script commands defined in your package.json. However, during the daily development routine, I had to run these script by hand so often, I searched for a faster and more convenient solution. In this example, I used wildcards to run all my spec.files in a certain directory. The tests will then show up in the Unit Tests pad. After that one need to restart Visual Studio for Mac and do a full rebuild.
#Visual studio for mac run unit tests install#
"test-all": "mocha -opts mocha.opts \"./tests/*.spec.ts\"" After searching a while I figured that one need to install the extension called xUnit.NET 2 testing framework support from the Extension Gallery. If no command is provided, it lists all available scripts NPM defines a lot of predefined scripts and CLI commands which you can run with npm, for example npm install or npm test.įor user-defined scripts, you have to use npm run, such as npm run test-all. Recently, I wondered if there is a possibility not having to remember the NPM script names in my package.json and to start them faster without having to open a terminal and typing npm run every time.
