遵循教程中提到的以下步骤: https ://dev.to/bushralalam/using-mochawesome-reporter-with-cypress-54pf
- 通过 npm 安装必要的包
- 添加了前置和后置脚本以及合并和生成报告
- 运行测试脚本并能够看到在“rm -R -f cypress/reports && mkdir cypress/reports && mkdir cypress/reports/mocha”中创建的文件夹
- 但无法为脚本生成报告 -
命令:“combine_reports”:“mochawesome-merge ./cypress/reports/mocha/*.json > cypress/reports/mochareports/report.json”,“generate_report”:“marge cypress/reports/mochareports/report.json -f报告 -o cypress/reports/mochareports", "post_test": "npm run combine_reports && npm run generate_report",
解决方案: “cypress run -r cypress-multi-reporters test_script --reporter mochawesome” - 为所有测试套件生成正确的 .json 文件