我在tsconfig.app.json中有这样的路径设置:
"paths": {
"@app/core": ["./src/app/core"]
}
每当我运行一个带有相对路径的import语句的测试时,我都会得到以下错误:
Cannot find module '@app/core' or its corresponding type declarations
import {NotificationService} from "@app/core"
我如何配置我的jest.config.js文件来解决这个问题?
我已经尝试设置为
moduleNameMapper: {
"@app/core": "<rootDir>/src/app/core"
}
这是因为它是tsconfig
,而不是tsConfig
,这将被忽略。