mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
test: fixup assertNotWindows (#41048)
* chore: fixup assertNotWindows Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> * remove logging Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
This commit is contained in:
@@ -29,13 +29,19 @@ export const closeWindow = async (
|
||||
await ensureWindowIsClosed(window);
|
||||
|
||||
if (assertNotWindows) {
|
||||
const windows = BaseWindow.getAllWindows();
|
||||
try {
|
||||
expect(windows).to.have.lengthOf(0);
|
||||
} finally {
|
||||
for (const win of windows) {
|
||||
await ensureWindowIsClosed(win);
|
||||
}
|
||||
let windows = BaseWindow.getAllWindows();
|
||||
if (windows.length > 0) {
|
||||
setTimeout(async () => {
|
||||
// Wait until next tick to assert that all windows have been closed.
|
||||
windows = BaseWindow.getAllWindows();
|
||||
try {
|
||||
expect(windows).to.have.lengthOf(0);
|
||||
} finally {
|
||||
for (const win of windows) {
|
||||
await ensureWindowIsClosed(win);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user