cypress: Component test hangs if running with lerna monorepo

Current behavior

Running component tests of a React app with a lerna command hangs because of a zombie process /home/jochen/WebstormProjects/lerna-cypress/packages/react-app/node_modules/fork-ts-checker-webpack-plugin/lib/service.js.

The hang seems to occur less frequently or not at all if the test suceeds and almost every time a test fails. I created a test repo to reproduce this issue: https://github.com/JochenDiekenbrock/lerna-cypress

If the test are started with yarn test in the project root, lerna will go through all packages in the monorepo and run the script test:cypress in each package root.

The test in packages/react-app/src/App.spec.tsx is intended to fail to (better) reproduce the issue. On my local system this command will never complete and (after the test results are displayed) invoking ps -efa | grep "Cypress" will show a line like jochen 144342 1 27 17:13 pts/7 00:00:11 /home/jochen/.cache/Cypress/7.1.0/Cypress/Cypress --max-old-space-size=2048 /home/jochen/WebstormProjects/lerna-cypress/packages/react-app/node_modules/fork-ts-checker-webpack-plugin/lib/service.js

If just the test in the package directory is executed with yarn test:cypress the hang never occurs.

Desired behavior

The test should not hang if running in the lerna use case

Test code to reproduce

https://github.com/JochenDiekenbrock/lerna-cypress

Versions

Cypress 7.1.0 Nodejs v14.16.1 yarn 1.22.10 Ubuntu 20.10

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

I removed the runner-ct changes from the master branch of https://github.com/JochenDiekenbrock/lerna-cypress and updated it to Cypress 7.2.0 and other latest versions. The issue is still there.

The runner-ct changes are now in the branch use-runnerct-config

Thank you for your response. I looked into the packages/runner-ct code and modified the config in my repo to more closely match runner-ct. I created a commit for each change, none of them changed the hang behaviour.

I found one difference that looks suspicious, runner-ct does not use

if (config.testingType === 'component') {
        require('@cypress/react/plugins/react-scripts')(on, config)
    }

in packages/runner-ct/cypress/plugins/index.js but instead starts the web dev server with a separate webpack configuration. Making the same change in my repo became quite elaborate and I have to stop here for now.