我可以把茉莉花规格报告器的输出写入文件吗

Can I write the output of jasmine-spec-reporter to file?

本文关键字:输出 文件 茉莉花 报告 我可以      更新时间:2023-09-26

我目前正在使用jasmine规范报告程序为我的Protractor测试用例创建规范报告。

终端上的输出看起来很棒!是否有任何方法可以将此输出保存到文件中,或者以某种方式使用dractor-jasmine2-screenshot-reporter创建摘要,但禁用屏幕截图?

我试着在网上寻找解决方案,但到目前为止还没有成功。

var SpecReporter = require('jasmine-spec-reporter');
jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'none'}));

https://github.com/jintoppy/protractor-html-screenshot-reporter

https://github.com/bcaudan/jasmine-spec-reporter

我目前的解决方法是使用量角器-jasmine2-screenshot-reporter来生成报告。这也会生成屏幕截图(由于正在创建的卷,所以不太实用)。

如果有人有禁用屏幕截图,甚至不允许保存.png文件的解决方案,请分享。

终端上的输出看起来很棒!有什么方法可以将此输出保存到文件中吗

这个包裹正是你想要的https://www.npmjs.com/package/jasmine-reporters.它包含几个不同的报告选项。如果您想将xml解析为html文件,可以使用https://www.npmjs.com/package/jasmine-xml2html-converter

这家伙似乎也有同样的需求:https://github.com/Kenzitron/protractor-jasmine2-html-reporter

如果需要,您可以关闭屏幕截图:

jasmine.getEnv().addReporter(new Jasmine2HtmlReporter({
   takeScreenshots: false
}));