babel/karma-babel-preprocessor

How do I configure es7 features in the karma.config.js file?

Opened this issue · 1 comments

Hi,

I'm using system.js for my module loader.

In my config.js file I have the following:
babelOptions: {
"optional": [
"runtime",
"optimisation.modules.system",
"es7.decorators",
"es7.classProperties"
]
},

I can't figure out how to add these same options to the karma.config.js file.

I currently have these settings but need the above es7 features so I can run my tests.
babelOptions: {
"optional": [
"runtime",
"optimisation.modules.system",
"es7.decorators",
"es7.classProperties"
]
},

Thank you very much!!

Karl

Sorry to randomize, I just figured it out after several days.

npm install babel-preset-stage-0 --save-dev

then modify karma.config.js adding 'stage-0' to presets. Now all my test run with classes that use es7 properties.

babelPreprocessor: {
        options: {
            presets: ['es2015', **'stage-0'**],
            sourceMap: 'inline'
        },
        sourceFileName: function(file) {
            return file.originalPath;
        }
    },