title: Vue-Test-Utils Unknown custom element: <router-link>
body: <p>I'm using Jest to run my tests utilizing the vue-test-utils library.</p>
  
  <p>Even though I've added the VueRouter to the localVue instance, it says it can't actually find the router-link component. If the code looks a little funky, it's because I'm using TypeScript, but it should read pretty close to ES6... Main thing is that the @Prop() is the same as passing in props: {..}</p>
  
  <p><strong>Vue component:</strong></p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;template&gt;
    &lt;div&gt;
      &lt;div class="temp"&gt;
        &lt;div&gt;
          &lt;router-link :to="temp.url"&gt;{{temp.name}}&lt;/router-link&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/template&gt;
  
  &lt;script lang="ts"&gt;
  import Vue from 'vue'
  import Component from 'vue-class-component'
  import { Prop } from 'vue-property-decorator'
  import { Temp } from './Temp'
  
  @Component({
    name: 'temp'
  })
  export default class TempComponent extends Vue {
    @Prop() private temp: Temp
  }
  &lt;/script&gt;
  
  &lt;style lang="scss" scoped&gt;
  .temp {
    padding-top: 10px;
  }
  &lt;/style&gt;
  </code></pre>
  
  <p><strong>Temp model:</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>export class Temp {
    public static Default: Temp = new Temp(-1, '')
  
    public url: string
  
    constructor(public id: number, public name: string) {
      this.id = id
      this.name = name
      this.url = '/temp/' + id
    }
  }
  </code></pre>
  
  <p><strong>Jest test</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>import { createLocalVue, shallow } from '@vue/test-utils'
  import TempComponent from '@/components/Temp.vue'
  import { Temp } from '@/components/Temp'
  import VueRouter from 'vue-router'
  
  const localVue = createLocalVue()
  localVue.use(VueRouter)
  
  describe('Temp.vue Component', () =&gt; {
    test('renders a router-link tag with to temp.url', () =&gt; {
      const temp = Temp.Default
      temp.url = 'http://some-url.com'
  
      const wrapper = shallow(TempComponent, {
        propsData: { temp }
      })
      const aWrapper = wrapper.find('router-link')
      expect((aWrapper.attributes() as any).to).toBe(temp.url)
    })
  })
  </code></pre>
  
  <p>What am I missing? The test actually passes, it just throws the warning. In fact, here is the output:</p>
  
  <p><strong>Test Output:</strong></p>
  
  <pre><code>$ jest --config test/unit/jest.conf.js
   PASS  ClientApp\components\__tests__\temp.spec.ts
    Temp.vue Component
      √ renders a router-link tag with to temp.url (30ms)
  
    console.error node_modules\vue\dist\vue.runtime.common.js:589
      [Vue warn]: Unknown custom element: &lt;router-link&gt; - did you register the 
  component correctly? For recursive components, make sure to provide the 
  "name" option.
  
      (found in &lt;Root&gt;)
  
  Test Suites: 1 passed, 1 total
  Tests:       1 passed, 1 total
  Snapshots:   0 total
  Time:        4.677s
  Ran all test suites.
  Done in 6.94s.
  </code></pre>
  
  <p>Appreciate any help you can give!</p>