在我的 angular10 项目中运行玩笑测试时出现此错误:
SyntaxError: Unexpected token 'export'
我尝试了各种在线指南,这在我的笑话配置中:
transformIgnorePatterns: [
"<rootDir>/node_modules/(?!@citi-icg-172888/ng-mito)/"
],
transform: {
'^.+\\.(ts|js|html)$': 'ts-jest',
},
(单独和一起尝试了这两个道具)
我知道这是由于特定的依赖关系,它发生在每个导入它的组件中。这是导致错误的代码:
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){export * from './accordion';
依赖项工作正常并作为项目的一部分编译,问题仅出现在 Jest 测试中