You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

测试用例失败且includeFailureMsg=true时jest-html-reporter无法生成报告

Fix: jest-html-reporter v2.3.0 Fails to Generate Report With Failed Tests & includeFailureMsg=true

I've dealt with this exact bug in jest-html-reporter v2.3.0 before—here's what's going on and how to fix it:

The Root Cause

Version 2.3.0 has a known issue where enabling includeFailureMsg: true alongside failed test cases causes the reporter to crash mid-execution, resulting in no HTML report being generated at all.


This bug was fixed in later releases of jest-html-reporter. Upgrading to the latest version will resolve the issue without any configuration changes. Run this command in your project:

npm install jest-html-reporter@latest --save-dev

Once upgraded, your existing setup (with includeFailureMsg: true) will generate the test report correctly, even when tests fail.

Solution 2: Temporary Workaround (If You Can't Upgrade)

If you're stuck on v2.3.0 for dependency reasons, you can disable the includeFailureMsg option to get the report working again:

"jest-html-reporter": {
  "pageTitle": "Your test suite",
  "outputPath": "test-report.html",
  "includeFailureMsg": false // Disable this temporarily
}

This will let the report generate, though you'll lose the detailed failure messages in the output.

Quick Configuration Sanity Check

Just to rule out other issues: confirm your testResultsProcessor path in the jest config is correct. Your current path "./node_modules/jest-html-reporter" is valid, and since it works when tests pass, this isn't the problem—but it's always good to double-check for typos!


内容的提问来源于stack exchange,提问作者DevArti

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.25 06:37:53