babel/karma-babel-preprocessor

Help with setup

pbrianmackey opened this issue · 3 comments

I installed this tool via npm. How do I set it up? The directions skip over a lot of detail. I edited my karma.conf.js file to include:

    // list of files / patterns to load in the browser
    files: [
      'test-main.js',
      {pattern: 'tests/*.js', included: true}
    ],


    // list of files to exclude
    exclude: [
    ],


    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
            'src/*.js': ['babel']
    },
        'babelPreprocessor': {
      options: {
        sourceMap: 'inline'
      },
      filename: function(file) {
        return file.originalPath.replace(/\.js$/, '.es5.js');
      },
      sourceFileName: function(file) {
        return file.originalPath;
      }
    },

I get error: regeneratorRuntime is not defined. My files do not update on change. My original files written in ES6 are located in src/.

👍 ... I could use some guidance here too. It's not very straightforward.

Sorry to be late. I'll update README.