You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
I am using Cypress to component test my Vue app. Following the code example at
https://docs.cypress.io/guides/component-testing/vue/examples#Replicating-Plugins
produces several errors, listed below:
Argument of type '(this: Context, component:
ComponentOptionsWithObjectProps<Readonly<ComponentPropsOptions>, unknown, {},
ComputedOptions, Record<string, Function>, ... 7 more ..., { ...; } | {}>, options?:
MountingOptions<...> | undefined) => Chainable<...>' is not assignable to parameter of type
'CommandFn<"mount">'.
Type 'Chainable<{ wrapper: VueWrapper<ComponentPublicInstance<{ [x: number]: unknown; } & {
readonly length?: number | Prop<unknown, unknown> | null | undefined; readonly concat?:
Prop<unknown, unknown> | { (...items: ConcatArray[]): string[]; (...items: (string |
ConcatArray<...>)[]): string[]; } | null | undefin...' is not assignable to type 'void |
Chainable<{ wrapper:
VueWrapper<ComponentPublicInstance<ExtractPropTypes<Readonly<ComponentPropsOptions>>,
unknown, {}, ComputedOptions, ... 6 more ..., {}>>; component: ComponentPublicInstance<...>;
Property 'global' does not exist on type '[options?: MountingOptions<{ [x: number]: unknown; }
& { readonly length?: number | Prop<unknown, unknown> | null | undefined; readonly concat?:
Prop<unknown, unknown> | { (...items: ConcatArray[]): string[]; (...items: (string |
ConcatArray<...>)[]): string[]; } | null | undefined; ... 12 more ...; toLocale...'.
Cannot find name 'Vapp'.
No overload matches this call.
The last overload gave the following error.
I am using TypeScript. Can someone please provide me with a working code snippet. My code is as follows:
import { createPinia } from "pinia";
import i18n from "../../src/locales/i18n";
import { mount } from "cypress/vue";
import { h } from "vue";
declare global {
namespace Cypress {
interface Chainable {
mount: typeof mount;
Cypress.Commands.add("mount", (component, ...args) => {
args.global = args.global || {};
args.global.plugins = args.global.plugins || [];
args.global.plugins.push(createPinia());
args.global.plugins.push(i18n);
return mount(() => {
return h(Vapp, {}, component)
}, ...args);
Does anyone know how to fix this? And how would I call this mount function when used in tests?
Resolved with Vue Test Utils syntax:
import { mount } from "cypress/vue";
Cypress.Commands.add("mount", (component) => {
return mount(component, {
global: {
plugins: [createPinia(), i18n],
Resolved with Vue Test Utils syntax:
import { mount } from "cypress/vue";
Cypress.Commands.add("mount", (component) => {
return mount(component, {
global: {
plugins: [createPinia(), i18n],