question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Transition Functional comp causes error in Jest tests: Cannot read property '_isDestroyed' of undefined

See original GitHub issue

Version

2.6.10

Reproduction link

https://github.com/Akryum/vue-issue-test-transition-functional

Steps to reproduce

Using a <transition> on a stubbed functional component is throwing an error during the unit tests with Jest (using shallowMount).

Examples: Component | Test

In the reprod, run:

yarn install
yarn run test:unit

What is expected?

No error in the console

What is actually happening?

The tests pass but an error is displayed in the console:

[Vue warn]: Error in nextTick: "TypeError: Cannot read property '_isDestroyed' of undefined"

Position of the error


Not sure if this should be fixed in Vue core or Vue test utils.

In Vue core, a quick fix would be to check if componentInstance is defined on the vnode here.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:5
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
aj-devcommented, Jul 7, 2020

We see this in static site generated by Nuxt.js. This only happens on page refresh.

4reactions
Akryumcommented, Apr 4, 2019

Note: workaround is manually stubbing the functional component in the test. This makes the error disappear.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read properties of undefined (reading 'length') JEST ...
I am trying to implement jest tests to my project but I have error while running test. The thing is that I dont...
Read more >
jest cannot create styled-component for component: undefined.
React Jest Testing TypeError: Cannot read properties of undefined ... comp causes error in Jest tests: Cannot read property '_isDestroyed' of undefined#9822.
Read more >
Configuring Jest
To read TypeScript configuration files Jest requires ts-node . ... By default, Jest runs all tests and produces all errors into the console ......
Read more >
Unit Testing in React: Full Guide on Jest and Enzyme Testing
Discover how to start and proceed with the testing of React ... If one or another component fails, it will cause failing in...
Read more >
Destroying wrapper in Jest (w/ vue-test-utils) properly - GitLab
Summary We've been seeing instances of wrapper = null across our codebase, and while there are some legitimate reasons of doing...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found