Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@nx/cypress:cypress executor hanging since v20.3.0 #29571

Closed
1 of 4 tasks
PodStuart opened this issue Jan 9, 2025 · 6 comments · Fixed by #29689
Closed
1 of 4 tasks

@nx/cypress:cypress executor hanging since v20.3.0 #29571

PodStuart opened this issue Jan 9, 2025 · 6 comments · Fixed by #29689
Assignees
Labels
scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx type: bug

Comments

@PodStuart
Copy link

Current Behavior

Our e2e tests using the @nx/cypress:cypress executor have started to hang since the upgrade to v20.3.0.

We see "All specs passed!" in the output then the process hangs before being killed by GitHub Actions owing to the timeout being breached.

Wondering if anyone else has seen this.

Expected Behavior

Our e2e tests run as before.

GitHub Repo

No response

Steps to Reproduce

Not really sure how to create a minimal example to reproduce the issue.

Nx Report

Node           : 20.18.1
OS             : darwin-arm64
Native Target  : aarch64-macos
npm            : 10.8.2

nx                     : 20.3.1
@nx/js                 : 20.3.1
@nx/jest               : 20.3.1
@nx/eslint             : 20.3.1
@nx/workspace          : 20.3.1
@nx/cypress            : 20.3.1
@nx/devkit             : 20.3.1
@nx/eslint-plugin      : 20.3.1
@nx/module-federation  : 20.3.1
@nx/nest               : 20.3.1
@nx/next               : 20.3.1
@nx/node               : 20.3.1
@nx/playwright         : 20.3.1
@nx/react              : 20.3.1
@nx/storybook          : 20.3.1
@nx/vite               : 20.3.1
@nx/web                : 20.3.1
@nx/webpack            : 20.3.1
typescript             : 5.6.3
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/next/plugin
@nx/playwright/plugin
---------------------------------------
Community plugins:
@nx-go/nx-go : 3.3.1

Failure Logs

(Run Finished)
       Spec                                              Tests  Passing  Failing  Pending  Skipped  
  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ ✔  integration.cy.ts                        00:21       30       29        -        1        - │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘
    ✔  All specs passed!                        00:21       30       29        -        1        -  
2025-01-09T15:41:06.493Z cypress:cli child event fired { event: 'exit', code: 0, signal: null }
Error: The operation was canceled.

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@PodStuart
Copy link
Author

We also see a suspicious looking "25h" printed in the logs in some of our projects, the ones which use @nx/cypress/plugin or the @nx/cypress:cypress directly.

@leosvelperez leosvelperez self-assigned this Jan 17, 2025
@leosvelperez leosvelperez added the scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx label Jan 17, 2025
@nsmith7989
Copy link
Contributor

I can confirm this is also happening to us. We're using nx-cloud and distributed task execution an each of the agents after it completes a cypress task hangs.

It also seems isolated to the @nx/cypress executor. If we bypass this executor and instead call the cypress cli directly, we do not have this issue.

@llwt
Copy link
Contributor

llwt commented Jan 17, 2025

Hi @PodStuart / @nsmith7989,

I've put together a test repo on 20.3.1 to try and reproduce, but so far, I have had no luck. The e2e tests seem to complete without issue.

Is there anything you can think of that differs from the defaults here that we can try to add to reproduce the issue?

@nsmith7989
Copy link
Contributor

@llwt / @PodStuart I was able to create a reproduction that mostly mimics our setup.

Action run that shows the issue
Agent 2 is hanging currently, I think it will timeout.

I forked from @llwt's repo above and kept adding items until it was closer to our setup.

  • no project crystal/inferred tasks plugins
  • nextjs app with a custom server
  • using @nx/cypress executor that calls a @nx/next:server with a custom server and build target.

Note the other nextjs application in this repo does not have a custom server and does not have this issue.

@nsmith7989
Copy link
Contributor

This does not seem to have anything to do with DTE, affected command or NX cloud.

I've made a branch that reproduces the issue by only running e2e with the cyrpess executor
action result

I did a bit more digging in an attempt to "bisect" when this was added using the 20.3.0-beta.x releases

20.3.0-beta.0

Dec 10, 2024
Commit: nsmith7989/nx-20-3-1@ec8ed36

Action: https://github.com/nsmith7989/nx-20-3-1/actions/runs/12840012589/job/35808076596

Result: ✅

20.3.0-beta.1

Dec 17, 2024
Commit: nsmith7989/nx-20-3-1@0bff399
Action: https://github.com/nsmith7989/nx-20-3-1/actions/runs/12840080750/job/35808231402

Result: ❌

More granular with Canary

20.3.0-canary.20241214-4cd640a

Dec 14, 2024
Commit: nsmith7989/nx-20-3-1@0ef8882
Action: https://github.com/nsmith7989/nx-20-3-1/actions/runs/12840205187/job/35808546163

Result: ✅

20.3.0-canary.20241217-ee4de0b

Dec 17, 2024
Commit: nsmith7989/nx-20-3-1@0495148
Action: https://github.com/nsmith7989/nx-20-3-1/actions/runs/12840237650/job/35808628704

Result: ❌

TL;DR it looks like this issue was introduced between 20.3.0-canary.20241214-4cd640a and 20.3.0-canary.20241217-ee4de0b

@PodStuart
Copy link
Author

Thanks @llwt / @nsmith7989 good to know it is not just us :)

From our setup I can confirm we are not using Nx cloud and the hang does not occur when using nx affected, which we use earlier in the pipeline to determine which e2e tests to run and then feed into a GitHub actions matrix running the e2e target directly. We are also not using inferred tasks.

We also have quite a variety of configurations in our repository and the issue impacts them all, even one which is essentially a "hello world", a new e2e projects to which tests have not yet been added. I'll attach that for good measure.

payments-webapp-e2e.zip

The issue is still present on 20.3.2 (just checked) and we have only seen it on GitHub actions (ubuntu-22.04), and not locally.

isaacplmann pushed a commit that referenced this issue Feb 11, 2025
…29689)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

Running an e2e task using the `@nx/cypress:cypress` executor that starts
a dev server by running another task that uses the `@nx/js:node`
executor result in the process to hang after the e2e tests have finished
running.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

The async generator returned by starting the dev server and consumed by
the `@nx/cypress:cypress` executor should be finished, and the
`@nx/js:node` executor should properly clean up its child process once
the generator is finished.

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #29571
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: testing tools Issues related to Cypress / Jest / Playwright / Vitest support in Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants