Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

110
Views
Register global custom directive for cypress component testing in vue

Is there way register global custom directive for cypress component testing in vue. Just register with

app.directive('some',(el,binding)=>{{...})

in main.js file can't solve problem. Because in the component testing component failed resolve that directive.

Local register like that:

mount(SomeComp,{
directive:{
  'some': {...}
})

isn't good option. Because i use this directive in every component and need local register in every component.

How i can register global directive for cypress component testing ?

Thanxx

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Create your own mount,

import { mount } from '@cypress/vue'

export const mountWithDirective = (myComponent) => {

  return mount(myComponent, {
    directive:{
      'some': {...}
  })
}

Put it in /cypress/support/index.js or another file of your choosing.

// test
import { mountWithDirective } from 'cypress/support'
import Component from './Component.vue'

it...
  mountWithDirective(Component)
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!