首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么cypress模块在运行时没有检测到-cypress运行命令?

为什么cypress模块在运行时没有检测到-cypress运行命令?
EN

Stack Overflow用户
提问于 2021-09-27 07:16:20
回答 1查看 1.1K关注 0票数 3

当我尝试运行用于并行运行测试用例的sorry-cypress command

代码语言:javascript
复制
CYPRESS_API_URL="http://localhost:1234/" cy2 run --parallel --record --key somekey --ci-build-id hello-cypress

即使安装了柏树,它也会引发错误。这是对不起-柏树设置链接。

对不起-柏木模块基本链接:https://docs.sorry-cypress.dev/guide/get-started

错误:无法检测柏树。柏树安装好了吗?在(/home/ashish/.nvm/versions/node/v14.17.5/lib/node_modules/cy2/lib/patch.js:90:11) getStateModulePath

这是我的package.json文件

代码语言:javascript
复制
{
  "name": "test-automation",
  "version": "1.0.0",
  "main": "index.js",
  "devDependencies": {
    "cucumber-html-reporter": "5.5.0",
    "cypress": "^8.4.1",
    "cypress-cucumber-preprocessor": "4.1.4",
    "cypress-plugin-tab": "1.0.5",
    "cypress-wait-until": "1.7.1",
    "eslint": "7.30.0",
    "eslint-plugin-cypress": "2.11.3",
    "junit-report-merger": "2.2.3"
  },
  "engines": {
    "node": "14"
  },
  "scripts": {
    "open": "cypress open",
    "api": "cypress run --headless --browser chrome --spec \"cypress/integration/API/**/*\"",
    "ui": "cypress run --browser chrome --spec \"cypress/integration/UI/**/*\"",
    "delete:reports": "rm cypress/results/* || true",
    "combine:reports": "jrm cypress/results/combined-report.xml \"cypress/results/*.xml\"",
    "prechrome": "yarn run delete:reports",
    "chrome": "cypress run --browser chrome",
    "postchrome": "yarn run combine:reports",
    "docker:pull": "docker pull cypress/included:7.6.0",
    "predocker:e2e": "yarn run delete:reports",
    "docker:e2e": "docker run -it -v $PWD:/e2e -w /e2e --entrypoint=cypress cypress/included:7.6.0 run --headless --browser chrome",
    "postdocker:e2e": "yarn run combine:reports",
    "generate:report": "node cypress/cucumber-html-reporter.js"
  },
  "cypress-cucumber-preprocessor": {
    "nonGlobalStepDefinitions": true,
    "cucumberJson": {
      "generate": true,
      "outputFolder": "cypress/cucumber-json",
      "filePrefix": "",
      "fileSuffix": ".cucumber"
    }
  },
  "dependencies": {
    "cy2": "^1.3.0"
  }
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-09-27 07:44:04

这里的问题是cy2模块的位置。

运行此命令将有助于解决此问题。

代码语言:javascript
复制
CYPRESS_API_URL="http://localhost:1234/" ./node_modules/cy2/bin/cy2 run --parallel --record --key somekey --ci-build-id hello-cypress

我在这里改变的是cy2./node_modules/cy2/bin/cy2

因为cy2不能直接访问。

通过npm安装cy2模块,在node_module中安装cy2。

纱线添加将工作直接访问cy2模块。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69342587

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档