Course lesson

Use Cypress cy.spy() Function to Test a Vue 3 Component’s Emitted Events

emit() function enables components to communicate with one another. While this communication is a good candidate for end to end test, we can also test this in isolation within component. To do this, we’ll use cy.spy() function that will watch for the defined...

Duration
3 min
Access
Included
Transcript
Retained from source evidence

emit() function enables components to communicate with one another. While this communication is a good candidate for end to end test, we can also test this in isolation within component. To do this, we’ll use cy.spy() function that will watch for the defined function call. Using this, we can confirm that our emitted event was actually invoked.