Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Destroy swallows errors in hooks #1105

Closed
Haroenv opened this issue Jan 18, 2019 · 0 comments
Closed

Destroy swallows errors in hooks #1105

Haroenv opened this issue Jan 18, 2019 · 0 comments
Labels

Comments

@Haroenv
Copy link
Contributor

Haroenv commented Jan 18, 2019

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()
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants