Cypress: Expose event for when Cypress is about to exit

Created on 6 Apr 2020  路  4Comments  路  Source: cypress-io/cypress

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.

pkserver proposal 馃挕 feature

Most helpful comment

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 https://github.com/cypress-io/cypress/issues/2840

All 4 comments

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.

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?

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 https://github.com/cypress-io/cypress/issues/2840

+1. This is a useful feature.

Was this page helpful?
0 / 5 - 0 ratings