"Cypress Run" 的路径问题

Path Issues for "Cypress Run"

我在使用 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_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'..但我得到了同样的错误。不知道 '\' afer 规范和 .js 之后的来源。

有什么想法吗? 谢谢

从 windows 命令提示符,cd 到 cypress 文件夹。那么请尝试 运行ning 如下命令;

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

下面的截图,参考了我在命令提示符下的测试示例-spec.js 运行

假设 package.json 与 cypress 文件夹处于同一级别,这应该有效

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