ReSharper Jasmine AngularJS unit-test using yeoman

1.3k Views Asked by At

I'm trying to get unit-test generated by yeoman to run in Visual Studio using Resharper 8.0.2.

With yeoman if you simply generate a controller you'll get something like this:

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

I already have transferred the knowledge of this post because yeoman doesn't generate the anonymous function before the inject statement.

Problem is that I'm always getting errors for each tests like:

Inconclusive: Test wasn't run

Resharper is configured to run tests using the chrome browser and jasmine seems to be properly included into the test page when it opens, but the test page is empty!

Running the tests with karma using e.g. grunt test does work!

Thanks for help!

PS.: I'm using: Visual-Studio-2013, Resharper 8.0.2, angularjs 1.2.6

1

There are 1 best solutions below

3
On

Karma and Reshaper have nothing to do with each other. You do not have to have karma running or installed to run Resharper tests. For resharper tests you have to have , as I indicated in the comment above, all files you need included as "reference" in each test file.