Running Jest tests with my project requires transpiling react-redux-form. In doing so with Babel 7.2.2 with @babel/plugin-proposal-object-rest-spread 7.3.1, an error is thrown:
SyntaxError: /Users/....../frontend/node_modules/react-redux-form/src/reducers/forms-reducer.js: > A trailing comma is not permitted after the rest property (39:20)
37 | key,
38 | plugins,
39 | ...formOptions,
| ^
40 | } = optionsWithDefaults;
41 |
42 | formKeys.forEach((formKey) => {
at Object.raise (node_modules/@babel/parser/lib/index.js:3834:17)
at Object.raiseCommaAfterRest (node_modules/@babel/parser/lib/index.js:5548:10)
at Object.checkCommaAfterRest (node_modules/@babel/parser/lib/index.js:5534:14)
at Object.parseObj (node_modules/@babel/parser/lib/index.js:6623:16)
at Object.parseBindingAtom (node_modules/@babel/parser/lib/index.js:5396:21)
at Object.parseVarHead (node_modules/@babel/parser/lib/index.js:7848:20)
at Object.parseVar (node_modules/@babel/parser/lib/index.js:7824:12)
at Object.parseVarStatement (node_modules/@babel/parser/lib/index.js:7656:10)
at Object.parseStatementContent (node_modules/@babel/parser/lib/index.js:7253:21)
at Object.parseStatement (node_modules/@babel/parser/lib/index.js:7199:17)
According to the spec, trailing commas are not allowed after the rest property.
Steps to Reproduce
Transpile with Babel 7.2.2 and @babel/plugin-proposal-object-rest-spread 7.3.1
Here is my relevant Jest config:
jest.config.js
module.exports = {
// Automatically clear mock calls and instances between every test
clearMocks: true,
// A map from regular expressions to module names that allow to stub out resources with a single module
moduleNameMapper: {
'\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '<rootDir>/__mocks__/fileMock.js',
'\\.(css|less)$': '<rootDir>/__mocks__/styleMock.js',
},
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
transformIgnorePatterns: [
'/node_modules/(?!(react-redux-form)/)',
]
};
The Problem
Running Jest tests with my project requires transpiling react-redux-form. In doing so with Babel 7.2.2 with @babel/plugin-proposal-object-rest-spread 7.3.1, an error is thrown:
According to the spec, trailing commas are not allowed after the rest property.
Steps to Reproduce
Transpile with Babel 7.2.2 and @babel/plugin-proposal-object-rest-spread 7.3.1
Here is my relevant Jest config:
jest.config.js
package.json
babel.config.js
Expected Behavior
Transpile is successful
Actual Behavior
Error is thrown