0

`1。我已经配置了 mochawesome 依赖项,现在我的 package.json 有以下内容

  • “mocha”:“^8.3.0”,“mochawesome”:“^6.2.1”,“mochawesome-merge”:“^4.2.0”,“mochawesome-report-generator”:“^5.2.0”
  1. 测试执行后,我可以使用命令将单独的 json 报告合并到一个文件夹中

“npx mochawesome-合并测试/cypress/reports/mocha/*.json > test/cypress/reports/mochareports/report.json”

  1. 现在从合并的 json 准备 html 报告,当我尝试执行以下命令时

“npx marge test/cypress/reports/mochareports/report.json --reportDir ./ --inline”

收到错误为“找不到命令:marge”

任何人都可以让我知道,我在这里到底做错了什么`

4

3 回答 3

1

使用npx mochawesome-report-generator ....而不是npx marge .... 它对我有用。

于 2021-11-09T13:06:26.970 回答
0

版本 4 带来了重大变化——它不再接受像reportDiror之类的参数rootDir。相反,它现在接受文件路径列表或 glob 模式来获取报告文件。如果您要迁移到版本 4,您可能必须相应地更改您的参数。

在此处查看解决方案:https ://github.com/Antontelesh/mochawesome-merge

于 2021-02-24T11:57:54.107 回答
0

我面临同样的问题。

ERROR: Failed to merge reports
SyntaxError: cypress/reports/output.json: Unexpected end of JSON input
    at JSON.parse (<anonymous>)
    at C:\Users\usman.allaudin\CypressAutomation\node_modules\mochawesome-merge\node_modules\jsonfile\index.js:33:18
    at C:\Users\usman.allaudin\CypressAutomation\node_modules\graceful-fs\graceful-fs.js:123:16

无需担心这一点;我有一个解决方案。 只需替换以下代码

"merge": "mochawesome-`merge cypress/reports/*.json > cypress/reports/output.json"

"mochawesome-merge cypress/reports/*.json -o cypress/reports/output.json"
于 2021-10-01T10:20:53.397 回答