https://cypress.io logo
Join Discord
Powered by
# vue
  • a

    ancient-appointment-66951

    01/09/2021, 12:29 AM
    someone asked about shallowMount for component testing
  • a

    ancient-appointment-66951

    01/09/2021, 12:30 AM
    whether this is a design goal or not, I think it's probably a good idea to have reasoning for/against it since it's a pretty popular feature (at least for Vue users)
  • a

    ancient-appointment-66951

    01/09/2021, 12:45 AM
    It might make it easier for ppl to migrate/ try out cypress for vue testing
  • u

    user

    01/11/2021, 8:07 AM
    Hello cypress people πŸ‘‹ I've just got the vue comp testing sorted and i'm wondering if there is a way to add another test group for unit tests. Currently the cypress tool shows integration and component tests separately, and you can run them separately. Is there something that can be done via config or is it a fair amount of work to create another type of tests separated off like this?
  • s

    stocky-dream-36427

    01/13/2021, 10:22 PM
    πŸ‘‹
  • s

    stocky-dream-36427

    01/13/2021, 10:22 PM
    Hey @User, not currently!
  • s

    stocky-dream-36427

    01/13/2021, 10:22 PM
    I would personally group any unit tests in with the component tests for now
  • s

    stocky-dream-36427

    01/13/2021, 10:22 PM
    We are working on better support for unit tests, but it's a few months out
  • s

    stocky-dream-36427

    01/13/2021, 10:23 PM
    You could use a pattern to make it easier to search, and then use search to filter and run the unit tests by themselves
  • s

    stocky-dream-36427

    01/13/2021, 10:23 PM
    I know it's not ideal, but it's a workaround
  • u

    user

    01/14/2021, 6:53 AM
    Ah na. it's totally fine as it is. Just a visual thing so I don't have to spend 20 mins telling another team member that I know ui & unit tests are not the same thing 😩 πŸ˜‹ Thanks
  • b

    bright-agent-70011

    01/22/2021, 9:42 PM
    is it possible to run cypress/vue with vue3? i'm getting "Error: Cannot find module 'vue-loader/lib/plugin'" from the plugins/index.js file... Just out of the box.
  • b

    bright-agent-70011

    01/23/2021, 2:22 PM
    uncommenting line 13 and commenting 12 makes it work but then other errors appear because yeah, it's not ported to vue3 yet πŸ™‚ i give up...
  • s

    stocky-dream-36427

    01/25/2021, 1:13 AM
    Yeah @bright-agent-70011 adding support for Vue 3 isn’t done yet. @ancient-appointment-66951 will likely look into this in the coming sprint
  • s

    stocky-dream-36427

    01/25/2021, 1:13 AM
    We’ve been working on improving the speed of the tool and removing a lot of the custom webpack configuration.
  • a

    ancient-appointment-66951

    01/25/2021, 5:12 AM
    Yep definitely will do this soon
  • a

    ancient-appointment-66951

    01/25/2021, 5:12 AM
    It should be pretty simple to add Vue 3 support. I have a POC somewhere
  • b

    breezy-australia-64868

    02/02/2021, 2:10 AM
    Hey! Would love to get some advice on the following. I have a component that does an api call in it's
    mounted()
    hook. I'm trying to stub it after I mount the component like
    cy.stub(Cypress.vue, 'getSomething')
    but the mouned hook seems to always run before the stub happens. If I stub it before I mount I don't have access to
    Cypress.vue
    ... Is there a good way with component testing to set up a stub before actually mounting the component? thx!
  • s

    stocky-dream-36427

    02/02/2021, 3:53 AM
    Hello! πŸ™‚
  • s

    stocky-dream-36427

    02/02/2021, 3:54 AM
    mm, you should be able to pass in the normal VTU options
  • s

    stocky-dream-36427

    02/02/2021, 3:57 AM
    It's a little hard to help because I don't know the kind of component you're testing
  • s

    stocky-dream-36427

    02/02/2021, 3:57 AM
    You have access to the normal options here https://vue-test-utils.vuejs.org/api/options.html#listeners -- it's the same signature
  • b

    breezy-australia-64868

    02/02/2021, 2:38 PM
    Ooo didn’t realize that. Think that opens up a few possibilities - might be able to pass in a new mounted function all together, or use al the mocks option. Thanks a lot!
  • s

    stocky-dream-36427

    02/03/2021, 12:01 AM
    ^.^ good luck!!!
  • s

    stocky-dream-36427

    02/03/2021, 12:01 AM
    Ask either @User or I if you need any more help
  • s

    stocky-dream-36427

    02/03/2021, 12:02 AM
    we're trying to evolve the mount API and if you have any feedback let us know
  • s

    stocky-dream-36427

    02/03/2021, 12:02 AM
    the docs are pretty sparse right now (because it's an experimental feature)
  • b

    breezy-australia-64868

    02/03/2021, 1:26 AM
    No it worked perfectly! I just registered my global prototype as a mock when mounting like
    mount(Component, extensions, mocks: { $api... })
    , and then I could prevent the api call from ever happening. Thanks for the quick reply!
  • s

    stocky-dream-36427

    02/03/2021, 1:37 AM
    niiiiice
  • s

    stocky-dream-36427

    02/03/2021, 1:38 AM
    BTW we're dropping a Super Secret re-write in the next 2 weeks. Will be dev-server based instead of recompiling webpack each time
12345...37Latest