title: Jest : How to mock vue-router used in vuex
body: <p>I tried to use vue-router inside actions of vuex, which is working fine at localhost.</p>
  
  <p>However, i got errors when I tried to prepare store(for mock) by importing "actions" from store file. </p>
  
  <p>Could you help me out in this issue?</p>
  
  <hr>
  
  <hr>
  
  <p><strong>versions</strong></p>
  
  <pre><code>vue-test-utils: 1.0.0-beta.16
  yarn: 1.5.1
  vuejs: 2.5.13
  vue-jest: 1.4.0
  </code></pre>
  
  <p><strong>error msg</strong></p>
  
  <pre><code> FAIL  test/components/main.test.js
    ● Test suite failed to run
  
      /Users/gulliver/Desktop/test/vue-test-utils-jest-example/node_modules/vue/dist/vue.esm.js:10809
      export default Vue$3;
      ^^^^^^
  
      SyntaxError: Unexpected token export
  
        at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:305:17)
        at Object.&lt;anonymous&gt; (src/router/main.js:1:203)
        at Object.&lt;anonymous&gt; (src/store/main.js:3:13)
  
  Test Suites: 1 failed, 1 total
  Tests:       0 total
  Snapshots:   0 total
  Time:        2.354s
  Ran all test suites matching /test\/components\/main.test.js/i.
  error An unexpected error occurred: "Command failed.
  Exit code: 1
  </code></pre>
  
  <hr>
  
  <hr>
  
  <p><strong>app/src/main.js</strong></p>
  
  <pre><code>import Vue from "vue/dist/vue.esm";
  import App from './App.vue'
  import store from './store/main.js';
  import router from './router/main.js';
  
  new Vue({
    el: '#app',
    render: h =&gt; h(App),
    store,
    router,
  })
  </code></pre>
  
  <p><strong>app/src/store/main.js</strong></p>
  
  <pre><code>import Vue from "vue";
  import Vuex from 'vuex';
  import router from '../router/main.js'
  
  Vue.use(Vuex)
  
  export const actions = {
    locationTo(context, url){
      router.push(url)  
    }
  }
  export default new Vuex.Store({
    actions,
  })
  </code></pre>
  
  <p><strong>app/src/router/main.js</strong></p>
  
  <pre><code>import Vue from "vue/dist/vue.esm";
  import VueRouter from 'vue-router';
  import root from '../components/root.vue';
  import hoge from '../components/hoge.vue';
  
  Vue.use(VueRouter)
  
  export const routes = [
    { path: '/', component: root},
    { path: '/hoge', component: hoge},
  ];
  
  export default new VueRouter({
    mode: 'history',
    routes
  })
  </code></pre>
  
  <p><strong>app/test/components/main.test.js</strong></p>
  
  <pre><code>import Vue from "vue";
  import Vuex from "vuex";
  import { shallowMount, createLocalVue } from "@vue/test-utils";
  
  import { actions } from "@/store/main"; //NOTE: this causes error
  
  import _ from "lodash";
  const localVue = createLocalVue();
  
  import root from '@/components/root.vue'
  import hoge from '@/components/hoge.vue'
  
  describe('increment.vue', () =&gt; {
    let propsData;
    let store;
    let wrapper;
  
    beforeEach(() =&gt; {
      propsData = _.cloneDeep(personObject)
  
      store = new Vuex.Store(_.cloneDeep({
        actions,
      }))
  
      const $route = {
        path: '/hoge', components: hoge
      }
  
      wrapper = shallowMount(root, {
        localVue,
        propsData,
        store,
        use: ['Vuex'],
        stubs: ['router-view'],
        mocks: {
          $route
        }
      })
  
    });
  
    it('test:router in store', () =&gt; {
      // check if URL changed after action executed
    });
  
  })
  </code></pre>
  
  <p>components</p>
  
  <pre><code>// App.vue
  &lt;template&gt;
    &lt;div id="app"&gt;
      &lt;router-view&gt;&lt;/router-view&gt;
    &lt;/div&gt;
  &lt;/template&gt;
  
  // root.vue
  &lt;template&gt;
    &lt;div&gt;
      &lt;p&gt;root component&lt;/p&gt;
    &lt;/div&gt;
  &lt;/template&gt;
  
  &lt;script&gt;
  export default {
    mounted () {
      this.$store.dispatch('locationTo', '/hoge')
    },
  }
  &lt;/script&gt;
  
  // hoge.vue
  &lt;template&gt;
    &lt;div&gt;
      &lt;p&gt;hoge template&lt;/p&gt;
    &lt;/div&gt;
  &lt;/template&gt;
  </code></pre>