简体   繁体   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

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.

相关问题 解析错误:已为 @typescript-eslint/parser 设置“parserOptions.project”。 该文件与您的项目配置不匹配:.eslintrc.js - Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser. The file does not match your project config: .eslintrc.js 解析错误:“parserOptions.project”已为 @typescript-eslint/parser 设置为 gatsby/typescript - Parsing error: "parserOptions.project" has been set for @typescript-eslint/parser for gatsby/typescript (ESLint/赛普拉斯): 解析错误: ESLint 被配置为在 ` 上运行<tsconfigrootdir> /component/TestComponent.cy.ts` 使用 `parserOptions.project`</tsconfigrootdir> - (ESLint/Cypress): Parsing error: ESLint was configured to run on `<tsconfigRootDir>/component/TestComponent.cy.ts` using `parserOptions.project` 在 TypeScript 中使用 NextJS 设置 Jest + React 测试库 — 设置 upp jest.config.js 时出错 - Setup Jest + React testing library using NextJS in TypeScript — error setting upp jest.config.js jest.config.js 中的`moduleNameMapper` 设置不适用于 CircleCI - `moduleNameMapper` settings in jest.config.js doesn't work on CircleCI 如何在 create-react-app 中使用 jest.config.js - How to use jest.config.js with create-react-app jest.config.js 失败 - 意外的标记“。” 在 module.exports 中 - jest.config.js fails - unexpected token '.' in module.exports 无法加载在 'package.json » eslint-config-react-app#overrides[0]' 中声明的解析器 '@typescript-eslint/parser':找不到模块 'typescript' - Failed to load parser '@typescript-eslint/parser' declared in 'package.json » eslint-config-react-app#overrides[0]': Cannot find module 'typescript' 带有 Mono Repo 的 react-scripts 的无效 testPattern --config=jest.config.js - Invalid testPattern --config=jest.config.js with react-scripts with Mono Repo 如何覆盖 setupFiles (jest.config.js) 中定义的 jest.mock - How to override jest.mock defined in a setupFiles (jest.config.js)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM