question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"TypeError: (0 , _billboard.areaStep) is not a function" when testing with Jest

See original GitHub issue

Description

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:open
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
programmianacommented, Dec 10, 2020

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 ✨

1reaction
michkamicommented, Dec 5, 2020

A simple solution is to change areaStep to area-step of string

I think it’s a part I need to think a little more about

    types: {
          allocatedAmount: "area-step",
          freeAmount: "area-step",
        }

This part of the code referenced https://github.com/naver/billboard.js/blob/master/types/bb.d.ts

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, that bb.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 with d3-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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found