test: refactor deprecate-helpers.ts to warning-helpers.ts (#46837)

Add a generic expectWarningMessages and start checking warning names

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
This commit is contained in:
trop[bot] 2025-04-28 23:39:57 -05:00 committed by GitHub
parent dcd8224c15
commit 069ca16b9e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 69 additions and 35 deletions

View file

@ -10,6 +10,7 @@ import * as path from 'node:path';
import { emittedNTimes, emittedUntil } from './lib/events-helpers';
import { ifit, listen, waitUntil } from './lib/spec-helpers';
import { expectWarningMessages } from './lib/warning-helpers';
import { closeAllWindows, closeWindow, cleanupWebContents } from './lib/window-helpers';
const uuid = require('uuid');
@ -95,14 +96,13 @@ describe('chrome extensions', () => {
it('recognize malformed host permissions', async () => {
await w.loadURL(url);
const extPath = path.join(fixtures, 'extensions', 'host-permissions', 'malformed');
customSession.extensions.loadExtension(extPath);
const warning = await new Promise(resolve => { process.on('warning', resolve); });
const malformedHost = /URL pattern 'malformed_host' is malformed/;
expect(warning).to.match(malformedHost);
await expectWarningMessages(
async () => {
const extPath = path.join(fixtures, 'extensions', 'host-permissions', 'malformed');
await customSession.extensions.loadExtension(extPath);
},
{ name: 'ExtensionLoadWarning', message: /URL pattern 'malformed_host' is malformed/ }
);
});
it('can grant special privileges to urls with host permissions', async () => {