Posts

Showing posts with the label visual studio

Unit testing of typescript in visual studio (mocha + chai)

Image
  You will need following things to do unit test on typescript: Mocha : Its a testing framework, which will help us identify unit tests in Test explorer of VS Chai : Chai is the assertion library which works well with 'mocha' NodeJs tools for Visual Studio : This tool is needed to create NodeJs project in Visual studio. * I am using Visual Studio 2015 and assuming you have NodeJs environment setup on your machine To begin, open Visual Studio and add a ' Blank Node.js Web Application ' project. Then add ' TypeScript Mocha Unit Test file ' file into the project. (say UnitTest1.ts) Get ' mocha ' definitely typed file from the following location: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/mocha/mocha.d.ts and include it in your project at:   Project  |  |_Scripts  |  |__typings  |  |___mocha (folder)  |  |____ mocha.d.ts   Similarly, add ' chai ' definitely typed file from this link https://github.com/DefinitelyTyped...