1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

chore: kill node.js tests if they run too long (#23956)

This commit is contained in:
Matt Mastracci 2024-05-22 20:27:24 -06:00 committed by GitHub
parent 8a636d0600
commit fab4c1776b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -104,8 +104,21 @@ async function runTest(t: Deno.TestContext, path: string): Promise<void> {
...envVars, ...envVars,
}, },
cwd, cwd,
}); stdout: "piped",
stderr: "piped",
}).spawn();
const warner = setTimeout(() => {
console.error(`Test is running slow: ${testCase}`);
}, 2 * 60_000);
const killer = setTimeout(() => {
console.error(
`Test ran far too long, terminating with extreme prejudice: ${testCase}`,
);
command.kill();
}, 10 * 60_000);
const { code, stdout, stderr } = await command.output(); const { code, stdout, stderr } = await command.output();
clearTimeout(warner);
clearTimeout(killer);
if (code !== 0) { if (code !== 0) {
// If the test case failed, show the stdout, stderr, and instruction // If the test case failed, show the stdout, stderr, and instruction