【问题标题】:cypress-cucumber-preprocessor - not logging to messages.jsoncypress-cucumber-preprocessor - 不记录到messages.json
【发布时间】:2022-11-10 22:09:05
【问题描述】:

我已经将 Cypress 与 Cucumber 一起使用了一段时间,不知何故,它已停止将除“testRunStarted”和“testRunFinished”之外的任何内容记录到messages.ndjson。

这是我的 .cypress-cucumber-preprocessorrc.json:

{
  "json": {
    "enabled": true,
    "output": "cypress/cucumber-json/cucumber-json.json",
    "formatter": "cucumber-json-formatter"
  },
  "html": {
    "enabled": true,
    "output": "cypress/cucumber-html/cucumber-html.html"
  },
  "messages": {
    "enabled": true,
    "output": "cypress/messages.ndjson"
  },
  "nonGlobalStepDefinitions": true,
  "stepDefinitions": [
    "cypress/e2e/features/*.js",
    "cypress/support/step_definitions/**/*.js"
  ]
}

我已经在调试的情况下运行了 cypress,并确认它正在选择正确的配置,并且它正在将开始和结束写入消息,但没有别的。

{"testRunStarted":{"timestamp":{"seconds":1664439067,"nanos":940000000}}}
{"testRunFinished":{"timestamp":{"seconds":1664439137,"nanos":63000000}}}

完全被这个难住了!

【问题讨论】:

    标签: javascript node.js cucumber cypress cypress-cucumber-preprocessor


    【解决方案1】:

    我有一个问题:您的步骤定义放在哪里?它是在您的功能文件所在的同一文件夹中还是在支持文件夹中找到?无论它出现在哪里,只需在.cypress-cucumber-preprocessorrc.json 中的step_definitions 中使用该路径即可。

    我还发现在你的.cypress-cucumber-preprocessorrc.json 中你提到的step_definitions 功能文件的扩展名*.js 这是错误的,因为功能文件应该有扩展名.feature 所以如果你的步骤定义在你的.cypress-cucumber-preprocessorrc.json 应该看起来像这样support 文件夹

    {
      "json": {
        "enabled": true,
        "output": "cypress/cucumber-json/cucumber-json.json",
        "formatter": "cucumber-json-formatter"
      },
      "html": {
        "enabled": true,
        "output": "cypress/cucumber-html/cucumber-html.html"
      },
      "messages": {
        "enabled": true,
        "output": "cypress/messages.ndjson"
      },
      "nonGlobalStepDefinitions": true,
      "stepDefinitions":
        "cypress/support/step_definitions/**/*{.js,.mjs}"
    }
    

    希望你能得到你的结果。

    【讨论】:

      猜你喜欢
      • 2023-02-02
      • 2023-01-31
      • 2022-09-30
      • 2022-06-28
      • 1970-01-01
      • 1970-01-01
      • 2019-09-30
      • 2023-02-21
      • 2022-11-20
      相关资源
      最近更新 更多