首页 > 解决方案 > Allure JS protractor-cucumber-framework cucumberOpts - 不止一个格式化程序

问题描述

最近,我在我的项目 allure-cucumberjs 记者中实现了。它运行良好,但我也有在测试执行期间格式化日志的包(cucumber-pretty)。现在,虽然我将 Allure 记者与 cucumber-pretty 一起提供给 cucumberOpts.format,但第二个不想工作。

我正在使用什么:

"dependencies": {
    "allure-cucumberjs": "^2.0.0-beta.6",
    "cucumber": "^6.0.5",
    "cucumber-pretty": "^6.0.0",
    "protractor": "^5.4.2",
    "protractor-cucumber-framework": "^6.2.0",
    "ts-node": "^8.5.4",
    "typescript": "^3.7.3",
  },

配置文件

 cucumberOpts: {
    compiler: 'ts:ts-node/register',
    format: [
        'json:results/results.json',
        'node_modules/cucumber-pretty',
        'reporter/reporter.ts',
        'rerun:@rerun.txt',
    ],
    require: ['../e2e/steps/*.ts', '../e2e/support/*.ts', '../support/*.ts'],
    strict: true,
    tags: '',
  }

如果我从上面的配置文件中删除“reporter/reporter.ts”,那么漂亮的插件效果很好。

这是一个错误,Allure 以某种方式覆盖并禁用其他格式化程序?或者它应该并行工作?

标签: protractorcucumberformatterallurecucumberjs

解决方案


format部分中,您可以包含多个报告器,但其中只有一个可以输出到标准输出。这是黄瓜 API 的限制。您需要将 Allure 记者指向一个虚拟文件:reporter/reporter.ts:dummy.txt.


推荐阅读