babel/karma-babel-preprocessor

Unexpected token for object spread

stevenvachon opened this issue · 1 comments

Unexpected token, expected ";" (1:5)

> 1 | Line 321: Unexpected token ...

Problematic line:

this.promise = $http({...config, timeout})

karma.config.js (excerpt):

babelPreprocessor: {
    options: {
        extends: `${__dirname}/babel.config.js`,
        sourceMap: 'inline'
    }
},

babel.config.js (excerpt):

presets: [
    [
        '@babel/env',
        {
            targets: {
                browsers: 'last 2 versions'
            },
            useBuiltIns: false
        }
    ]
],

It's as if my preset is not being applied to some files. I say "some" because my test files containing object spreads transpile fine. I had this problem with babel 6.x and still with 7.x and I do not experience this problem when building with gulp-babel. The Babel core team has confirmed that it's not an issue on their end.

shuhei commented

Please reopen this if it's still reproducible.