2

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"); 
    }));

});
Exitos
  • 29,230
  • 38
  • 123
  • 178

1 Answers1

0

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...

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

Wallace Sidhrée
  • 11,221
  • 6
  • 47
  • 58
  • 1
    I'm not sure this is the reason -- now that we remove the reference to jasmine.js, ReSharper complains about the Jasmine references in our tests (blue squiggly underline). If it came bundled with AngularJS, and AngularJS scripts are referenced, R# shouldn't be complaining about the missing references. But I'll take the test runner working over the blue squigglies any day. – Mark Freedman May 12 '14 at 15:47