Cypress cucumber report json 动态输出

Cypress cucumber report json dynamic output

提问人:AZY 提问时间:11/16/2023 更新时间:11/16/2023 访问量:21

问:

我正在使用带有“@badeball/cypress-cucumber-preprocessor”的 cypress 12 我希望json cucumber reports以spec文件的名称命名。 例如:spec1.json

我尝试自定义输出以在.cypress-cucumber-preprocessorrc.json中使用filepart

{
  "stepDefinitions": [
    "cypress/definitions/*/*.{js,ts}",
    "cypress/definitions/common/*.{js,ts}",
    "cypress/definitions/[filepart]/*.{js,ts}"
  ],
  "json": {
    "enabled": true,
    "output": "cypress/cucumber-json/[filepart].json"
  }
}
  

那没有用。该文件的字面意思是 [filepart].json

该文档提供了有关 json 输出的环境变量的一些信息。https://github.com/badeball/cypress-cucumber-preprocessor/blob/master/docs/configuration.md

我尝试在运行规范之前更改输出的环境变量cypress.config.ts

    fixedOn('before:spec', (spec: Cypress.Spec) => {
        const featureName = path.basename(spec.relative, '.feature');
        config.env.jsonOutput = `cypress/cucumber-json/${featureName}.json`;
    });

这也没有用

还尝试在运行规范之前更改进程环境变量

fixedOn('before:spec', (spec: Cypress.Spec) => {
        const featureName = path.basename(spec.relative, '.feature');
        process.env['CYPRESS_jsonOutput'] = `cypress/cucumber-json/${featureName}.json`;
    });

也没用。

似乎找不到关于这个话题的任何内容

javascript cypress cypress-cucumber-preprocessor

评论


答: 暂无答案