Open shrutigv opened 5 years ago
Hello, I had the same problem, and I fixed it by simply adding "overrideTestDescription: true" in the Karma sonarQubeUnitReporter configuration, as described in the README.
Here's the relevant section: sonarQubeUnitReporter: { sonarQubeVersion: 'LATEST', outputFile: '../reports/ut_report.xml', overrideTestDescription: true, testPaths: ['./src'], testFilePattern: '.spec.ts', useBrowserName: false }
The same for me. Looks like if I I have and angular 8 application with default karma.conf. After I added the next config, the generated report does not includes the paths of components.
sonarQubeUnitReporter: {
sonarQubeVersion: 'LATEST',
outputFile: '../reports/ut_report.xml',
useBrowserName: false
}
so I tried to add the next one, but in this time it started throwing me an error
TypeError: Cannot read property 'value' of undefined
at SonarQubeUnitReporter.specSuccess.specSkipped.specFailure (/<my_path>/node_modules/karma-sonarqube-unit-reporter/index.js:153:95)
sonarQubeUnitReporter: {
sonarQubeVersion: 'LATEST',
outputFile: '../reports/ut_report.xml',
overrideTestDescription: true,
testPaths: ['./src'],
testFilePattern: '.spec.ts',
useBrowserName: false
}
I found a few workarounds on this.
Try to add all 4 properties
overrideTestDescription: true,
testPath: './src',
testPaths: ['./src'],
testFilePattern: '.spec.ts'
the second approach I found in https://github.com/tornaia/karma-sonarqube-unit-reporter/issues/24 this related issue
just override a function In both cases the code start working and the paths became valid
report.xml `
` generated path doesnt point to test.