为什么添加对jasmine.js的引用会破坏我的ReSharper测试? [英] Why does adding a reference to jasmine.js break my ReSharper test?

查看:155
本文介绍了为什么添加对jasmine.js的引用会破坏我的ReSharper测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Resharper在Visual Studio中使用phantomJS [Headless]运行我的Javascript单元测试。当我在我的文件中包含对jasmine的引用时,它会破坏测试。但是,如果我注释掉它的顶线就行了。为什么?我的测试是用茉莉花语法编写的......

I am trying to use Resharper to run my Javascript unit tests using phantomJS [Headless] with Visual Studio. When I include a reference to jasmine in my file it breaks the test. However if I comment out the top line it works. Why? my test is written in jasmine syntax...

/// <reference path="../jasmine/jasmine.js"/>  <-- when I comment this, tests work
/// <reference path="../angular-loader.js"/>
/// <reference path="../angular-mocks.js"/>
/// <reference path="../angular.js"/>
/// <reference path="../teststuff/app.js"/>


describe('jasmineApp', function () {

    var scope = {}; 
    scope.name = '';

    beforeEach(angular.mock.module('jasmineApp'));

    beforeEach(angular.mock.inject(function ($rootScope, $controller) {
        scope = $rootScope.$new();
        $controller('jasmineAppController', { $scope: scope });
    }));

    it('name is eric', inject(function () {
        expect(scope.name).toEqual("eric"); 
    }));

});


推荐答案

我认为那是因为 Angular 默认捆绑了 Karma - Karma 支持使用 Jasmine 语法进行测试。

I think that's because Angular comes bundled with Karma by default - and Karma supports tests with Jasmine syntax out of the box.

可能有一个框架在某个地方崩溃...

There might be a framework crash somewhere...

所以只需删除 Jasmine (你已经注释掉的那一行)你会没事的。

So just remove the inclusion of Jasmine (the line you're already commenting out) and you'll be fine.

这篇关于为什么添加对jasmine.js的引用会破坏我的ReSharper测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆