-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
mount.ts
31 lines (28 loc) · 979 Bytes
/
mount.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { mount } from '@cypress/vue'
import type { Component } from 'vue'
import { directives, plugins } from '../../client/global-setup'
export const registerMount = () => Cypress.Commands.add(
'mount',
// eslint-disable-next-line @typescript-eslint/no-unused-vars
<C extends Parameters<typeof mount>[0]>(comp: any, options: any = {}) => {
options.global = options.global || {}
options.global.stubs = options.global.stubs || {}
options.global.stubs.transition = false
options.global.plugins = options.global.plugins || []
options.global.directives = directives
plugins?.forEach((pluginFn: () => any) => {
options?.global?.plugins?.push(pluginFn())
})
return mount(comp, options)
},
)
declare global {
namespace Cypress {
interface Chainable {
/**
* Install all vue plugins and globals then mount
*/
mount<Props = any>(comp: Component<Props>, options?: unknown): Cypress.Chainable<any>
}
}
}