-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Feature] Auto close browser when launcher process exits #2261
Comments
@jperl I just tried and it does close for me. Do you launch browser with |
It works with a regular node script, but not inside a Jest test. https://github.com/jperl/pw-close-repro This works, it closes the page and browser process: Mac OS 10.15.4 |
@jperl Ah! Awesome repro, thank you! I didn't understand it's jest-related. This issue was originally fixed in 2018 back in Puppeteer days: puppeteer/puppeteer#2428 So if you use something like jest v20, it'll work (verified). However, jest v26 doesn't dispatch SIGINT anymore, so simple scripts like this won't work: // this is `example.test.js`
// this will never be called
process.on('SIGINT', () => console.log('SIGINT!'));
test("demo", async () => {
console.log('running test');
await new Promise(() => {});
}); Is there any tear down hook that jest calls when terminating process? Update: looks like a jest regression to me, filed upsteram as jestjs/jest#10052 |
Thank you for investigating 🙏 |
Let's move this issue to the jest-related repo. |
It would be nice if the browser would automatically close when the parent process closes. When you are running a test and want to kill it early with CTRL+C, it will leave a hanging browser.
The text was updated successfully, but these errors were encountered: