react-apexcharts
react-apexcharts copied to clipboard
Cannot call react testing library cleanup() function when rendering apex-charts
When I test drawing any apex chart, when calling cleanup, I get the following error:
Error: Uncaught [TypeError: this.node.getScreenCTM is not a function]
I'm using jest and by calling cleanup like this (using jest)
afterEach(cleanup)
I get the above error.
Update: The same thing happens even after calling cleanup(); at the end of a test.
Another update: I tried clonging react-apexcharts and running the react-apexcharts.test.js and it has the same issue.
Whenever
ReactDOM.unmountComponentAtNode(div);
is called. You get an error ' TypeError: Cannot read property 'node' of undefined'
Note:this calls 'componentWillUnmount' and eventually this.chart.destroy() in apexcharts.common.js but that's as far as I've gotten. Commenting out unmountComponentAtNode, fixes the problem.
Note: This is a show stopper for unit testing react-apexcharts and I'm assuming apexcharts, since there is no way to clean up between unit tests.
Any luck resolving this? I'm encountering the same issue when trying to test using React Testing Library
No luck. I've moved on to cypress.