“ Cypress Run”的路径问题

时间:2018-11-10 10:19:42

标签: npm cypress

我在Cypress上取得了不错的进步,但是在尝试调用单个Spec时有点不高兴。

package.json中的行如下所示:

  "cypress:runST": "cypress run --spec'/cypress/integration/02_DBM_H1_ST_spec.js'",

我从npm run cypress:runST ...错误开始!

即使我尝试将其运行为:

`npm run cypress run --spec '/cypress/integration/02_DBM_H1_ST_spec.js'

我仍然遇到错误:

Can't run because no spec files were found.

We searched for any files matching this glob pattern:

'\cypress\integration\02_DBM_H1_ST_spec.js'    

和来自NPM日志:

10 silly lifecycle cypress_research@1.0.0~cypress:runST: Args: [ '/d /s /c',
10 silly lifecycle   'cypress run --spec \'/cypress/integration/02_DBM_H1_ST_spec.js\'' ]
11 silly lifecycle cypress_research@1.0.0~cypress:runST: Returned: code: 1  signal: null
12 info lifecycle cypress_research@1.0.0~cypress:runST: Failed to exec cypress:runST script

我感觉这是命令中的语法,但是如果是这种情况,它将再次运行“ bare”。.但是我遇到了同样的错误。不知道'。'规格和.js之后的来源。

有什么想法吗? 谢谢

2 个答案:

答案 0 :(得分:1)

假设package.json与cypress文件夹处于同一级别,这应该可以工作

[0, valmax]

答案 1 :(得分:0)

从Windows命令提示符,cd到cypress文件夹。然后请尝试运行如下命令:

cypress run --spec cypress/integration/02_DBM_H1_ST_spec.js

下面的屏幕快照,是从命令提示符运行我的test-spec.js的示例

enter image description here