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.

Running Jest tests I got "The body of the arrow function supplied to `idx` must be a single expression"

See original GitHub issue
The body of the arrow function supplied to `idx` must be a single expression (without curly braces).
        36 |            })
        37 |                    .then(res => {
      > 38 |                            const similarItems = idx(res, _ => _.data.similarDeals) || [];
           |                                                               ^
        39 |                            if (similarItems.length) {
        40 | 
        41 |                                    const converted = similarItems.map(item => {

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

4reactions
jsdariocommented, Jun 11, 2017

Is there anyway to work this around? I had the issue above a long time running, I thought to maybe implement a function identical to idx locally rather using the babel plugin.

1reaction
yungsterscommented, May 26, 2017

Interesting! I wonder if a coverage plugin is injecting extra AST nodes into the arrow function.

Thanks for that insight. I’ll need to brainstorm with @cpojer about how to best proceed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Jest error running a file with idx operator - react native
The body of the arrow function supplied to `idx` must be a single expression (without curly braces). We make use of yarn and...
Read more >
ES6 Class Mocks - Jest
If you use arrow functions in your classes, they will not be part of the mock. The reason for that is that arrow...
Read more >
Fullstack React - dashboard
for running React apps), writing automated unit tests, and building a ... write a function body that is only a single line (or...
Read more >
Groovy Language Documentation
Usage of generic classes and methods, regardless of whether they are defined in Java or Groovy, may involve supplying a type argument.
Read more >
Exploring Array Some in JavaScript - Ultimate Courses
If one element passes then Array Some returns true . ... Inside the body of the function we need to return an expression...
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