You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Cypress从8.7.0升级到9.1.0后Mac环境运行测试卡在加载页求助

问题根因

你遇到的加载卡住问题确实是cypress-cucumber-preprocessor@2.3.1与Cypress 9.x版本不兼容导致的。2.3.1版本的预处理器仅适配Cypress 8及更低版本,升级Cypress后原有.feature文件预处理逻辑失效,就会卡在测试加载环节。

修复步骤
  • 卸载旧版本预处理器:执行npm uninstall cypress-cucumber-preprocessor
  • 安装适配Cypress 9.1.0的预处理器版本:执行npm install cypress-cucumber-preprocessor@4.3.1 --save-dev
  • 清理Cypress本地缓存:执行npx cypress cache clear
  • 重启Cypress运行测试:执行npx cypress open
可选排查项

如果完成上述操作后问题依旧存在,可按以下顺序排查:

  • 检查cypress/plugins/index.js配置是否正确,参考配置如下:
const cucumber = require('cypress-cucumber-preprocessor').default

module.exports = (on, config) => {
  on('file:preprocessor', cucumber())
}
  • 检查package.json中的cypress-cucumber-preprocessor相关配置,无特殊需求时删除自定义配置,使用默认参数即可
  • 删除项目根目录下的node_modules文件夹、package-lock.json(或yarn.lock)文件,重新执行npm install全量重装依赖,避免旧版本依赖缓存导致的异常

内容的提问来源于stack exchange,提问作者Tatotux

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.24 13:54:05