title: How to unit test Vue.js components that use nuxt-i18n
body: <p>If I try to run the thing below (with <code>yarn run jest</code>), I get <strong>TypeError: _vm.$t is not a function</strong>, because <code>SearchField</code> is using a translation (<code>"$t('search')"</code>).</p>
  
  <pre><code>import { mount } from "@vue/test-utils";
  import SearchField from "@/components/ui/SearchField";
  
  describe("SearchField", () =&gt; {
    const wrapper = mount(SearchField);
  
    it("renders correctly", () =&gt; {
      expect(wrapper.element).toMatchSnapshot();
    });
  });
  </code></pre>
  
  <p>If I add the following three lines at the beginning, I get <strong>TypeError: Cannot read property '_t' of undefined</strong> instead.</p>
  
  <pre><code>import Vue from "vue";
  import VueI18n from "vue-i18n";
  Vue.use(VueI18n);
  </code></pre>