Jest setup “SyntaxError: Unexpected token export”

If none of the other solutions worked for you, you can try this in your jest

"moduleNameMapper": {
    "^lodash-es$": "lodash"
}

It will replace lodash-es with the commonjs version during testing runtime.

Leave a Comment