ReferenceError: ResizeObserver is not defined

I am writing tests using Jest for component which used chart.js to create a line chart. I am getting below error when I am running the tests. ReferenceError: ResizeObserver is not defined 290 | } 291 | ngAfterViewInit() { > 292 | this.chart = new Chart(this.chartRef.nativeElement, this.chartConfig); | ^ 293 | } 294 | 295 […]

By Kuldeep Tiwari
Published
Categorized as angular, jestjs Tagged ,

Angular 11 Unit test for chart.js: Error: Not implemented: HTMLCanvasElement.prototype.getContext (without installing the canvas npm package)

I am writing tests using Jest for components which uses chart.js to create a line chart. My chart is working totally fine but I am not able to write tests as I am getting the below error: console.error Error: Not implemented: HTMLCanvasElement.prototype.getContext (without installing the canvas npm package) at module.exports (D:chartsnode_modulesjsdomlibjsdombrowsernot-implemented.js:9:17) Does anyone know how […]

By Kuldeep Tiwari
Published
Categorized as angular, chart.js, jestjs, unit-testing Tagged , , ,

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq