-
Notifications
You must be signed in to change notification settings - Fork 63
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
Closing browser window quits e-mocha tests #194
Comments
Could you try an reproduce this with a minimal test case? We do handle the 'all-windows-closed' event specifically to allow tests to open and close windows. Is it possible that your code handles this event somewhere? For what it's worth, I'm also running window manager tests which open and close windows and have never experienced this issue. |
Thanks for the response.
It's hard to share code bits because the code that runs the
Yes, for example we do wrap This particular class method is stubbed (via This is why we then tried to Any ideas what may be causing this behavior ? a reduced/simplified code example:
simplified unit test example
If there is another window open, the closing of that new window works just fine. But if the closed window was the last open window, then Thanks ! |
I'd suggest to add breakpoints or debug messages to your event handlers and to the teardown method in particular, to make sure it's not called. |
Hello,
running into an issue here and cannot find a solution. I did search and found similar threads from the past (e.g. #67), but no clear solution that works in our scenario.
Problem:
Our
e-mocha
tests unexpectedly quit yday although no error occurred. This only occurs sometimes, but obviously breaks the CI. The test block where it (sometimes) breaks opens a few browser windows. At this point they were not closed by our code at the end of each test, which we then implemented.Which brings us to the issue that closing a browser window, if it is the only open window, will ultimately quit
Electron
, which then quits/ends the currently runninge-mocha
tests.Tried to
sinon.stub
app.quit()
andapp.exit()
as well asapp.on())
, but that also only works sometimes, not consistently. I know this sounds strange, but for whatever reasonsinon
does not stub these methods consistently - never had this issue before.How are you guys closing the browser windows w/o quitting Electron ?
Thanks !
Specs:
Win 10 x64
e-mocha 11.0.2
mocha 9.2.0
electron 12.0.5
The text was updated successfully, but these errors were encountered: