是否有 html 记者与 jest-cucumber 一起使用,它显示报告中的所有 Gherkin 注释

Is there a html reporter to use with jest-cucumber which shows all the Gherkin annotations on report

我已经开始使用 jest-cucumber (https://github.com/bencompton/jest-cucumber) 来自动化我的 ReactJS 应用程序。

我已经用框架尝试了这些记者:https://github.com/jest-community/awesome-jest#reporters 但我无法在报告中看到小黄瓜步骤。 所有报告都显示测试用例级别的详细信息。

我尝试使用 cucumber-html-reporter https://www.npmjs.com/package/cucumber-html-reporter 但无法将它与 jest-cucumber 一起使用。

你能推荐任何好的库,它可以逐步报告 Gherkin 注释,看起来像 https://www.npmjs.com/package/cucumber-html-reporter

我在 cucumber-html-reporter 和 jest-cucumber 版本 2.0.12 上使用了它。请查看 jest-cucumber 的第 27 期:https://github.com/bencompton/jest-cucumber/issues/27.

要遵循的步骤:

1) 安装支持报告的 v2.0.12 版本的 jest-cucumber。在这篇文章中,这个版本不是 npm 的稳定版本。安装这个的时候需要特别给版本号

2) 在jest config中添加以下参数指定报告存储位置。 jest-cucumber 输出一个 json 文件。

reporters: [ "default", [ "./node_modules/jest-cucumber/dist/src/reporter", //This is the default path { formatter: "json", path: "./tests/integration-test-results/test-report.json" //specific path } ] ]

3) 为 cucumber-html-report conf 创建一个 index.js 文件,并在 html 文件需要时提及上面创建的 json 文件和输出的位置将被置于。更多信息,请参考:https://www.npmjs.com/package/cucumber-html-reporter

4) 创建如下所示的 package.json 命令以便于使用,以便在 BDD 测试完成后自动生成并显示报告。

"test-bdd": "jest --config=jest-cucumber.config.js && node ./cucumber-report-config.js"

5) 运行: npm run test-bdd