Skip to content
This repository has been archived by the owner on Jan 19, 2021. It is now read-only.

No source map support #7

Closed
claydiffrient opened this issue Apr 20, 2015 · 5 comments
Closed

No source map support #7

claydiffrient opened this issue Apr 20, 2015 · 5 comments

Comments

@claydiffrient
Copy link

When using this as a post loader in my webpack config:

webpackConfig.module.postLoaders = [
  {
    test: /\.jsx$/,
    exclude: /(test|node_modules|bower_components)\//,
    loader: 'istanbul-instrumenter'
  }
];

It ends up destroying source maps: devtool: 'source-map',

For now my work around is to do

let istanbulInstrumenter =  {
    test: /\.jsx$/,
    exclude: /(test|node_modules|bower_components)\//,
    loader: 'istanbul-instrumenter'
  };
webpackConfig.module.postLoaders = IS_CI_ENV ? [istanbulInstrumenter] : []

Which works for when I want it to do coverage from my CI environment, but makes it so it's slightly more difficult to get coverage locally.

@deepsweet
Copy link
Collaborator

afaik there is no source maps support gotwarlost/istanbul#212 + karma-runner/karma-coverage#109, so there is nothing to return from the loader.

btw, are you sure that you really need source maps in case of code coverage?

@claydiffrient
Copy link
Author

Fair point.

Well, I use the same webpack config for development and testing. Maybe I should split that out instead. The source maps I need for development, but the coverage I want as part of testing. So having to comment out the instrumenter or provide a ENV variable is a bit cumbersome.

But yeah, I don't need source maps when doing coverage, feel free to close this issue. The true thing for me to do is have my test environment load a different webpack config than my local environment.

@deepsweet
Copy link
Collaborator

usually I have 3 webpack configs inherited from "common" one: build, dev and test. so maybe it's a good moment to start splitting :)

@alexgorbatchev
Copy link

I think the sourcemap is now used to remap covered JS code back to original source it was transpiled from. With babel, typescript & angular 2 this is becoming a must have feature. See

@asci
Copy link

asci commented Jan 12, 2016

+1 - new babel does not support correct auxiliaryCommentBefore - but supports source maps, as well as istambul 1.0.0-alpha.2

MichaReiser pushed a commit to MichaReiser/istanbul-instrumenter-loader that referenced this issue Sep 6, 2016
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,
deepsweet pushed a commit that referenced this issue Nov 27, 2016
* 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,
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants