jestでVuexのmapMutationが Unexpected token on mapMutations
なエラーになってしまう。
...mapMutations
の ...
がbabelによってエラーになってしまっているようだ。
...
はスプレッド演算子(object rest spread operator)というらしい。
解決方法
スプレッド演算子をbabelがテスト時もトランスパイルできるように babel-plugin-transform-object-rest-spread
を追加する。
$ npm install --save-dev babel-plugin-transform-object-rest-spread
.babelrc
に設定を追加する。
{ //... "env": { //... "test": { "plugins": ["transform-object-rest-spread"] } } //... }