将JestRunner与使用create-react-app创建的react应用程序集成

问题描述 投票:0回答:0

我想将Jest流运行器与用create-react-app创建的应用程序集成在一起,因为我想同时运行流类型检查和测试用例。

我遵循了Jest平台视频中给出的步骤,并添加了:-

{
  "jest": {
     "runner": "jest-runner-flowtype"
   }
}

在我的package.json但是收到了以下消息:

Out of the box, Create React App only supports overriding these Jest 
options:

 • collectCoverageFrom
 • coverageReporters
 • coverageThreshold
 • snapshotSerializers.

 These options in your package.json Jest configuration are not currently supported by Create React App:

 • runner

 If you wish to override other Jest options, you need to eject from the default setup. You can do so by running npm run eject but remember that this is a one-way operation. You may also file an issue with Create React App to discuss supporting more options out of the box.

有没有使用这两种方式jest flow runnertest runner在同一时间与笑话?

我阅读了create-react-app测试指南,但找不到添加一个跑步者的方法。

更新:

我尝试从create-react-app弹出并添加了项目选项:-

 "projects": [
    {
      "displayName": "flow",
      "runner": "jest-runner-flowtype",
      "testMatch": ["<rootDir>/**/*.js"]
    }
  ]

并尝试运行yarn jest --env=jsdom仍然没有流类型正在显示错误。

reactjs jestjs flowtype
© www.soinside.com 2019 - 2024. All rights reserved.