我已将cypress-grep
插件安装为开发依赖项,以便我可以运行黄瓜场景特定次数以检查其片状。这些是我所做的更改:
yarn add -D cypress-grep
这增加了这种依赖package.json
require('cypress-grep')()
在_cypress/support > index.js
(可选)还可以在此处输入以下条目
cypress/plugins > index.js
module.exports = (on, config) => { require('cypress-grep/src/plugin')(config) }
现在我试图在一个特性文件中多次运行一个场景(标题包含“hello”)来检查它的片状
cypress/integration/folderA/sample.feature
。为此,我正在执行以下命令:
npx cypress run --spec "cypress/integration/folderA/sample.feature" --env grep=hello,burn=10
但是每次命令运行时,我都会收到以下错误:
The error was:
Error: Webpack Compilation Error
./cypress/integration/folderA/sample.feature 1:15
Module parse failed: Unexpected token (1:15)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> Feature: Feature file name
|
| Background: Sample background title
This occurred while Cypress was compiling and bundling your test code. This is usually caused by:
- A missing file or dependency
- A syntax error in the file or one of its dependencies
Fix the error in your code and re-run your tests.
我不确定这个错误试图告诉我什么。