"TypeError: (0 , _billboard.areaStep) is not a function" when testing with Jest
See original GitHub issueDescription
Hello dear billboarders.js 👋🏽
I am having trouble testing a step chart using jest and storybook. I get an error when doing a simple test for render. The error looks like so:
Error: Uncaught [TypeError: (0 , _billboard.areaStep) is not a function]
Steps to check or reproduce
My package.json contains: “jest”: “^26.5.2”, “@storybook/react”: “^6.1.9”, “webpack”: “^4.44.2”,
command would be: run jest
thanks 🌈
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Jest throws TypeError: (0 , _module.myFunction) is not a ...
So the issue was that in src/setupTest.ts I included a mock of the module without the function I was trying to test therefore...
Read more >Unit tests - Mattermost Developers
Review our guidelines for unit testing for your Mattermost webapp, including a guide on how to do component ... TypeError: (0 , \_fff.hhh)...
Read more >Globals - Jest
Runs a function after all the tests in this file have completed. If the function returns a promise or is a generator, Jest...
Read more >Jest Testing, ...is not a function - The freeCodeCamp Forum
When I run the tests, I get the type error that gameboardFactory.generateCoordinates is not a function. I'm feeling like as ever it's ...
Read more >Jest error:- TypeError: Cannot read properties of null (reading ...
this.dispatchEvent(searchEvent); near the top of the unit test won't work. You need to dispatch the event from an element.
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 FreeTop 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
Top GitHub Comments
Hello both,
Thank you for the replies. Sadly the area-step as string solution is not really an option as the bundle size would be too big for our App. In case there you have any further thoughts/ideas that could help us investigate this further, do let us know ✨
This would be an option, if you don’t care about the bundles size and importing unused types.
I had similiar problem witrh angular 6 and angular 7 extending billboard 2.x.x. I was not able to extend the prototype of ChartInternal with all the functions which are extended by the side effect in my prod build with build optimizer enabled (
"ng build --prod --build-optimizer=true"
). I was always getting error, thatbb.someChartInternalFunction
is not a function. The problem in my case was the Angular Build Optimizer, which simply can’t extend any side effects. Similiar issue was withd3-color
, as they were extending some methods as side effect. My solution was to update to Anular 8.2.x (it is the version where they also updated the@angular-devkit/build-optimizer
). Since the update I was able to use the ChartInternal functions in productive build.I never worked with jest or storybook, but perhaps it is a similar problem.