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

255
Views
jest: _interopRequireWildcard is not defined

I'm using swc/jest instead of ts-jest and babel-jest to run my tests with jest. It works for every tests, except those that must deal with files which have wildcard imports or exports (that is to say: import * from "./myfile").

Like babel, swc/jest transforms wildcard (*) import to _interopRequireWildcard(require("./myfile")). (see swc tests). But when doing so, jest throws the following error:

ReferenceError: _interopRequireWildcard is not defined

Here is my jest config:

const path = require("path");

const resolve = (_path) => path.resolve(__dirname, _path);

module.exports = {
  testURL: "http://localhost",
  testEnvironment: "jsdom",
  snapshotSerializers: ["jest-serializer-html"],
  testPathIgnorePatterns: ["e2e/", ".*donottest.*"], 
  transform: {
    "^.+\\.(t|j)sx?$": ["@swc/jest"],
  },
  setupFiles: ["jest-canvas-mock"],
  testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
  moduleFileExtensions: ["js", "jsx", "json", "ts", "tsx", "svg"],
  globals: {
    "ts-jest": {
      tsconfig: resolve("./tsconfig.test.json"),
      diagnostics: false,
    },
  },
};

How to fix this?

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!