Skip to content

Closing browser window quits e-mocha tests #194

@petef19

Description

@petef19

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 running e-mocha tests.

Tried to sinon.stub app.quit() and app.exit() as well as app.on()), but that also only works sometimes, not consistently. I know this sounds strange, but for whatever reason sinon 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions