-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(preprocessor): use absolute paths #163
fix(preprocessor): use absolute paths #163
Conversation
According to the spec, the absolute file path should be used in the coverage report. Currently karma-coverage substitutes this with a path relative to `baseDir`. This causes problems when trying to combine coverage with other reports not generated by karma-coverage. Fixing this would help with karma-runner#1. coverag.json spec for reference: - https://github.com/gotwarlost/istanbul/blob/master/coverage.json.md
FWIW - in windows, istanbul outputs paths that look like, Suggest using |
@tswaters, I don't see how the changes I made here would affect |
@dignifiedquire |
@@ -76,7 +76,6 @@ function createCoveragePreprocessor (logger, helper, basePath, reporters, covera | |||
return function (content, file, done) { | |||
log.debug('Processing "%s".', file.originalPath) | |||
|
|||
var jsPath = file.originalPath.replace(basePath + '/', './') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sure someone had a reason they thought this was a good idea, but mucking about with istanbuls output breaks it for any downstream consumers that expect the output to conform to the spec (including istanbuls own command line tools). This makes karma-coverage
brittle as its manipulating internal implementation details in istanbuls output and breaking encapsulation.
fix(preprocessor): use absolute paths
awesome, thanks! |
Sorry for the wait. I'll cut a new release larer today. |
Released as |
I still can't merge coverage reports generated by this package with other reports. I am using the version 0.5.2. karma.conf.js:
The report is generated ok in the folder I suspect that my issue can be related to the fact that I am using What am I doing wrong? UPDATE: It seems like regardless whether instrumented file has full paths or relative paths in |
Have you tried the solutions discussed here. In general, you are far better off bundling using a karma plugin. Also, you should probably apply your coverage transform during the bundling using browserify-istanbul. Also, if you are combining with other istanbul files, you want to output |
Thank you very much. |
According to the spec, the absolute file path should be used in the coverage report. Currently karma-coverage substitutes this with a path relative to
baseDir
. This causes problems when trying to combine coverage with other reports not generated by karma-coverage.Fixing this would help with #1.