webpack-contrib / istanbul-instrumenter-loader

Istanbul Instrumenter Loader
MIT License
273 stars 65 forks source link

Help ! Dont work in my case. #21

Closed GrimDev closed 8 years ago

GrimDev commented 8 years ago

Hi !

I have the following structure :

├── app/
│   └──  scripts/
│       ├── modules/
│       │      └── foo/
│       │         └── index.js
│       └── app.js
└── test/
    ├── spec/
    │  └── modules/
    │       └── foo/
    │           └── index.js
    └── karma.conf.js

And my config looks like this :

module.exports = function (config) {
  config.set({
    // basePath, frameworks ....
    plugins: [
      'karma-phantomjs-launcher',
      'karma-jasmine',
      'karma-coverage',
      'karma-tap-reporter'
    ],
    files: [
      // Dependencies
      'test/spec/*.js',
      'test/spec/modules/**/*.js',
    ],
    preprocessors: {
      'app/scripts/app.js': ['webpack', 'sourcemap', 'coverage'],
      'app/scripts/modules/**/*': ['coverage'],
      'test/spec/*.js': ['babel'],
      'test/spec/modules/**/*.js': ['babel']
    },
    plugins: [
      'karma-phantomjs-launcher',
      'karma-jasmine',
      'karma-coverage',
      'karma-sinon-chai',
      'karma-tap-reporter',
      'karma-babel-preprocessor',
      'karma-coffee-preprocessor',
      'karma-sourcemap-loader',
      require("karma-webpack")
    ],
    webpack: {
      module: {
        postLoaders: [
          { test: /\.js$/, loader: 'istanbul-instrumenter' }
        ],

        loaders: [
          // JS
          { test: /\.js?$/, exclude: /node_modules/, loader: 'babel-loader' }
        ]
      }
    },
    // Coverage reporters, babel preprocessor ...
  });
}

I tried to put istanbul-instrumenter as preLoader and postLoader but it never works for me.

In preLoader, my tests fail, and in postLoader, I have the following error.

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory

Any idea ?

PS : My coverage worked good before webpack migration and all of my tests pass without preLoader istanbul instrumenter.

Thanks

deepsweet commented 8 years ago

could you please try setup described in readme? it's difficult to understand what is wrong without example repo.

deepsweet commented 8 years ago

please comment here if you have more details and I'll reopen the issue.