简体   繁体   English

在visual studio2013中使用jasmine和chutzpah进行单元测试angularjs无法正常工作

[英]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. 我想使用Chutzpah在Visual Studio 2013中运行JavaScript单元测试。只要我不引用angular.js,测试就会运行。 Using angular.js those tests won't run and the VS Output gives me the following message: 使用angular.js这些测试将不会运行,VS输出给我以下消息:

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? 有谁知道这个问题?

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. 这是Blanket.js(Chutzpah用于代码覆盖的库)和Angualr.js冲突的问题。 See this issue for more details: https://github.com/alex-seville/blanket/issues/311 有关详细信息,请参阅此问题: https//github.com/alex-seville/blanket/issues/311

In short, a simple workaround is to use the minified version of Angular.js 简而言之,一个简单的解决方法是使用Angular.js的缩小版本

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM