mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-14 08:37:56 +00:00
Feat: Add 5-second timeout for browser tests
This commit is contained in:
@@ -58,9 +58,13 @@
|
|||||||
|
|
||||||
let itemHTML;
|
let itemHTML;
|
||||||
try {
|
try {
|
||||||
|
const testPromise = (async () => {
|
||||||
const tMod = await import(`./tests/${test}/test.js`);
|
const tMod = await import(`./tests/${test}/test.js`);
|
||||||
const lMod = await import(`./tests/${test}/outputs/${sModel}.js`);
|
const lMod = await import(`./tests/${test}/outputs/${sModel}.js`);
|
||||||
await tMod.default.runTest(lMod.default);
|
await tMod.default.runTest(lMod.default);
|
||||||
|
})();
|
||||||
|
const timeout = new Promise((_, r) => setTimeout(() => r(new Error('Timeout')), 5000));
|
||||||
|
await Promise.race([testPromise, timeout]);
|
||||||
itemHTML = `✅ <span class="font-medium text-gray-800">${test}</span>`;
|
itemHTML = `✅ <span class="font-medium text-gray-800">${test}</span>`;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`${model} - ${test}: `, e);
|
console.error(`${model} - ${test}: `, e);
|
||||||
|
|||||||
Reference in New Issue
Block a user