admin管理员组文章数量:1435249
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 withexport ... 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.
本文标签: javascriptJest failing because of importexport syntaxStack Overflow
版权声明:本文标题:javascript - Jest failing because of importexport syntax - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745619684a2666608.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论