【发布时间】:2021-09-22 12:08:35
【问题描述】:
当尝试将 npm install -D cypress-xpath 安装到 Cypress 项目 [require('cypress-xpath') added to my cypress/support/index.js] 并安装了 cypress-cucumber-preprocessor 时,我得到了下面的插件错误 > "/// <reference types="cypress" />"的 index.js 文件?
找不到 'cypress'.ts(2688) 的类型定义文件
添加到插件> index.js 文件
const cucumber = require('cypress-cucumber-preprocessor').default
module.exports = (on, config) => {
on('file:preprocessor', cucumber())
}
package.json 文件
"devdependencies": {
"cypress": "^8.3.1",
"cypress-cucumber-preprocessor": "^4.2.0"
},
"Dependencies": {
"cypress-xpath": "^1.6.2"
}
支持 > index.js 文件
require('cypress-xpath')
运行时:
npx cypress open
插件文件丢失或无效。
您的 pluginsFile 设置为 C:\Users\Delwin\VSCode\Cypress\Cucumber1\cypress\plugins\index.js,但文件丢失、包含语法错误或在需要时抛出错误。 pluginsFile 必须是 .js、.ts 或 .coffee 文件。
或者您可能已经重命名了 pluginsFile 的扩展名。如果是这种情况,请重新启动测试运行程序。
如果您的项目不需要插件文件,请修复此问题,或将 pluginsFile 设置为 false。
错误:找不到模块“cypress-cucumber-preprocessor”
【问题讨论】:
标签: xpath cypress cypress-cucumber-preprocessor