如何在每次运行柏树之前删除报告文件夹?

发布于 2025-02-12 15:12:20 字数 111 浏览 0 评论 0原文

我将Cucumber HTML报告存储在Cucumber-HTML-Reports文件夹中,JSON文件存储在Cucumber-JSON文件夹下。现在,我要删除/清空这两个文件夹。我需要插入才能实现这一目标。

I am storing my cucumber html report under cucumber-html-reports folder and json files are storing under cucumber-json folder. Now I want delete/empty these two folders. I need a plug in to achieve this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

各自安好 2025-02-19 15:12:20

正确的方法是添加一个NPM脚本来清理报告文件夹并在测试运行之前执行它。为此,赛普拉斯在其网站上有一个示例NPM脚本。 https://docs.cypress.io/guides/guides/guides/guides/guides/tooling/tooling/tooling/reporters# Command-Line-3

通常,CI/CD管道将在测试运行开始之前运行清理脚本。另外,您可以在插件文件中添加一点代码,以在测试运行之前执行NPM脚本。

一种hacky选项,在Cypress Config中有一个trashassetsbeforeruns选项(默认设置为true)。它用于在测试运行之前清理下载,视频和屏幕截图文件夹。如果将记者结果映射到可能有效的这些目录之一,尽管我不能保证成功的成功,因为我还没有这样做。

The correct way to do this is to add an npm script to clean up the report folder and execute it before the test run. Cypress has an example npm script on their website for this. https://docs.cypress.io/guides/tooling/reporters#Command-line-3

Usually, the CI/CD pipeline would run the clean up script before the test run kicks off. Alternatively, you could add a little bit of code to your plugins file to exec the npm script before the test run as well.

One sort of hacky option, there is a trashAssetsBeforeRuns option in the Cypress config (set to true by default). It's used to clean up the downloads, videos, and screenshots folders before a test run. If you map your reporter results to one of these directories that might work, although I can't guarantee success with it since I haven't done that.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文