Unit Testing angularjs with jasmine and chutzpah in visual studio2013 will not work

I want to use Chutzpah to run JavaScript unit tests in Visual Studio 2013. As long as I don't refer to angular.js, the tests will run. Using angular.js, these tests will not run, and the VS output will give me the following message:

Error: Error: Instrumentation error, you cannot redefine the 'window' variable in file:///e:/.../scripts/angular/angular.js:1529 in file:///C:/USERS/.../APPDATA/LOCAL/MICROSOFT/VISUALSTUDIO/12.0/EXTENSIONS/MWY50QF4.VGS/TestFiles/Coverage/blanket_jasmine_v2.js.** 

Does anyone know about this issue?

+6
source share
1 answer

This is only a problem if you use code coverage. This is a problem with Blanket.js (the Chutzpah library uses to cover the code) and Angualr.js is in conflict. See this question for more information: https://github.com/alex-seville/blanket/issues/311

In short, a simple workaround is to use the mini version of Angular.js

+10
source

All Articles