Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

157
Views
Unexpected token 'export' Jest (react-extras)

I am testing some React components and using Jest I found an unexpected problem for import 'react-extras'. I tried to solve using transformIgnorePatterns in my Jest config file, but it didn't solve the problem.

I've seen related issues but none of them ended up helping me.

Note: react-extras is exported as module

Related issues:

  • https://github.com/sindresorhus/react-extras/issues/16
  • https://github.com/facebook/jest/issues/12824

Jest output:

Details:

C:\Users\allan\teste-tecnico-brainn\node_modules\react-extras\dist\index.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){export { default as autoBind 
} from 'auto-bind/react';

SyntaxError: Unexpected token 'export'

1 | import { ChangeEvent, useContext, useEffect, useState } from 'react'
> 2 | import { For } from 'react-extras'
| ^

My Jest config file (as JSON):

{
  "moduleNameMapper": {
    "~/(.*)": "<rootDir>/src/$1"
  },
  "transformIgnorePatterns": [
    "/node_modules/(?!(react-extras)/)"
  ],
  "setupFilesAfterEnv": [
    "@testing-library/jest-dom/extend-expect"
  ],
  "testMatch": [
    "**/?(*.)spec.ts?(x)",
    "**/?(*.)test.ts?(x)"
  ],
  "globals": {
    "ts-jest": {
      "tsconfig": "tsconfig.json",
      "diagnostics": false
    }
  },
  "testEnvironment": "jsdom",
  "preset": "ts-jest"
}

You can see my repository clicking here.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!