首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用yeoman的ReSharper茉莉AngularJS单元测试

使用yeoman的ReSharper茉莉AngularJS单元测试
EN

Stack Overflow用户
提问于 2013-12-23 21:37:35
回答 1查看 1.3K关注 0票数 1

我正在尝试使用Resharper 8.0.2在Visual Studio中运行由yeoman生成的单元测试。

使用yeoman,如果你简单地生成一个控制器,你会得到类似这样的结果:

代码语言:javascript
复制
'use strict';

describe('Controller: MainCtrl', function () {

  // load the controller's module
  beforeEach(module('angularYeomanTestApp'));

  var MainCtrl,
    scope;

  // Initialize the controller and a mock scope
  beforeEach(function() {
      inject(function($controller, $rootScope) {
          scope = $rootScope.$new();
          MainCtrl = $controller('MainCtrl', {
              $scope: scope
          });
      })
  });

  it('should attach a list of awesomeThings to the scope', function () {
    expect(scope.awesomeThings.length).toBe(3);
  });
});

我已经传授了this post的知识,因为yeoman不会在inject语句之前生成匿名函数。

问题是我每次测试都会遇到错误,比如:

代码语言:javascript
复制
Inconclusive: Test wasn't run

Resharper被配置为使用chrome浏览器运行测试,jasmine在打开时似乎正确地包含在测试页面中,但是测试页面是空的!

用karma来运行测试,比如用grunt test就行了!

感谢您的帮助!

附注:我正在使用: Visual-Studio-2013,Resharper 8.0.2,angularjs 1.2.6

EN

回答 1

Stack Overflow用户

发布于 2013-12-23 23:36:21

Karma和Reshaper彼此没有任何关系。您不必运行或安装karma即可运行Resharper测试。对于resharper测试,正如我在上面的注释中所指出的,您需要在每个测试文件中包含所有需要作为“参考”的文件。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20744706

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档