Newer
Older
dmpopidor / webpack.karma.config.js
@Bodacious Bodacious on 19 Oct 2018 736 bytes Update asset structure with webpacker gem
// Karma configuration
module.exports = function webpackKarmaConf(config) {
  config.set({
    // ... normal karma configuration
    files: [
      // all files ending in "_test"
      { pattern: 'app/assets/javascripts/**/*Spec.js', watched: false },
      // each file acts as entry point for the webpack configuration
    ],

    preprocessors: {
      'app/assets/javascripts/**/*Spec.js': ['webpack'],
    },

    webpack: {
      // karma watches the test entry points
      // (you don't need to specify the entry option)
      // webpack watches dependencies

      // webpack configuration
    },

    webpackMiddleware: {
      // webpack-dev-middleware configuration
      // i. e.
      stats: 'errors-only',
    },
  });
};