1

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

Community
  • 1
  • 1
Sentenza
  • 1,269
  • 11
  • 24
  • Is that your complete test? Do you have included references to all js files needed? With resharper in order to run the tests you have to have references to all your js file before the test included. If you drag them vs will create them for you. Something like /// – epitka Dec 23 '13 at 13:51
  • Yes that is the complete test. Karma is configured to load about 15 files or something into the browser. Should i add them all manually? – Sentenza Dec 23 '13 at 15:22

1 Answers1

0

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.

epitka
  • 17,275
  • 20
  • 88
  • 141
  • is there a possibility to include a standard set of references for all tests? – Sentenza Dec 23 '13 at 15:55
  • 1
    @Sentenza: Yes, http://stackoverflow.com/questions/3448119/how-to-reference-multiple-files-for-javascript-intellisense-in-vs2010 – epitka Dec 23 '13 at 20:56
  • I'm not getting it to work. My references file includes angular, jasmin and the services to test as well as the app.js-file. But still it's not working... – Sentenza Feb 24 '14 at 07:31