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:
trop[bot]
2024-01-18 16:19:52 -05:00
committed by GitHub
parent 8d49957c93
commit d5433ec0cc

View File

@@ -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);
}
}
});
}
}
};