Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test cases failing: ReferenceError: AmCharts is not defined #88

Open
vikramgupta1988 opened this issue Dec 19, 2018 · 1 comment
Open

Comments

@vikramgupta1988
Copy link

While running testcases using Jest and Enzyme. I get an error like below.

ReferenceError: AmCharts is not defined at node_modules/@amcharts/amcharts3-react/amcharts3-react.js:253:3 at Object.<anonymous> (node_modules/@amcharts/amcharts3-react/amcharts3-react.js:298:3) at Object.<anonymous> (node_modules/@amcharts/amcharts3-react/index.js:6:3)

The AmCharts are imported in my project like below
import AmCharts from '@amcharts/amcharts3-react'

I found a solution that is to be added to amcharts-react plugin at line 252.
var AmCharts = AmCharts || {};
This is solving the issue. Can I create a PR for this?

Or alternatively can we ignore the import while running the test case?

@darlesson
Copy link

I would recommend the use of setupFiles to inject amCharts files to the environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants