Transition Functional comp causes error in Jest tests: Cannot read property '_isDestroyed' of undefined
See original GitHub issueVersion
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
).
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"
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:
- Created 4 years ago
- Reactions:5
- Comments:5 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We see this in static site generated by Nuxt.js. This only happens on page refresh.
Note: workaround is manually stubbing the functional component in the test. This makes the error disappear.