From 41a304c83edf933ccf7831b8793e04c14f661ab4 Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Mon, 13 Oct 2025 12:12:37 -0700 Subject: [PATCH] Feat: Add 5-second timeout for browser tests --- index.html | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index a8de638..ac96936 100644 --- a/index.html +++ b/index.html @@ -58,9 +58,13 @@ let itemHTML; try { - const tMod = await import(`./tests/${test}/test.js`); - const lMod = await import(`./tests/${test}/outputs/${sModel}.js`); - await tMod.default.runTest(lMod.default); + const testPromise = (async () => { + const tMod = await import(`./tests/${test}/test.js`); + const lMod = await import(`./tests/${test}/outputs/${sModel}.js`); + await tMod.default.runTest(lMod.default); + })(); + const timeout = new Promise((_, r) => setTimeout(() => r(new Error('Timeout')), 5000)); + await Promise.race([testPromise, timeout]); itemHTML = `✅ ${test}`; } catch (e) { console.error(`${model} - ${test}: `, e);