Error when testing with jest
See original GitHub issueI’m using jest and enzyme to write tests for my project. When testing components with charts in them and calling component.unmount(), I’m getting this error:
TypeError: Cannot read property 'destroy' of undefined
at ChartComponent.componentWillUnmount (node_modules/react-chartjs-2/lib/index.js:127:26)
at node_modules/react-dom/lib/ReactCompositeComponent.js:409:25
...pointlessly looking enormous trace
Full stack trace here: http://pastebin.com/yHNX5QnV
Does anybody else have any similar problem, do I have to do something more specific when testing components with charts in them and do you have any idea how I might be able to fix this?
Issue Analytics
- State:
- Created 7 years ago
- Comments:6
Top Results From Across the Web
How to test the type of a thrown exception in Jest
In Jest, when you test for a case where an error should be thrown, within your expect() wrapping of the function under testing,...
Read more >How to Correctly Expect an Error in Jest - Webtips
We have a mock function and we want to test whether it throws the error we are expecting. We can do this by...
Read more >How to test a function that's expected to throw error in jest…
So, I needed to write unit tests for a function that's expected to throw an error if the parameter supplied is undefined and...
Read more >Successfully Throwing Async Errors with the Jest Testing Library
Today, I'll discuss how to successfully test expected errors are thrown with the popular JavaScript testing library Jest, so you can rest ...
Read more >Testing errors with Jest - DEV Community
Use try catch statement. · call the generateCalcSettings with wrong parameters · The catch take the return and use tobeInstanceOf and compare with ......
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
+1
I am getting the same error when using
react-chartjs-2
in a react webapp. Is there a solution to this issue?