Jestjs 在createreact应用程序项目中,使用jestjunit测试覆盖率失败

Jestjs 在createreact应用程序项目中,使用jestjunit测试覆盖率失败,jestjs,create-react-app,Jestjs,Create React App,在创建react应用程序/react中-scripts@2.1.1项目,我正在尝试使用生成覆盖率报告。不幸的是,它在以下方面失败: $ yarn run test --coverage Failed to write coverage reports: ERROR: Error: Invalid report format [jest-junit] STACK: Error: Invalid report format [jest-junit] at Ob

在创建react应用程序/react中-scripts@2.1.1项目,我正在尝试使用生成覆盖率报告。不幸的是,它在以下方面失败:

$ yarn run test --coverage
      Failed to write coverage reports:
      ERROR: Error: Invalid report format [jest-junit]
      STACK: Error: Invalid report format [jest-junit]
  at Object.module.exports.create (D:\Users\username\Documents\Project\node_modules\istanbul-api\lib\input-error.js:6:15)
  at Reporter.add (D:\Users\username\Documents\Project\node_modules\istanbul-api\lib\reporter.js:51:30)
  at D:\Users\username\Documents\Project\node_modules\istanbul-api\lib\reporter.js:62:18
  at Array.forEach (<anonymous>)
  at Reporter.addAll (D:\Users\username\Documents\Project\node_modules\istanbul-api\lib\reporter.js:61:14)
  at D:\Users\username\Documents\Project\node_modules\jest-cli\build\reporters\coverage_reporter.js:180:18
  at Generator.next (<anonymous>)
  at step (D:\Users\username\Documents\Project\node_modules\jest-cli\build\reporters\coverage_reporter.js:75:30)
  at D:\Users\username\Documents\Project\node_modules\jest-cli\build\reporters\coverage_reporter.js:86:15
  at process._tickCallback (internal/process/next_tick.js:68:7)

是否有人在create react中成功配置了jest junit-app@2项目?

感谢@jornsharpe的快速评论。我没有足够的注意。。。我的错误是把jest junit丢给报道员(而不是记者)

不幸的是,我们必须做出反应-app@2似乎不支持package.json中的自定义报告器配置。有趣的是,以下命令起作用:

$ yarn run test --coverage --reporters=default --reporters=jest-junit

我习惯于创建react应用程序的大多数配置,覆盖任何明确定义的选项。然而,
纱线运行测试
似乎存在异常(或漏洞?)。通过上面的内容,我得到了所需的junit.xml文件。

您的配置似乎与jest junit页面上显示的不匹配,为什么您会偏离这个方向?@twinlakes重复是什么意思?最后,我没有向
package.json
添加任何内容。我只是在test命令中添加了
--reporters
参数,这是因为jest将生成两种类型的报告:default和jest junit
$ yarn run test --coverage --reporters=default --reporters=jest-junit