【问题标题】:Unit Testing angularjs with jasmine and chutzpah in visual studio2013 wont work在 Visual Studio 2013 中使用 jasmine 和 chutzpah 对 angularjs 进行单元测试将无法正常工作
【发布时间】:2014-05-16 21:29:56
【问题描述】:

我想使用 Chutzpah 在 Visual Studio 2013 中运行 JavaScript 单元测试。 只要我不引用 angular.js,测试就会运行。 使用 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.**

有人知道这个问题吗?

【问题讨论】:

    标签: angularjs visual-studio-2013 jasmine chutzpah


    【解决方案1】:

    只有在运行代码覆盖时才会出现此问题。这是 Blanket.js(Chutzpah 用于代码覆盖的库)和 Angualr.js 冲突的问题。更多详情请查看本期:https://github.com/alex-seville/blanket/issues/311

    简而言之,一个简单的解决方法是使用 Angular.js 的缩小版

    【讨论】:

      猜你喜欢
      • 2016-07-18
      • 1970-01-01
      • 2016-05-28
      • 2017-06-21
      • 1970-01-01
      • 1970-01-01
      • 2016-08-12
      • 1970-01-01
      • 2015-12-27
      相关资源
      最近更新 更多