javascript - Jest failing because of importexport syntax - Stack Overflow

One of the files under test is importing the estree-util-to-js library, which causes Jest to exit with

One of the files under test is importing the estree-util-to-js library, which causes Jest to exit with an error:

Details:

    /.../node_modules/estree-util-to-js/index.js:8
    export { toJs } from './lib/index.js';
    ^^^^^^

    SyntaxError: Unexpected token 'export'

Curiously, I already fixed this problem once. That's why I have in my jest.config.json file the following:

{
  "preset": "ts-jest",
  "roots": ["src"],
  "testEnvironment": "jsdom",
  "transform": {
    "^.+\\.tsx?$": [
      "ts-jest",
      {
        "diagnostics": false
      }
    ],
    "^.+/estree-util-to-js/.+\\.js$": [
      "ts-jest",
      {
        "diagnostics": false
      }
    ]
  },
  "transformIgnorePatterns": ["<rootDir>/node_modules/(?!estree-util-to-js)"]
}

This worked just fine until today I upgraded lots of dependencies, after which this stopped working.

What I have managed to rule out so far:

  • estree-util-to-js was not upgraded.
  • The error also happens with plain import ...; export ... syntax, not just with export ... from;
  • Rolled back upgrade of ts-jest (29.1.2 -> 29.2.5). Didn't help.
  • No upgrade of jest itself was done.
  • Rolling back all of my package upgrades does fix the problem.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745619684a4636443.html

相关推荐

  • javascript - Jest failing because of importexport syntax - Stack Overflow

    One of the files under test is importing the estree-util-to-js library, which causes Jest to exit with

    15小时前
    50

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信