-
Notifications
You must be signed in to change notification settings - Fork 79
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
remap-istanbul and karma or browserify #2
Comments
I suspect there are two sets of source-maps, something we never really considered in the design of the project initially. I am not familiar with the details of Karma or Browserify, but I suspect you have something like this with your emitted files...
|
I'm also not familiar with the inner working of Karma or Browserify. I'm just trying to set up code coverage for my TypeScript project. From what I see, the source map is inlined into @devongovett or @smrq, would remap-istanbul be usable to get proper code coverage for TypeScript? Is it possible to combine the browserify-istanbul transform and tsify plugin (and remap-istanbul) to fix the coverage report? Do you have any pointers how we can get this working? |
I suspect the source map in If there is a way for the inlined source map in the emitted Browserify bundle to map back directly to the original TypeScript locations then "it should just work®"... |
I managed to set up code coverage for TypeScript by first transpiling the code to JavaScript in a temporary directory, then running Karma configured with Browserify and Istanbul to generate a coverage JSON report, and finally using remap-istanbul to generate the HTML report from the JSON file. I have created a test project using this setup here: stijnvn/typescript-browserify-istanbul |
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
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
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
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
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
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
When locating the source map, use the source map included in the file coverage whenever possible. Closes SitePen#2
When locating the source map, use the source map included in the file coverage whenever possible. Closes SitePen#2
When locating the source map, use the source map included in the file coverage whenever possible. Closes #2
I have a TypeScript project which I would like to generate coverage reports for. Karma is set up to use browserify as preprocessor (using karma-browserify). By adding browserify-istanbul as browserify transform, I managed to generate coverage reports which display the TypeScript code, but with (what it seems to be) coverage for the generated JavaScript:
Can remap-istanbul be used to correct the coverage mapping? Any pointers how I can integrate it with karma and/or browserify?
karma.conf.js:
The text was updated successfully, but these errors were encountered: