isparta-loader icon indicating copy to clipboard operation
isparta-loader copied to clipboard

sourcemaps

Open iam4x opened this issue 9 years ago • 15 comments

Anyway to keep sourcemaps at the right line?

iam4x avatar Apr 09 '15 14:04 iam4x

Seems like isparta has source maps support. Any change to get it?

kossnocorp avatar Jul 08 '15 14:07 kossnocorp

What is the problem here actually?

dmitry avatar Jul 08 '15 15:07 dmitry

@dmitry source maps don't passed:

localhost_4001

Before I integrated isparta-loader, source maps did worked as expected.

kossnocorp avatar Jul 08 '15 15:07 kossnocorp

Exactly what @kossnocorp said.

You can checkout my boilerplate (https://github.com/iam4x/isomorphic-flux-boilerplate) as repro case.

iam4x avatar Jul 08 '15 15:07 iam4x

The problem occurs when your using a globing pattern instead of a single file.

    files: [
      { pattern: './app/**/__tests__/**/*.js*', watched: true, included: true, served: true }
    ],

    preprocessors: {
      './app/**/__tests__/**/*.js*': ['webpack', 'sourcemap']
    }

When I switch it to a single file that has this... everything works.

var context = require.context('../app', true, /__tests__\/.*\.jsx?$/);
context.keys().forEach(context);

I would really prefer to have my includes inside files in my karma config. It seems bad that I would have to break karma convention so that this plugin will work properly.

jhicken avatar Jul 31 '15 02:07 jhicken

actually single file approach is preferred, as it's described in README now.

deepsweet avatar Aug 20 '15 03:08 deepsweet

@jhicken @deepsweet I have a single file setup as suggested and my sourcemaps still don't seem to work. I can use Chrome Dev Tools to pretty print things which makes it mostly readable, but the __cov_hash lines are interspersed everywhere among my actual source. Does someone have an example repo where they have it working? If you're interested I'm happy to post some of my config files to help debug.

fredantell avatar Sep 25 '15 21:09 fredantell

+1

joshlasdin avatar Oct 10 '15 22:10 joshlasdin

+1. @jhicken Can you please give us the correct config, which works for you?

anatoliyarkhipov avatar Oct 12 '15 16:10 anatoliyarkhipov

@fredantell @anatoliyarkhipov @deepsweet Hey guys sorry. I had this setup in July. I have recently tried it again and I am not able to get the source maps to load properly anymore. In fact I hit some extra issues.

I am not able to get source maps at all without using devtool: 'eval' in my webpack settings. And using the eval method just makes me sad.

Secondly... This might be connected to the first problem. My break points are ignored. If I run tests with karma all my break points are ignored.

I haven't dug in to figure out whats going on yet.

jhicken avatar Oct 12 '15 20:10 jhicken

My solution to this problem was to use a gulp task to split out isparta. One gulp task runs just my tests with no mention of isparta in any config. The other gulp task runs just the code coverage and pops open a browser to view it. Since I don't really need both at the same time, it works well enough. If you're stuck that may be as good a work around as any.

On Mon, Oct 12, 2015 at 3:56 PM, Jeff Hicken [email protected] wrote:

@fredantell https://github.com/fredantell @anatoliyarkhipov https://github.com/anatoliyarkhipov @deepsweet https://github.com/deepsweet Hey guys sorry. I had this setup in July. I have recently tried it again and I am not able to get the source maps to load properly anymore. In fact I hit some extra issues.

I am not able to get source maps at all without using devtool: 'eval' in my webpack settings. And using the eval method just makes me sad.

Secondly... This might be connected to the first problem. My break points are ignored. If I run tests with karma all my break points are ignored.

I haven't dug in to figure out whats going on yet.

— Reply to this email directly or view it on GitHub https://github.com/deepsweet/isparta-loader/issues/1#issuecomment-147518559 .

fredantell avatar Oct 13 '15 21:10 fredantell

Does anyone have a well-documented workaround for this?

joshlasdin avatar Dec 07 '15 19:12 joshlasdin

You could use an option in your package.json's scripts:

{
  ...
  "scripts": {
    "test": "node ./node_modules/karma/bin/karma start",
    "test:dev": "npm run test -- --coverage"
  },
  ...
}

and dynamically add coverage support:

if (config.coverage_enabled) {
  karmaConfig.reporters.push('coverage');
  karmaConfig.webpack.module.preLoaders = [{
    test    : /\.(js|jsx)$/,
    include : new RegExp(config.get('dir_client')),
    loader  : 'isparta'
  }];
}

This way allows to keep sourcemaps when we are debugging. I use it and it works well.

See my sources React Redux Starter Kit from davezuko:

kiki-le-singe avatar Dec 09 '15 16:12 kiki-le-singe

PR to fix this: https://github.com/deepsweet/isparta-loader/pull/16

@deepsweet Do you have any issues with this?

mwinche avatar May 09 '16 21:05 mwinche

+1

gurghet avatar Nov 30 '16 11:11 gurghet