将Jest Runner与使用create-react-app

时间:2018-08-10 10:41:09

标签: reactjs jestjs flowtype

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

我遵循了Jest platforms video中给出的步骤,并添加了:-

{
  "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 testing guide上阅读,但找不到添加一个跑步者的方法。

更新:

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

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

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

0 个答案:

没有答案