diff --git a/scripts/runner.node.mjs b/scripts/runner.node.mjs index 70c7cd5def..147f6ccc41 100755 --- a/scripts/runner.node.mjs +++ b/scripts/runner.node.mjs @@ -313,7 +313,7 @@ async function runTests() { const okResults = []; const flakyResults = []; const failedResults = []; - const maxAttempts = 1 + (parseInt(options["retries"]) || 0); + const defaultMaxAttempts = 1 + (parseInt(options["retries"]) || 0); /** * @param {string} title @@ -321,11 +321,23 @@ async function runTests() { * @returns {Promise} */ const runTest = async (title, fn) => { + // suspicious tests are run a minimum number of times, larger than the normal retry count, even + // if they pass on the first attempt. we are giving them N chances to fail instead of N chances + // to pass. + const suspiciousTests = [ + "test-worker-arraybuffer-zerofill.js", + "worker_destruction.test.ts", + "worker.test.ts", + "test-worker-message-port-transfer-terminate.js", + "worker-lifecycle-message-port.test.ts", + ]; + const suspicious = suspiciousTests.some(name => title.includes(name)); + const maxAttempts = suspicious ? 50 : defaultMaxAttempts; const index = ++i; let result, failure, flaky; for (let attempt = 1; attempt <= maxAttempts; attempt++) { - if (attempt > 1) { + if (attempt > 1 && !suspicious) { await new Promise(resolve => setTimeout(resolve, 5000 + Math.random() * 10_000)); } @@ -343,7 +355,11 @@ async function runTests() { } else { okResults.push(result); } - break; + if (suspicious) { + continue; + } else { + break; + } } const color = attempt >= maxAttempts ? "red" : "yellow";