Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jest - ReferenceError: SVGPathElement is not defined

I'm trying to run a Jest unit test to match snapshot, but there seems to be an issue with am4core. Does anyone have any idea how to solve it?

Test: Test

Error: Error

Thank you

like image 217
gabrielcon6 Avatar asked Dec 07 '25 04:12

gabrielcon6


1 Answers

SVGPathElement doesn’t exist on the node. It exists on the browser. Hence add this test

class SVGPathElement extends HTMLElement {}
window.SVGPathElement = SVGPathElement

describe('your test', () => {
like image 50
Sachila Ranawaka Avatar answered Dec 10 '25 01:12

Sachila Ranawaka



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!