Catch top-level errors thrown in electron tests

Co-authored-by: yash-signal <yash@signal.org>
This commit is contained in:
automated-signal 2025-07-28 12:02:32 -05:00 committed by GitHub
parent 106a3bfc9b
commit 0a6a6d65ed
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -150,8 +150,16 @@ window.testUtilities = {
for (let i = 0; i < files.length; i += 1) {
if (i % workerCount === worker) {
// eslint-disable-next-line import/no-dynamic-require, global-require
require(files[i]);
try {
// eslint-disable-next-line import/no-dynamic-require, global-require
require(files[i]);
} catch (error) {
window.testUtilities.onTestEvent({
type: 'fail',
title: ['Failed to load test:', files[i]],
error: error.stack || String(error),
});
}
}
}
},