【问题标题】:Cypress mochawesome Reporting :Getting error as 'command not found: marge', while executing the command to generate HTML reportCypress mochawesome 报告:在执行生成 HTML 报告的命令时​​出现“找不到命令:marge”错误
【发布时间】:2021-05-21 15:57:14
【问题描述】:

`1.我已经配置了 mochawesome 依赖项,现在我的 package.json 有了 关注

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

“npx mochawesome-merge Test/cypress/reports/mocha/*.json > test/cypress/reports/mochareports/report.json”

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

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

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

谁能告诉我,我到底做错了什么`

【问题讨论】:

    标签: cypress mochawesome


    【解决方案1】:

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

    【讨论】:

      【解决方案2】:

      我遇到了同样的问题。

      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"
      

      【讨论】:

        【解决方案3】:

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

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

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2022-01-03
          • 1970-01-01
          • 2021-10-06
          • 1970-01-01
          • 1970-01-01
          • 2021-07-20
          相关资源
          最近更新 更多