首页 > 解决方案 > 如何修复黄瓜 4.1.0 gem 中的警告格式 JSON 弃用?

问题描述

我最近更新到最新的 Ruby cucumber gem,现在收到以下警告:

WARNING: --format=json is deprecated and will be removed after version 5.0.0.
Please use --format=message and stand-alone json-formatter.
json-formatter homepage: https://github.com/cucumber/cucumber/tree/master/json-formatter#cucumber-json-formatter.

稍后我将使用 json 输出进行报告。在我的cucumber.yml我有以下默认配置文件:

default:
  -r features
  --expand -f pretty --color
  -f json -o reports/cucumber.json

根据参考https://github.com/cucumber/cucumber/tree/master/json-formatter#cucumber-json-formatter他们说要使用类似的东西

cucumber --format protobuf:cucumber-messages.bin
cat cucumber-messages.bin | cucumber-json-formatter > cucumber-results.json

Trying it out
../fake-cucumber/javascript/bin/fake-cucumber \
--results=random \
../gherkin/testdata/good/*.feature \ | 
go/dist/json-formatter-darwin-amd64

但目前还不清楚如何做到这一点。

标签: jsonrubycucumberreporting

解决方案


我猜您需要更改您的黄瓜配置文件以生成 protobuf 输出而不是 json,然后添加一个步骤将文件后处理为您想要的 json?

我假设上面的“试用”是您实际试用的输出,而不仅仅是从格式化程序的 Github 页面直接剪切和粘贴......


推荐阅读