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

TypeError: Cannot read property '_isDestroyed' of undefined #257

Open
K-Schaeffer-LOG opened this issue Nov 19, 2021 · 4 comments
Open

TypeError: Cannot read property '_isDestroyed' of undefined #257

K-Schaeffer-LOG opened this issue Nov 19, 2021 · 4 comments

Comments

@K-Schaeffer-LOG
Copy link

Hello folks,

I'm having this error when rendering a component from a Storybook story.
I think it might be something related to the vue constructor, since the error doesn't happen when commonly rendering this component. Also, the error doesn't happen with any other component rendered from the Storybook story, so I'm not sure why this is happening since I do not have any destroy() call or something like that.

The issue is that this is making my test fail, and I found out that here is a try-finally on the end of render.js, I thought of adding a catch block there, so the error continue to show on console but the test doesn't fail, like other errors that shows on test console.

What do you guys think about it?

To Reproduce Steps to reproduce the behavior:

I do not have a reproduction, the issue is a little bit specific.

Expected behavior

Is just an idea, but perhaps it should only show the error without failing the test.

Screenshots

Current behaviour:
image

With catch block:
image

Related information:

  • @testing-library/vue version: 5.8.2
  • Vue version: 2.6.11
  • node version: 12.9.0
  • npm (or yarn) version: 1.22.15

Relevant code or config (if any)

 function cleanupAtWrapper(wrapper) {
  if (wrapper.element.parentNode && wrapper.element.parentNode.parentNode === document.body) {
    document.body.removeChild(wrapper.element.parentNode);
  }

  try {
    wrapper.destroy();
  // Method with catch included
  } catch (error) {
    console.error(error)
  } finally {
    mountedWrappers["delete"](wrapper);
  }
}

Additional context

I'm using the testing-vue of storybook to render, so If you guys have any idea of what is missing on vue constructor to it recognize the isDestroyed I would appreciate.

@K-Schaeffer-LOG K-Schaeffer-LOG added the bug Something isn't working label Nov 19, 2021
@afontcu
Copy link
Member

afontcu commented Nov 22, 2021

Hi! 👋 as you mentioned in the issue on testing-vue, it looks like this is an upstream issue originated there?

@K-Schaeffer-LOG
Copy link
Author

Hi! wave as you mentioned in the issue on testing-vue, it looks like this is an upstream issue originated there?

Yes, It appears to me that it is originated there.

Regarding the catch block idea, I'm not sure if the lack of it is on purpose to make the test break with an unhandled exception. What do you think of It?

@afontcu
Copy link
Member

afontcu commented Nov 22, 2021

Yeah, maybe we could improve something there… the reason to have a try/finally block is explained on this PR: #142

if we can come up with a valid use case (in form of a current failing test) it would be great!

@K-Schaeffer-LOG
Copy link
Author

I see, I don't remember having any other test failing and as I said, this one is probably something on testing-vue so It makes my case too specific... I'll wait for someone's reply there.

@afontcu afontcu removed the bug Something isn't working label Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants