Skip to content

Commit fab4c17

Browse files
authored
chore: kill node.js tests if they run too long (#23956)
1 parent 8a636d0 commit fab4c17

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

tests/node_compat/test.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,21 @@ async function runTest(t: Deno.TestContext, path: string): Promise<void> {
104104
...envVars,
105105
},
106106
cwd,
107-
});
107+
stdout: "piped",
108+
stderr: "piped",
109+
}).spawn();
110+
const warner = setTimeout(() => {
111+
console.error(`Test is running slow: ${testCase}`);
112+
}, 2 * 60_000);
113+
const killer = setTimeout(() => {
114+
console.error(
115+
`Test ran far too long, terminating with extreme prejudice: ${testCase}`,
116+
);
117+
command.kill();
118+
}, 10 * 60_000);
108119
const { code, stdout, stderr } = await command.output();
120+
clearTimeout(warner);
121+
clearTimeout(killer);
109122

110123
if (code !== 0) {
111124
// If the test case failed, show the stdout, stderr, and instruction

0 commit comments

Comments
 (0)