我正在尝试使用Resharper 8.0.2在Visual Studio中运行由yeoman生成的单元测试。
使用yeoman,如果你简单地生成一个控制器,你会得到类似这样的结果:
'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语句之前生成匿名函数。
问题是我每次测试都会遇到错误,比如:
Inconclusive: Test wasn't runResharper被配置为使用chrome浏览器运行测试,jasmine在打开时似乎正确地包含在测试页面中,但是测试页面是空的!
用karma来运行测试,比如用grunt test就行了!
感谢您的帮助!
附注:我正在使用: Visual-Studio-2013,Resharper 8.0.2,angularjs 1.2.6
发布于 2013-12-23 23:36:21
Karma和Reshaper彼此没有任何关系。您不必运行或安装karma即可运行Resharper测试。对于resharper测试,正如我在上面的注释中所指出的,您需要在每个测试文件中包含所有需要作为“参考”的文件。
https://stackoverflow.com/questions/20744706
复制相似问题