Skip to content

TypeError: Cannot destructure property 'data' of 'e' as it is undefined #40

@felixzapata

Description

@felixzapata

Hi, just using vue-announcer (v3.1.5) in a component like:

const { assertive } = useAnnouncer(); (or polite etc) throws an error during the component test:

Captura de pantalla 2022-09-16 a las 9 26 51

Captura de pantalla 2022-09-16 a las 9 56 43

If you only import the vue-announcer there will be no error.

The component is under a Vue 3 application using TypeScript, Composition API, and SFC (with <script setup>). The tests are with Vitest, also written in Typescript.

The skeleton of my component test is:

import { describe, it, expect } from "vitest";
import i18n from "../../i18n";
import { mount } from "@vue/test-utils";
import MyComponent from "./MyComponent.vue";
import type { User } from "./User";

it("emit profile-saved", async () => {
    const wrapper = mount(Mycomponent, {
      global: { plugins: [i18n] },
      props: { user: { ...user } },
    } as any);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions