tornaia / karma-sonarqube-unit-reporter

A Karma plugin. Unit tests execution report for SonarQube/Generic Coverage Plugin
MIT License
33 stars 28 forks source link

Report file contains test name instead path #4

Closed sartymlg closed 8 years ago

sartymlg commented 8 years ago

Hi, thanks for develop this plugin. I'm trying to import my karma reports to sonar and seems that this is the best solution. However, i can't use it, because in my case, it generates this report

<unitTest version="1">
  <file path="Controller: MainCtrl">
    <testCase name="should attach a list of awesomeThings to the scope" duration="3"/>
  </file>
</unitTest>

Sonar generic import expects as real path in the path attribute, do you have the same problem?

tornaia commented 8 years ago

Yep, I also faced with that issue so I refactored a little bit the test codes to make them Sonar compatible.

Example: project\test\app\dashboard\dashboard.controller.spec.js

(function() {
  'use strict';

  describe('app\\dashboard\\dashboard.controller.spec.js', function() {
    // ...

    beforeEach(inject(function(_$controller_, _applicationInfoService_, _$rootScope_) {
      // ...
    }));

    it('should call applicationInfoService.getApplicationInfo once', function() {
      // ...
    });

  });
})();

In short: in the describe section I specify the path to the test file.

Please let me know if it solved your problem!