-
Notifications
You must be signed in to change notification settings - Fork 273
Closed
Description
I have the following example component and test:
const ExampleComponent = {
template: `<div></div>`,
async setup() {
return {
example: await Promise.resolve("Test"),
}
},
}
test("mounts example component with async setup", () => {
const wrapper = mount(ExampleComponent)
expect(wrapper).toBeTruthy()
})
However when I try and run the test I get the following error:
TypeError: Cannot read properties of null (reading 'addEventListener')
at _loop_1 (node_modules/@vue/test-utils/dist/vue-test-utils.cjs.js:7543:21)
at VueWrapper.Object.<anonymous>.VueWrapper.attachNativeEventListener (node_modules/@vue/test-utils/dist/vue-test utils.cjs.js:7553:13)
at new VueWrapper (node_modules/@vue/test-utils/dist/vue-test-utils.cjs.js:7504:15)
at createWrapper (node_modules/@vue/test-utils/dist/vue-test-utils.cjs.js:7682:12)
at mount (node_modules/@vue/test-utils/dist/vue-test-utils.cjs.js:7929:19)
at Object.<anonymous>
When I remove the async and promise and instead use a simple string, the test passes.
Metadata
Metadata
Assignees
Labels
No labels