Estoy usando swc/jest en lugar de ts-jest y babel-jest para ejecutar mis pruebas con jest . Funciona para todas las pruebas, excepto aquellas que deben tratar con archivos que tienen importaciones o exportaciones de comodines (es decir: import * from "./myfile" ).
Al igual que babel , swc/jest transforma la importación de comodín ( * ) en _interopRequireWildcard(require("./myfile")) . (ver pruebas swc ). Pero al hacerlo, jest arroja el siguiente error:
ReferenceError: _interopRequireWildcard no está definido
Aquí está mi configuración de broma:
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, }, }, };¿Cómo arreglar esto?