Integrating Angular 4 Unit Tests with Visual Studio Team Services (VSTS)

Premier Developer consultant Wael Kdouh brings us this post on integrating Angular 4 unit tests into VSTS.

One of the nice features of Angular 4 (and Angular 2 before it) is the introduction of the Angular CLI (command line interface). I like to think of it as a style guide coming straight from the Angular team. But more importantly, it takes care of all the ceremony that accompanies building an Angular application like setting up module bundlers with WebPack, setting up unit testing with Jasmine, setting up end to end testing with protractor, etc.

One thing that Angular CLI doesn’t take care of though is integrating the JavaScript unit tests with your VSTS build. This is a crucial step as continuous integration is the process of automating a build and tests to ensure a stable code branch.

In this post, I will show you how to run JavaScript unit tests on VSTS as well as generate an output that can be parsed by the build.

Continue reading on Wael's blog

Comments (2)

  1. Leslie Dupin says:


    I follow the steps described but I end up with an error. At the Run tests step, it fails to read karma.conf.js and say unexpected token =
    Any idea why?
    Thank you in advance

  2. Angelo Pompeo says:

    Couple things that helped me get this working for anyone struggling.

    – I had to add an environment variable PHANTOMJS_BIN C:\NPM\Modules\PhantomJS.cmd
    – I also had to name it something more unique than test.xml as there were two node_modules that had test.xml files in them.

    Great post! This was the only guide I could find on the process.

Skip to main content