一个 angular 15 项目升级到 angular 17 后,运行 npm run test
时出现下面的错误
ReferenceError: You are trying to `import` a file after the Jest environment has been torn down.
请问如何解决?
是下面的错误引起的
Must use import to load ES Module: node_modules\@angular\core\fesm2022\core.mjs
at Runtime.requireModule (node_modules/jest-runtime/build/index.js:850:21)
at node_modules/ngx-monaco-editor/bundles/ngx-monaco-editor.umd.js:2:85
at Object.<anonymous> (node_modules/ngx-monaco-editor/bundles/ngx-monaco-editor.umd.js:5:2)
参考链接 https://www.trustingeeks.com/error/jest-env-torn-down/
– dudu 8个月前https://github.com/thymikee/jest-preset-angular/issues/1222
– dudu 7个月前