test: use node helpers for events.once and setTimeout promise (#37374)

This commit is contained in:
Jeremy Rose 2023-02-23 15:53:53 -08:00 committed by GitHub
parent 46c8b9c728
commit a3e3efe4c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
47 changed files with 932 additions and 927 deletions

View file

@ -8,7 +8,8 @@ import { BrowserWindow, WebPreferences } from 'electron/main';
import { closeWindow } from './lib/window-helpers';
import { emittedUntil } from './lib/events-helpers';
import { delay, listen } from './lib/spec-helpers';
import { listen } from './lib/spec-helpers';
import { setTimeout } from 'timers/promises';
const messageContainsSecurityWarning = (event: Event, level: number, message: string) => {
return message.indexOf('Electron Security Warning') > -1;
@ -140,7 +141,7 @@ describe('security warnings', () => {
w.webContents.on('console-message', () => {
didNotWarn = false;
});
await delay(500);
await setTimeout(500);
expect(didNotWarn).to.equal(true);
});