1

赛普拉斯 npm 依赖关系很大,所以我想将它单独放在 e2e 文件夹中自己的 package.json 中,以便仅在运行 E2E 测试时考虑它。

我创建了一个新的e2e/package.json文件

{
  "name": "e2e",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "directories": {
    "example": "examples"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "devDependencies": {
    "@testing-library/cypress": "^6.0.0",
    "cypress": "^7.2.0",
    "cypress-file-upload": "^4.1.1",
    "cypress-terminal-report": "^1.4.1"
  },
  "author": "",
  "license": "ISC"
}

文件夹结构..

    e2e/
      node_modules/
      integration/
      package.json
      tsconfig.json
    node_modules/
    src/

在移动赛普拉斯依赖项之前的tsconfig.json下面

{
  "compilerOptions": {
    "allowJs": true,
    "baseUrl": "../node_modules",
    "target": "es2018",
    "types": ["cypress", "@types/testing-library__cypress"]
  },
  "include": ["**/*.*"]
}

现在cypress open命令不再被识别!我们应该遵循哪些不同的步骤来进行这种迁移?提前致谢

4

0 回答 0