Skip to content

Destroy swallows errors in hooks #1105

Closed
@Haroenv

Description

@Haroenv

Version

1.0.0-beta.28

Reproduction link

https://codesandbox.io/s/w75w7ko968

Steps to reproduce

  1. have an error in a destroy hook
  2. test this

What is expected?

The hook stops at the error and this gets thrown in the test

What is actually happening?

The hook stops at the error and the test does not know about the error


This is likely because Vue catches an error like this, and would show the red screen, but this is still something I'd like to catch in a test.

Likely we need to catch and rethrow the error in below code

destroy (): void {
if (!this.isVueInstance()) {
throwError(`wrapper.destroy() can only be called on a Vue instance`)
}
if (this.element.parentNode) {
this.element.parentNode.removeChild(this.element)
}
// $FlowIgnore
this.vm.$destroy()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions