I integrated my Angular project with Sentry. So to do that I'm using 
Raven.js library.
Also I'm using raven wrapper like "angular-raven". Everything works. But 
Raven prints out warning message: "ERROR: 'Error: Raven has already been 
configured'" for each "it" block in my test spec
'use strict';

describe('Controller: AudienceCtrl', function() {

  // load the controller's module
  beforeEach(module('dmpCmUiApp'));

  var scope;

  // Initialize the controller and a mock scope
  beforeEach(inject(function($controller, $rootScope) {
    scope = $rootScope.$new();
    $controller('AudienceCtrl', {
      $scope: scope,
      audience: {name: 'testAudienceName', description: 
'testAudienceDescription'},
      attributes: [],
      attributeCategories: []
    });
  }));

  it('should initialize initial scope\'s state', function() {
    expect(scope.editing).toEqual(false);
    expect(scope.loadingText).toEqual('Loading attributes.');
    expect(scope.predicate).toEqual('name');
    expect(Object.keys(scope.fieldErrors).length).toEqual(0);
    expect(scope.generalError).toEqual(null);
    expect(scope.audience.name).toEqual('testAudienceName');
    expect(scope.audience.description).toEqual('testAudienceDescription');
    expect(scope.ascending).toEqual(true);
  });
  it('should change editing to true', function() {
    expect(scope.toggleEdit).toBeDefined();
    scope.toggleEdit();
    expect(scope.editing).toEqual(true);
  });
  it('should have "save" method', function () {
    expect(typeof scope.save).toEqual('function');
  });
  it('should have "delete" method', function() {
    expect(typeof scope.deleteAudience).toEqual('function');
  });
  it('should have "sortBy" method', function() {
    expect(typeof scope.sortBy).toEqual('function');
  });
});


I'm very new in writing tests. But it totally works. And I got 5 errors 
about raven has already been configured. I think it because I load 
"dmpCmUiApp" module which has configuration for Raven.

Does anyone know how to fix that issue? And it seems that the reason is 
totally in Raven, not Karma. Because if i set logLevel to LOG_DISABLED in 
karma.conf.js it won't help.

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to