Jest: TypeError: Cannot read property 'fantasy-land/map'
See original GitHub issueI’m testing a React app with Jest and when some code hits a R.map()
function, i get the following error:
TypeError: Cannot read property 'fantasy-land/map' of undefined
at node_modules/ramda/src/internal/_dispatchable.js:29:23
at Object.f2 [as map] (node_modules/ramda/src/internal/_curry2.js:25:16)
Looks related to the fantasy-land inclusion. Gotta say i don’t know how this can be fixed.
Ramda 0.24.1
Jest 20.0.4
If i comment the lines using those R.map()
functions, error goes away.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:12
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Cannot read property 'fantasy-land/map' of undefined Dash ...
Short answer. Dash's DataTable needs to be initialized with empty rows to work properly. dt.DataTable(id='my-datatable', rows=[{}]).
Read more >ramda/ramda
fantasy -land is a spec for FP-friendly types in JS. A fantasy-land compliant functor is ... TypeError: Cannot read property 'fantasy-land/map' of undefined...
Read more >React - Cannot read property 'map' of undefined - debuggr.io
map and returning a react element for each item. But we wont see anything on the screen, well except the error: TypeError: Cannot...
Read more >Cannot read property 'fantasy-land/map' of undefined Dash ...
Coding example for the question Cannot read property 'fantasy-land/map' of undefined Dash DataTable Updating table with dropdowns-Reactjs.
Read more >rambdax/README.md
209, - Rambda's **map**, **filter**, **partition** when they iterate over objects, ... 3965, throw new Error(`Cannot read property 'indexOf' of ${list}`).
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
Ramda has long taken a stand against hand-holding, assuming users would pass the correct types to its functions, and not checking this unless necessary. While I think that sentiment is slowly shifting, it’s not at all clear to me that Ramda is ready for that sort of argument validation.
There’s nowhere near enough context to offer any help here. I suspect that an undefined value is being passed as the second arg to map. But that is just a guess.