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

Expose event for when Cypress is about to exit #6946

Closed
stahloss opened this issue Apr 6, 2020 · 6 comments
Closed

Expose event for when Cypress is about to exit #6946

stahloss opened this issue Apr 6, 2020 · 6 comments
Labels
pkg/server This is due to an issue in the packages/server directory type: feature New feature that does not currently exist

Comments

@stahloss
Copy link

stahloss commented Apr 6, 2020

We have a process that starts up when Cypress does, which we start from the Cypress plugins index.js, using NodeJS's child_process. The process is Wiremock, to be exact. We know we can use Cypress' fixtures, but for now this is not an option.

We would like an event to be implemented that we can bind to so we can kill the child_process when Cypress is about to exit.

On Windows the child_process is killed automatically, but on Linux it needs to be manually stopped, because it keeps running even after the parent process is killed.

@jennifer-shehane
Copy link
Member

You can have more debug logs log, by running DEBUG=cypress:server:cypress cypress run. This will issue a debug log when it's about to exit, but...I don't think you could actually prevent the exit code in this case.

Screen Shot 2020-04-07 at 12 47 56 PM

Have you looked at our Module API? It may be a medium where you can craft something you want.

@cypress-bot cypress-bot bot added the stage: awaiting response Potential fix was proposed; awaiting response label Apr 7, 2020
@stahloss
Copy link
Author

stahloss commented Apr 7, 2020

Thanks I will have a look at the module API.

But lifecycle events are always useful and it seems easy to fire an event when it's about to exit (maybe where it's logged)?
Then if listeners are registered, wait for their promises to resolve, else just exit?

@jennifer-shehane
Copy link
Member

Even if easy to implement, there are many considerations when deciding what to put into the product beside its ease of implementation. We'll leave this issue as a proposal and see if this issue gains more 👍 or comments in support from other users.

This would likely fall under the work slated for #2840

@jennifer-shehane jennifer-shehane changed the title Event when Cypress is about to exit Expose event listener for when Cypress is about to exit Apr 8, 2020
@cypress-bot cypress-bot bot added stage: proposal 💡 No work has been done of this issue and removed stage: awaiting response Potential fix was proposed; awaiting response labels Apr 8, 2020
@jennifer-shehane jennifer-shehane added type: feature New feature that does not currently exist pkg/server This is due to an issue in the packages/server directory labels Apr 8, 2020
@stahloss stahloss changed the title Expose event listener for when Cypress is about to exit Expose event for when Cypress is about to exit Apr 8, 2020
@rsudarson
Copy link

+1. This is a useful feature.

@chrisbreiding
Copy link
Contributor

This is now supported by using the after:run event. You currently need to enable it with the experimentalRunEvents option, but that will no longer be necessary when Cypress 6.7.0 is released in the near future.

@jennifer-shehane
Copy link
Member

This issue will be closed to further comment as the exact issue here was resolved and tested.

If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix.

@cypress-io cypress-io locked as resolved and limited conversation to collaborators May 5, 2021
@jennifer-shehane jennifer-shehane removed the stage: proposal 💡 No work has been done of this issue label May 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pkg/server This is due to an issue in the packages/server directory type: feature New feature that does not currently exist
Projects
None yet
Development

No branches or pull requests

4 participants