cypress-io/cypress-react-unit-test

Move app dependencies into every folder

bahmutov opened this issue ยท 2 comments

It is a fair question if users by looking at an example folder like examples/react-scripts understand what dependencies are used. Right now we place all shared dependencies in the root package.json, and only link the cypress-react-unit-test itself in every examples/*/package.json file

What we could do instead is to have full prod and dev dependencies in every examples/*/package.json and it should NOT affect the CI times. Since we cache ~/.npm and ~/.cachefolders automatically, runningnpm ciin everyexamples/*folder should not change timings from the current durations. For exampleexamples/nextjs` runs in 18 seconds with full dependencies, while other empty folders run in 12 seconds - a negligible difference.

Meanwhile if we decide to update dependencies, Renovate bot could handle all those updates just fine.

Finally, a related issue is how to properly install cypress-react-unit-test and avoid accidentally using node_modules from the root folder. I think this is a separate issue, will handle later. But in short we could:

  • when working locally keep doing what we are doing: using cypress-react-unit-test: 'file:../..' to link every example project back to the root folder
  • when running on CI, we could
    • build cypress-react-unit-test
    • npm pack it, creating cypress-react-unit-test.tgz
    • rm -rf node_modules from the folder
    • in every examples/* folder we can run npm ci since we are using separate ~/.npm/ folder BUT first we would replace cypress-react-unit-test from file link to cypress-react-unit-test.tgz file

Progress

  • examples/a11y
  • examples/nextjs
  • examples/react-scripts
  • examples/react-scripts-cucumber
  • examples/react-scripts-folder
  • examples/rollup
  • examples/sass-and-ts
  • examples/snapshots
  • examples/tailwind
  • examples/using-babel
  • examples/using-babel-typescript
  • examples/visual-sudoku
  • examples/visual-testing-with-applitools
  • examples/visual-testing-with-happo
  • examples/visual-testing-with-percy
  • examples/webpack-file
  • examples/webpack-options
  • clean up root level dependencies after moving all deps into examples

probably will need to clean up root dependencies and to add some Percy screenshots

๐ŸŽ‰ This issue has been resolved in version 4.16.5 ๐ŸŽ‰

The release is available on:

Your semantic-release bot ๐Ÿ“ฆ๐Ÿš€