Dev: NuGet + Jasmin + Chutzpah = JS unit testing

There is an easy way to do the unit-testing of the JavaSctipt scripts in Visual Studio.

All you need is a NuGet package manager to install the Jasmin Test Framework.

It will create few folders and files in your project: Content, Controllers, Scripts and a View. Feel free to delete JasminController.cs, jasmine-samlpes and Jasmin view, just keep the core Jasmin JavaScript files. We don't really need them as we'll install the Chutzpah.


Install the version of the Chutzpah Visual Studio extension depending on the version of the Visual Studio you have.

It will add a menu items "Run JS Tests" and "Run JS Tests in browser", the first just outputs the results into the console the later to the browser. The important thing is to add the references of the JavaScript files under the tests into your tests files.
/// <reference path="Player.js">
/// <reference path="Song.js">
/// <reference path="SpecHelper.js">

describe("Player", function() {
...
The results of the tests in the browser when everything is good.


P.S. There is also a Jasmine Junit Runner for Java and Eclipse.


Popular posts from this blog

Debug: WER and WinDbg

Dev: PlantUML + VS Code + GitLab

BigData intro at Ciklum's Speakers' Corner