Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unit Testing angularjs with jasmine and chutzpah in visual studio2013 wont work

I want to use Chutzpah to run JavaScript unit tests in Visual Studio 2013. As long as I don't reference angular.js the tests will run. Using angular.js those tests won't run and the VS Output gives 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 problem?

like image 351
shaft Avatar asked Apr 04 '14 14:04

shaft


1 Answers

This is only an issue if you are running code coverage. This is an issue with Blanket.js (the library Chutzpah uses for code coverage) and Angualr.js conflicting. See this issue for more details: https://github.com/alex-seville/blanket/issues/311

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

like image 168
Matthew Manela Avatar answered Oct 21 '22 06:10

Matthew Manela