test: fixup assertNotWindows (#41045)

* chore: fixup assertNotWindows

* remove logging
This commit is contained in:
John Kleinschmidt 2024-01-18 14:04:43 -05:00 committed by GitHub
parent 7e6fb97a2f
commit 3dafb318a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

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