Home Forums Chart Support How can I Unit Test components that use CanvasJS?

How can I Unit Test components that use CanvasJS?

Viewing 2 posts - 1 through 2 (of 2 total)
  • #27759

    I am using CanvasJS to display charts in an Angular app. The charts display properly when running my app, so I know CanvasJS is a part of the project and is working. However, Jest can’t find CanvasJS when unit testing, here’s the error:

    import Charts from ‘../core/charts’;
    ^^^^^^

    SyntaxError: Unexpected identifier

    1 | import { Component, OnInit } from ‘@angular/core’;
    > 2 | import * as CanvasJS from ‘canvasjs’;
    | ^
    3 |

    Any idea what a solution could be for this?

    #27790

    @user12947.

    Can you kindly create a sample project reproducing the issue and share it over Google-Drive or Onedrive along with sample data so that we can look into the code, run it locally to understand the scenario better and help you resolve?

    From what we have observed, sometimes things get delayed mostly when we are not able to reproduce the issue or not able to understand the exact requirements or the solution that we provide may not work properly due to the variation in chart-options being used by you and us.

    Having a sample project helps us in figuring out the issue and suggesting an appropriate solution accordingly.


    Shashi Ranjan
    Team CanvasJS

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.