繁体   English   中英

解析错误:“parserOptions.project”已为@typescript-eslint/parser 设置。 该文件与您的项目配置不匹配: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

我在 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'
    }
}

排除jest.config.js文件中的.eslintignore

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM