question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expose event for when Cypress is about to exit

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
jennifer-shehanecommented, Apr 8, 2020

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

1reaction
D0rmousecommented, 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?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Events Emitted from Your Application during End-to ...
In this blog post I will show how to start using web app events in your end-to-end tests with minimal effort. Oh, and...
Read more >
Best Practices - Cypress Documentation
One of the best parts of Cypress is its emphasis on debuggability. Unlike other testing tools - when your tests end - you...
Read more >
Debugging - Cypress Documentation
What you'll learn How Cypress runs in the same event loop with your code, keeping debugging less demanding and more understandable How Cypress...
Read more >
window - Cypress Documentation
This blog post explains how to use cy.window() to spy on the DOM prototype to detect when the application starts adding event listeners...
Read more >
Writing a Plugin - Cypress Documentation
on is a function that you will use to register listeners on various events that Cypress exposes. Registering to listen on an event...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found