test: fix desktopCapturer mocha syntax (#47113)

do not nest `it` calls in desktopCapturer specs

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot] 2025-05-16 02:32:22 -05:00 committed by GitHub
commit b6779056f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -99,7 +99,7 @@ ifdescribe(!process.arch.includes('arm') && process.platform !== 'win32')('deskt
expect(isEmpties.every(e => e === true)).to.be.true(); expect(isEmpties.every(e => e === true)).to.be.true();
}); });
it('getMediaSourceId should match DesktopCapturerSource.id', async () => { it('getMediaSourceId should match DesktopCapturerSource.id', async function () {
const w = new BrowserWindow({ show: false, width: 100, height: 100, webPreferences: { contextIsolation: false } }); const w = new BrowserWindow({ show: false, width: 100, height: 100, webPreferences: { contextIsolation: false } });
const wShown = once(w, 'show'); const wShown = once(w, 'show');
const wFocused = once(w, 'focus'); const wFocused = once(w, 'focus');
@ -119,7 +119,7 @@ ifdescribe(!process.arch.includes('arm') && process.platform !== 'win32')('deskt
// bots while it is not on my workstation, as expected, with and without // bots while it is not on my workstation, as expected, with and without
// the --ci parameter. // the --ci parameter.
if (process.platform === 'linux' && sources.length === 0) { if (process.platform === 'linux' && sources.length === 0) {
it.skip('desktopCapturer.getSources returned an empty source list'); this.skip();
return; return;
} }
@ -130,7 +130,7 @@ ifdescribe(!process.arch.includes('arm') && process.platform !== 'win32')('deskt
expect(mediaSourceId).to.equal(foundSource!.id); expect(mediaSourceId).to.equal(foundSource!.id);
}); });
it('getSources should not incorrectly duplicate window_id', async () => { it('getSources should not incorrectly duplicate window_id', async function () {
const w = new BrowserWindow({ show: false, width: 100, height: 100, webPreferences: { contextIsolation: false } }); const w = new BrowserWindow({ show: false, width: 100, height: 100, webPreferences: { contextIsolation: false } });
const wShown = once(w, 'show'); const wShown = once(w, 'show');
const wFocused = once(w, 'focus'); const wFocused = once(w, 'focus');
@ -155,7 +155,7 @@ ifdescribe(!process.arch.includes('arm') && process.platform !== 'win32')('deskt
// bots while it is not on my workstation, as expected, with and without // bots while it is not on my workstation, as expected, with and without
// the --ci parameter. // the --ci parameter.
if (process.platform === 'linux' && sources.length === 0) { if (process.platform === 'linux' && sources.length === 0) {
it.skip('desktopCapturer.getSources returned an empty source list'); this.skip();
return; return;
} }
@ -180,7 +180,7 @@ ifdescribe(!process.arch.includes('arm') && process.platform !== 'win32')('deskt
expect(w.resizable).to.be.false(); expect(w.resizable).to.be.false();
}); });
it('moveAbove should move the window at the requested place', async () => { it('moveAbove should move the window at the requested place', async function () {
// DesktopCapturer.getSources() is guaranteed to return in the correct // DesktopCapturer.getSources() is guaranteed to return in the correct
// z-order from foreground to background. // z-order from foreground to background.
const MAX_WIN = 4; const MAX_WIN = 4;
@ -225,7 +225,7 @@ ifdescribe(!process.arch.includes('arm') && process.platform !== 'win32')('deskt
// the --ci parameter. // the --ci parameter.
if (process.platform === 'linux' && sources.length === 0) { if (process.platform === 'linux' && sources.length === 0) {
destroyWindows(); destroyWindows();
it.skip('desktopCapturer.getSources returned an empty source list'); this.skip();
return; return;
} }