Mocking notify plugin in a test

  • Hello,

    I have a jest unit test of a component that uses the notify plugin. If import the plugin into the test with:

    import { Notify } from 'quasar'

    and then:

    localVue.use(Quasar, { components, plugins: [Notify] })

    I get an annoying warning on the console:

    [Vue warn]: Error in mounted hook: "TypeError: Cannot read property 'fullscreen' of undefined"

    I am sure it’s the notify plugin because if I remove the plugin the message goes away.

    Even if the test works, I’d like to get rid of the warning message, so I was wondering if there is a good way to mock the notiify plugin. I’ve tried with the following mock but it’s clearly wrong:

    const Notify = {
      notify () {

    Have you got any tip to share?

  • @dariosalvi you should also ask this in the testing channel in our discord.

  • I have found a solution to the specific warning: the reference to fullscreen is inside the function mounted() of the Notify plugin.

    I have mocked mounted() with:

      Notify.mounted = () => {
        return jest.fn()

    and the warning has disappeared.

Log in to reply