From fab4c1776b0f212f0a9f5b82842115b9b7e87d4b Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Wed, 22 May 2024 20:27:24 -0600 Subject: chore: kill node.js tests if they run too long (#23956) --- tests/node_compat/test.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'tests/node_compat') diff --git a/tests/node_compat/test.ts b/tests/node_compat/test.ts index 2f690e943..db4ba4f52 100644 --- a/tests/node_compat/test.ts +++ b/tests/node_compat/test.ts @@ -104,8 +104,21 @@ async function runTest(t: Deno.TestContext, path: string): Promise { ...envVars, }, 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(); + clearTimeout(warner); + clearTimeout(killer); if (code !== 0) { // If the test case failed, show the stdout, stderr, and instruction -- cgit v1.2.3