0

我正在使用 Cypress 和 Cucumber 预处理器,目前我们将所有功能文件放在一个功能文件夹中,例如:

特征/testcase1.feature

由于那里有很多文件,我们希望结构更清晰,因此我们尝试将一些功能文件分组到子文件夹中:

features/HOME/testcase1.feature, features/HOME/testcase2.feature, features/LOGIN/testcase3.feature

等等

没关系,它在测试运行器中运行良好,因为它也可以识别子文件夹中的文件。

但是我在设置package.json中所有功能文件的路径时遇到问题:

  "scripts": {
    "test": "node_modules\\.bin\\cypress run --spec \"cypress/integration/features/*.feature\"",
    "head": "npm run test -- --headed",
    "chrome": "npm run test -- --browser chrome",
  },

因为此路径 cypress/integration/features/*.feature 将在主功能文件夹中查找,而不是在子文件夹中。

有没有办法定义一个路径来检查子文件夹中的所有功能文件?

就像是:cypress/integration/features/(*.)/*.feature

但这个解决方案不起作用。

4

1 回答 1

0

好的,解决方案非常简单:)

只需使用 2 个星号而不是 (*.):

cypress/integration/features/**/*.feature
于 2021-06-23T08:12:14.100 回答