为什么用cypress运行特定目录的测试对我来说是错误的? [英] Why is it wrong for me to run the tests of a specific directory with cypress?
问题描述
我正在尝试使用cypress命令在目录中运行一些特定的测试,我尝试执行的命令是:
I am trying to run some specific tests within a directory, using cypress the command that I try to execute is:
node_modules\.bin\cypress run --spec 'cypress\integration\tests\default.spec.js'
我也尝试过:
node_modules\.bin\cypress run --spec 'cypress\integration\tests\*.spec.js'
或者:
node_modules\.bin\cypress run --spec 'cypress\integration\tests\**'
该目录和文件存在,我试图保留这些文件的绝对路径,但是它也不起作用.尝试更改cypress.json中集成目录的配置,最后我得到以下文件:
The directory and the files exist, I tried to keep the absolute path to those files but it does not work either. Try changing the configuration of the integration directory in the cypress.json, at the end I have this file:
cypress.json
{
"baseUrl": "http://localhost/",
"chromeWebSecurity": false,
"integrationFolder": "./cypress/integration/",
"testFiles": "**.spec.js"
}
这是消息的错误:无法运行,因为未找到任何规格文件.
This is the message's error: Can't run because no spec files were found.
我们搜索了与此glob模式匹配的所有文件:
We searched for any files matching this glob pattern:
'cypress \ integration \ tests \ default.spec.js'
'cypress\integration\tests\default.spec.js'
推荐答案
我知道已经很晚了,但是我刚刚遇到了这个问题.
I know it's late but I just came across this issue.
我通过使用(=)-spec = cypress/integration/[path]
解决了它,它无法检测到我是否使用引号,-spec'cypress/integration/[路径]'
.
I solved it by using (=) --spec=cypress/integration/[path]
, it can't detect if I'm using quotes, --spec 'cypress/integration/[path]'
.
这篇关于为什么用cypress运行特定目录的测试对我来说是错误的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!