deepsweet / isparta-loader

💯 isparta instrumenter loader for webpack
117 stars 22 forks source link

cannot compile ES6 files properly when it's used as preLoaders of Webpack in Karma #23

Open kmCha opened 8 years ago

kmCha commented 8 years ago

this is a part of my karma.conf.js:

        preLoaders: [
          {
            test: /\.js$/,
            loader: 'isparta',
            include: path.resolve(__dirname, './src/'),
            query: {
              babel: {
                presets: ['es2015', 'stage-0', 'react']
              }
            }
          }
        ]

then i run test using karma, it said:

PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR
  Error: Cannot find module "../../src/components/userfeedback"
  at /Users/kM/Web/ali-baichuan/baichuan-console-static/test/components/userfeedback-test.js:55 <- webpack:///test/components/userfeedback-test.js:3:0

and this is a part of my userfeedback-test.js:

import UserFeedback from '../../src/components/userfeedback';

the interesting thing is that, when i use isparta-instrumenter-loader, which is deprecated, the test runs successfully. Following is a part of my new karma.conf.js:

        preLoaders: [
          {
            test: /\.js$/,
            loader: 'isparta-instrumenter',
            include: path.resolve(__dirname, './src/'),
            query: {
              babel: {
                presets: ['es2015', 'stage-0', 'react']
              }
            }
          }
        ]
MichelSimonot commented 8 years ago

Was trying to solve a similar issue, but noticed that your issue may be the same as #20.

graingert commented 8 years ago

just use https://github.com/istanbuljs/babel-plugin-istanbul

nachikethashu commented 7 years ago

Is there any progress? I'm getting the same issue.

graingert commented 7 years ago

just use https://github.com/istanbuljs/babel-plugin-istanbul