Run test with jest "Cannot find module 'ng2-charts'"
See original GitHub issueI cannot execute my jest tests with the newest version 3.0.1. I get following error:
Cannot find module 'ng2-charts' from 'src/app/pages/text.component.ts'
Require stack:
src/app/pages/test-chart.component.ts
src/app/pages/test.component.ts
src/app/pages/test.spec.ts
> 7 | import { BaseChartDirective } from "ng2-charts";
| ^
at Resolver.resolveModule (node_modules/jest-resolve/build/resolver.js:322:11)
at Object.<anonymous> (src/app/pages/devices/device-detail/dialog-chart/dialog-chart.component.ts:7:1)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Jest test error with chartjs (ng2-charts) on Angular
Jest shows me a "TypeError: import_chart.registerables is not iterable" error during the test of a component that uses ng2-charts :
Read more >cannot find module '@angular/core/testing' from ... - You.com
After upgrading from Angular 10 -> Angular 14, I am unable to run tests using Jest, with the common message being. Cannot find...
Read more >Angular jest test bpmnModeler error - Modeler - Forum - bpmn.io
I am trying to run a jest test(which renders a bpmn diagram) and I am using angular 11. Though i am getting TypeError...
Read more >ng2-charts | Yarn - Package Manager
ng2 -charts doesn't work with newly created angular 10 project #1268 ; Error: getInternalNameOfClass() called on a non-ES5 class #1264 ; export 'defineInjectable' ......
Read more >[Solved]-Cannot find module 'chart.js' - appsloveworld
With the way the typings were defined for chartjs, you don't need to import it. It is in the global space, so you...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I copied as much as I could configuration-wise from my site, and then used the demo (https://valor-software.com/ng2-charts/#LineChart) for the UI/logic to ensure it wasn’t an issue with that.
Just running the tests via
npm run test
will show the issue asRepo with minimal project: https://github.com/btvanhooser/ng2-charts-issue
Can you share a minimum reproduction project?