Browse Source

spec: try closing windows more aggressively in transparent specs

Shelley Vohr 1 year ago
parent
commit
047b8be057
2 changed files with 8 additions and 4 deletions
  1. 6 2
      spec/api-browser-window-spec.ts
  2. 2 2
      spec/lib/window-helpers.ts

+ 6 - 2
spec/api-browser-window-spec.ts

@@ -6427,7 +6427,9 @@ describe('BrowserWindow module', () => {
   });
 
   describe('"transparent" option', () => {
-    afterEach(closeAllWindows);
+    afterEach(() => {
+      closeAllWindows({ assertNotWindows: true });
+    });
 
     ifit(process.platform !== 'linux')('correctly returns isMaximized() when the window is maximized then minimized', async () => {
       const w = new BrowserWindow({
@@ -6571,7 +6573,9 @@ describe('BrowserWindow module', () => {
   });
 
   describe('"backgroundColor" option', () => {
-    afterEach(closeAllWindows);
+    afterEach(() => {
+      closeAllWindows({ assertNotWindows: true });
+    });
 
     // Linux/WOA doesn't return any capture sources.
     ifit(process.platform === 'darwin')('should display the set color', async () => {

+ 2 - 2
spec/lib/window-helpers.ts

@@ -46,8 +46,8 @@ export const closeWindow = async (
   }
 };
 
-export async function closeAllWindows () {
+export async function closeAllWindows (options = { assertNotWindows: false }) {
   for (const w of BaseWindow.getAllWindows()) {
-    await closeWindow(w, { assertNotWindows: false });
+    await closeWindow(w, options);
   }
 }