3

Cypress npm dependency is quite big, so I want to separate it in its own package.json inside e2e folder inorder to consider it only while running E2E tests.

I created a new e2e/package.json file

{
  "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"
}

Folder structure ..

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

below the tsconfig.json before moving Cypress dependencies

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

Now the cypress open command is no more recognized ! what are the different steps we should follow to do such migration ? thanks in advance

Smaillns
  • 2,540
  • 1
  • 28
  • 40

0 Answers0