[英]Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. The file does not match your project config: jest.config.js
I created a modularization of the paths in ts.config, however, when I added moduleNameMapper to jest.config.js it returned the error:我在 ts.config 中创建了路径的模块化,但是,当我将 moduleNameMapper 添加到 jest.config.js 时,它返回了错误:
Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser.
The file does not match your project config: jest.config.js.
The file must be included in at least one of the projects provided.
.tsconfig.js
{
"compilerOptions": {
...
"paths": {
"@/*": ["*"]
}
...
}
}
jest.config.js
module.exports = {
roots: ['<rootDir>/src'],
collectCoverageFrom: [
'<rootDir>/src/**/*.{ts, tsx}'
],
coverageDirectory: 'coverage',
testEnvironment: 'node',
transform: {
'.+\\.tsx$': 'ts-jest',
'.+\\.ts?$': 'ts-jest'
},
moduleNameMapper: {
'@/(.*)': '<rootDir>/src/$1'
}
}
Exclude jest.config.js
in the .eslintignore
file排除
jest.config.js
文件中的.eslintignore
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.