Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do TDD with Typescript in Visual Studio Code?

I want to setup TDD in Visual Studio Code for typescript. I am working on an angular2 application and i am writing my code in typescript. How can i setup Visual Studio Code so that it runs Karma as well as Typescript compiler in the background and the results are shown in the output window?

like image 425
siddharth Avatar asked Feb 11 '16 13:02

siddharth


People also ask

Is Vscode good for TypeScript?

Visual Studio Code includes TypeScript language support but does not include the TypeScript compiler, tsc . You will need to install the TypeScript compiler either globally or in your workspace to transpile TypeScript source code to JavaScript ( tsc HelloWorld. ts ). You can test your install by checking the version.

How do I add support for TypeScript in Visual Studio code?

The first step toward working with TypeScript is to install the package globally on your computer. Install the typescript package globally by running the following command in your terminal: npm install -g typescript.


1 Answers

TDD - is just a concept of development.

So the answer for your question - you need to create configuration for your building tools which take care of your testing for VSC. Here - VS Code tasks configuration you can find guide, how to integrate such building tools like Grunt or Gulp with VS Code.

But if you don't have building process yet you need first of all create all stuff which will help you in Test Driven Development. So you need watcher which looks at your code and run particular test once code changed. There different ways to do that, hope this small article will move you ahead.

like image 110
Mikki Kobvel Avatar answered Oct 15 '22 02:10

Mikki Kobvel