From 4e53bc5a94a66858e9c141c7d807a8c9caa93403 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 13 Apr 2023 13:30:30 -0400 Subject: chore: bump child_process_test timeouts for slow CI (#18689) --- cli/tests/unit_node/child_process_test.ts | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'cli/tests') diff --git a/cli/tests/unit_node/child_process_test.ts b/cli/tests/unit_node/child_process_test.ts index a2dd9924d..b40cfd9ff 100644 --- a/cli/tests/unit_node/child_process_test.ts +++ b/cli/tests/unit_node/child_process_test.ts @@ -15,7 +15,7 @@ import * as path from "../../../test_util/std/path/mod.ts"; const { spawn, execFile, execFileSync, ChildProcess } = CP; -function withTimeout(timeoutInMS: number): Deferred { +function withTimeout(timeoutInMS = 10_000): Deferred { const promise = deferred(); const timer = setTimeout(() => { promise.reject("Timeout"); @@ -28,7 +28,7 @@ function withTimeout(timeoutInMS: number): Deferred { // TODO(uki00a): Once Node.js's `parallel/test-child-process-spawn-error.js` works, this test case should be removed. Deno.test("[node/child_process spawn] The 'error' event is emitted when no binary is found", async () => { - const promise = withTimeout(1000); + const promise = withTimeout(); const childProcess = spawn("no-such-cmd"); childProcess.on("error", (_err: Error) => { // TODO(@bartlomieju) Assert an error message. @@ -38,7 +38,7 @@ Deno.test("[node/child_process spawn] The 'error' event is emitted when no binar }); Deno.test("[node/child_process spawn] The 'exit' event is emitted with an exit code after the child process ends", async () => { - const promise = withTimeout(3000); + const promise = withTimeout(); const childProcess = spawn(Deno.execPath(), ["--help"], { env: { NO_COLOR: "true" }, }); @@ -59,7 +59,7 @@ Deno.test("[node/child_process spawn] The 'exit' event is emitted with an exit c }); Deno.test("[node/child_process disconnect] the method exists", async () => { - const promise = withTimeout(1000); + const promise = withTimeout(); const childProcess = spawn(Deno.execPath(), ["--help"], { env: { NO_COLOR: "true" }, }); @@ -79,7 +79,7 @@ Deno.test("[node/child_process disconnect] the method exists", async () => { Deno.test({ name: "[node/child_process spawn] Verify that stdin and stdout work", fn: async () => { - const promise = withTimeout(3000); + const promise = withTimeout(); const childProcess = spawn(Deno.execPath(), ["fmt", "-"], { env: { NO_COLOR: "true" }, stdio: ["pipe", "pipe"], @@ -107,7 +107,7 @@ Deno.test({ Deno.test({ name: "[node/child_process spawn] stdin and stdout with binary data", fn: async () => { - const promise = withTimeout(10000); + const promise = withTimeout(); const p = path.join( path.dirname(path.fromFileUrl(import.meta.url)), "./testdata/binary_stdio.js", @@ -140,7 +140,7 @@ Deno.test({ async function spawnAndGetEnvValue( inputValue: string | number | boolean, ): Promise { - const promise = withTimeout(3000); + const promise = withTimeout(); const env = spawn( `"${Deno.execPath()}" eval -p "Deno.env.toObject().BAZ"`, { @@ -191,7 +191,7 @@ Deno.test({ // TODO(uki00a): Remove this case once Node's `parallel/test-child-process-spawn-event.js` works. Deno.test("[child_process spawn] 'spawn' event", async () => { - const timeout = withTimeout(3000); + const timeout = withTimeout(); const subprocess = spawn(Deno.execPath(), ["eval", "console.log('ok')"]); let didSpawn = false; @@ -238,7 +238,7 @@ Deno.test("[child_process spawn] 'spawn' event", async () => { // TODO(uki00a): Remove this case once Node's `parallel/test-child-process-spawn-shell.js` works. Deno.test("[child_process spawn] Verify that a shell is executed", async () => { - const promise = withTimeout(3000); + const promise = withTimeout(); const doesNotExist = spawn("does-not-exist", { shell: true }); try { assertNotStrictEquals(doesNotExist.spawnfile, "does-not-exist"); @@ -269,7 +269,7 @@ Deno.test({ ignore: Deno.build.os === "windows", name: "[node/child_process spawn] Verify that passing arguments works", async fn() { - const promise = withTimeout(3000); + const promise = withTimeout(); const echo = spawn("echo", ["foo"], { shell: true, }); @@ -300,7 +300,7 @@ Deno.test({ ignore: Deno.build.os === "windows", name: "[node/child_process spawn] Verity that shell features can be used", async fn() { - const promise = withTimeout(3000); + const promise = withTimeout(); const cmd = "echo bar | cat"; const command = spawn(cmd, { shell: true, @@ -331,7 +331,7 @@ Deno.test({ name: "[node/child_process spawn] Verity that environment is properly inherited", async fn() { - const promise = withTimeout(3000); + const promise = withTimeout(); const env = spawn( `"${Deno.execPath()}" eval -p "Deno.env.toObject().BAZ"`, { @@ -496,7 +496,7 @@ Deno.test({ "./testdata/infinite_loop.js", ); const childProcess = spawn(Deno.execPath(), ["run", script]); - const p = withTimeout(3000); + const p = withTimeout(); childProcess.on("exit", () => p.resolve()); childProcess.kill("SIGKILL"); await p; -- cgit v1.2.3