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

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

Open kmCha opened this issue 8 years ago • 4 comments

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']
              }
            }
          }
        ]

kmCha avatar Jul 06 '16 10:07 kmCha

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

MichelSimonot avatar Jul 18 '16 18:07 MichelSimonot

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

graingert avatar Aug 03 '16 19:08 graingert

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

nachikethashu avatar Feb 11 '17 10:02 nachikethashu

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

graingert avatar Feb 11 '17 11:02 graingert