react-apexcharts icon indicating copy to clipboard operation
react-apexcharts copied to clipboard

Cannot call react testing library cleanup() function when rendering apex-charts

Open rodpatulski opened this issue 3 years ago • 3 comments

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.

rodpatulski avatar Aug 25 '22 20:08 rodpatulski

Update: The same thing happens even after calling cleanup(); at the end of a test.

rodpatulski avatar Sep 29 '22 01:09 rodpatulski

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.

rodpatulski avatar Sep 29 '22 03:09 rodpatulski

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.

rodpatulski avatar Sep 30 '22 04:09 rodpatulski

Any luck resolving this? I'm encountering the same issue when trying to test using React Testing Library

nt294 avatar Oct 18 '22 15:10 nt294

No luck. I've moved on to cypress.

rodpatulski avatar Oct 20 '22 05:10 rodpatulski