@quasar/testing (jest) components not registered when VueRouter not created



  • When I want to mock $route or $router, I can’t create a VueRouter, otherwise these are read-only props.
    https://vue-test-utils.vuejs.org/guides/#using-with-vue-router

    In test/jest/utils/index.js, mountQuasar, if I replace
    const router = new VueRouter()
    with
    const router = {}
    I’m able to change $route and $router in my test files.

    But then I get errors warnings while testing, ex:
    [Vue warn]: Unknown custom element: <q-page> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
    even if they are registered in quasar.conf.js

    However the test passes. But I feel like messing up my code.

    Is there a way to properly register the components in such a case ? Or do I have to accept these warnings ?


Log in to reply