mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-13 16:17:54 +00:00
Fix: Differentiate null results in UI
This commit is contained in:
22
index.html
22
index.html
@@ -100,24 +100,29 @@
|
||||
const li = document.createElement('li');
|
||||
li.className = 'flex items-center gap-3 text-sm';
|
||||
list.appendChild(li);
|
||||
const time = genTimes[model]?.[test];
|
||||
|
||||
if (time === null) {
|
||||
li.innerHTML = `— <span class="font-medium text-gray-800">${test}</span><span class="mono text-gray-500 ml-auto">N/A</span>`;
|
||||
continue;
|
||||
}
|
||||
|
||||
li.innerHTML = `<svg class="animate-spin h-4 w-4 text-gray-400" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg><span class="font-medium text-gray-800">${test}</span><span class="mono text-gray-500 ml-auto">...</span>`;
|
||||
|
||||
let itemHTML;
|
||||
let status = '✅';
|
||||
try {
|
||||
const testPromise = (async () => {
|
||||
const testP = (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')), 12000));
|
||||
await Promise.race([testPromise, timeout]);
|
||||
itemHTML = `✅ <span class="font-medium text-gray-800">${test}</span>`;
|
||||
await Promise.race([testP, new Promise((_, r) => setTimeout(() => r(new Error('Timeout')), 12000))]);
|
||||
} catch (e) {
|
||||
console.error(`${model} - ${test}: `, e);
|
||||
itemHTML = `❌ <span class="font-medium text-gray-800">${test}</span>`;
|
||||
status = '❌';
|
||||
}
|
||||
const time = genTimes[model]?.[test]?.toFixed(3) ?? 'N/A';
|
||||
li.innerHTML = `${itemHTML}<span class="mono text-gray-500 ml-auto">${time}s</span>`;
|
||||
const timeStr = time?.toFixed(3) ?? 'N/A';
|
||||
li.innerHTML = `${status} <span class="font-medium text-gray-800">${test}</span><span class="mono text-gray-500 ml-auto">${timeStr}s</span>`;
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -125,4 +130,3 @@
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user