Reactjs 我可以在不弹出的情况下使用测试报告器进行Create React App Jest测试吗?

Reactjs 我可以在不弹出的情况下使用测试报告器进行Create React App Jest测试吗?,reactjs,jestjs,create-react-app,test-reporting,Reactjs,Jestjs,Create React App,Test Reporting,我想将jest测试的结果输出为类似的文件格式,而不从react脚本中弹出 通过使用--json命令,我可以将其输出到json,但我希望得到Jenkins默认可以处理的格式 我似乎找不到这是否受支持,我不想从CreateReact应用程序中弹出,还有其他方法吗?您不需要做任何花哨的事情。只需安装jest-junit,然后使用附加的reporters标志运行: yarn test --reporters=jest-junit 您还可以将其添加到。可能是这样的: { "name": "your-

我想将jest测试的结果输出为类似的文件格式,而不从react脚本中弹出

通过使用
--json
命令,我可以将其输出到json,但我希望得到Jenkins默认可以处理的格式


我似乎找不到这是否受支持,我不想从CreateReact应用程序中弹出,还有其他方法吗?

您不需要做任何花哨的事情。只需安装
jest-junit
,然后使用附加的
reporters
标志运行:

yarn test --reporters=jest-junit
您还可以将其添加到。可能是这样的:

{
  "name": "your-package",
  "jest": {
    "coverageReporters": ["jest-junit"]
  }
}

你不需要做任何花哨的事。只需安装
jest-junit
,然后使用附加的
reporters
标志运行:

yarn test --reporters=jest-junit
您还可以将其添加到。可能是这样的:

{
  "name": "your-package",
  "jest": {
    "coverageReporters": ["jest-junit"]
  }
}

谢谢,cli选项
--reporters=jest-junit
起作用,因为这不是
包的
coverageReporter
。json
更改不起作用,并且
reporters
键在Create React App
npm测试中无效--reporters=jest-junit
是npm版本。谢谢,cli选项
--reporters=jest-junit
有效,因为这不是
coverageReporter
包。json更改无效,并且
reporters
键在Create-React-App
npm测试中无效--reporters=jest-junit
是npm版本。