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?
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With