test: use await to call "closeWindow" (#38166)

* test: wait for an async "closeWindow" call

* fixup! test: wait for an async "closeWindow" call
This commit is contained in:
Alexey Kuzmin
2023-05-04 00:14:46 +02:00
committed by GitHub
parent ee1e6aab3e
commit bc957e3945
2 changed files with 8 additions and 3 deletions

View File

@@ -4,7 +4,11 @@ import { BaseWindow, WebContentsView } from 'electron/main';
describe('WebContentsView', () => {
let w: BaseWindow;
afterEach(() => closeWindow(w as any).then(() => { w = null as unknown as BaseWindow; }));
afterEach(async () => {
await closeWindow(w as any);
w = null as unknown as BaseWindow;
});
it('can be used as content view', () => {
w = new BaseWindow({ show: false });

View File

@@ -559,9 +559,10 @@ describe('chrome extensions', () => {
});
});
afterEach(() => {
afterEach(async () => {
removeAllExtensions();
return closeWindow(w).then(() => { w = null as unknown as BrowserWindow; });
await closeWindow(w);
w = null as unknown as BrowserWindow;
});
it('should run content script at document_start', async () => {