为什么Cucumber-HTML-Formatter CLI抛出有效ndjson格式的Cucumber输出错误

问题描述

我正在使用cumming-js 6.0.5。我想生成一份有用的可读报告。使用带有旧版json格式器的cumming-js的输出,我使用npm软件包json-to-messages

将旧版json转换为黄瓜消息。
$> cucumber-js --format json:report/report.json
$> cat report/report.json |  ./node_modules/.bin/json-to-features -i cucumber-js > messages.ndjson
$> cat messages.ndjson |  ./node_modules/.bin/cucumber-html-formatter  --format ndjson > log_output.html
C:\Source\bdd-project\node_modules\cucumber-query\src\CucumberQuery.ts:200
           if (message.testCaseFinished.testResult.status === undefined) {
                                                   ^
TypeError: Cannot read property 'status' of null
    at CucumberQuery.update (C:\Source\bdd-project\node_modules\cucumber-query\src\CucumberQuery.ts:200:47)
    at C:\Source\bdd-project\node_modules\cucumber-html-formatter\src\cli-main.tsx:41:21
    at Array.reduce (<anonymous>)
    at C:\Source\bdd-project\node_modules\cucumber-html-formatter\src\cli-main.tsx:40:44
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:61:3)

我尝试使用npm软件包cucumber HTML Formatter cli从从json到消息生成的ndjson文件生成html。但这会引发错误“无法读取null的属性'status'”

我试图对我从黄瓜回购中获取的另一个ndjson file运行黄瓜html格式器cli。它给出了同样的错误

在这里想念的是什么?为了从黄瓜6.0.5生成HTML报告,我是否可以从Cucumber-js正确创建json输出?使用npm软件包json-to-messages cli将旧版json输出转换为黄瓜消息时,我是否正确?

如何使用cucumber HTML Formatter从ndjson文件生成html报告?

解决方法

按照here所述在全球范围内安装黄瓜html格式器后,我可以使用html格式器的全局安装成功生成html报告

$>npm install -g cucumber-html-formatter 
$>cat messages.ndjson | cucumber-html-formatter --format ndjson > log_output.html
,

我不得不切换到格式化程序的更新范围版本来解决这个问题:

$ npm i -g @cucumber/html-formatter

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...