-
Notifications
You must be signed in to change notification settings - Fork 13
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
Include input source map in file coverage #23
Include input source map in file coverage #23
Conversation
Thank you for submitting this pull request, however I do not see a valid CLA on file for you. Before we can merge this request please visit https://yahoocla.herokuapp.com/ and agree to the terms. Thanks! 😄 |
CLA is valid! |
Part of istanbuljs-archived-repos/istanbul-lib-instrument#23 Alternative could be to move it to remap-istanbul instead and implement there a custom source map resolution strategy
Pass the intermediate source map to the instrumenter that can be used to remap the coverage report to the original source. Requires istanbuljs-archived-repos/istanbul-lib-instrument#23. Fixes webpack-contrib#22, webpack-contrib#7, karma-runner/karma-coverage#109,
When locating the source map, use the source map included in the file coverage whenever possible. Closes SitePen#2 but requires istanbuljs-archived-repos/istanbul-lib-instrument#23
4c82ee2
to
b521abe
Compare
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.
Add some tests and let's work on landing this 👍
If I'm reading this correctly, this doesn't change any of the existing API, just allows us to attach an additional piece of information to the coverage object?
this.varName = genVar(sourceFilePath); | ||
this.attrs = {}; | ||
this.nextIgnore = null; | ||
this.cov = new SourceCoverage(sourceFilePath); | ||
this.cov.inputSourceMap(inputSourceMap); |
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.
Perhaps let's only assign this.data.inputSourceMap
if inputSourceMap
is undefined
? that way, for anyone not using the new API feature, the shape of the coverage object stays identical 👍
b521abe
to
8d70de9
Compare
Added a simple unit test that verifies if the inputSourceMap is included
Thats right. If the option is not provided (and with your suggested change), the coverage object should be exactly equal to the one before. One question is left. Should inputSourceMap be exposed (no need for .data.inputSourceMap)? Would be more consistent, however, if the coverage object is converted to json that the new property is always included.... |
Part of istanbuljs-archived-repos/istanbul-lib-instrument#23 Alternative could be to move it to remap-istanbul instead and implement there a custom source map resolution strategy
Add an option to include an input source map. The input source map is the source map that maps the code before its instumentation back it's original form. This is needed to support more complex setups, e.g. when bundlers are involved. If a bundler like webpack, browserify - or you name it - is used, then there are several, intermediate, source maps involved. The main issue is, that the instrumented code is bundled into a single file, and therefore a new source map is created. But the source map of the bundled file cannot be used to remap the istanbul coverage. Therefore, these intermediate source maps need to be stored to be available when creating the report or remaping. This solution is kind of hacky and should start a discussion how to solve it best. Anyway, it fixes variouis issues that, up to now, required hacky solutions. refs SitePen/remap-istanbul#2
8d70de9
to
11df1cd
Compare
Part of istanbuljs-archived-repos/istanbul-lib-instrument#23 Alternative could be to move it to remap-istanbul instead and implement there a custom source map resolution strategy
When locating the source map, use the source map included in the file coverage whenever possible. Closes SitePen#2 but requires istanbuljs-archived-repos/istanbul-lib-instrument#23
this.varName = genVar(sourceFilePath); | ||
this.attrs = {}; | ||
this.nextIgnore = null; | ||
this.cov = new SourceCoverage(sourceFilePath); | ||
|
||
if (typeof (inputSourceMap) !== "undefined") { |
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.
👍
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.
Great, thanks!
* Upgrade to istanbul-lib-instrument * Pass intermediate source map to instrumenter Pass the intermediate source map to the instrumenter that can be used to remap the coverage report to the original source. Requires istanbuljs-archived-repos/istanbul-lib-instrument#23. Fixes #22, #7, karma-runner/karma-coverage#109,
Solid work @bcoe @MichaReiser Integrating this now. |
Add an option to include an input source map. The input source map
is the source map that maps the code before its instumentation back it's
original form. This is needed to support more complex setups, e.g. when
bundlers are involved. If a bundler like webpack, browserify - or you
name it - is used, then there are several, intermediate, source maps
involved. The main issue is, that the instrumented code is bundled
into a single file, and therefore a new source map is created. But the
source map of the bundled file cannot be used to remap the istanbul coverage.
Therefore, these intermediate source maps need to be stored to be available
when creating the report or remaping.
This solution is kind of hacky and should start a discussion how to solve
it best. Anyway, it fixes variouis issues that, up to now, required hacky
solutions.
refs SitePen/remap-istanbul#2