0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-03-03 09:31:22 -05:00

chore: bump child_process_test timeouts for slow CI (#18689)

This commit is contained in:
David Sherret 2023-04-13 13:30:30 -04:00 committed by GitHub
parent efa7c19890
commit 4e53bc5a94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -15,7 +15,7 @@ import * as path from "../../../test_util/std/path/mod.ts";
const { spawn, execFile, execFileSync, ChildProcess } = CP;
function withTimeout<T>(timeoutInMS: number): Deferred<T> {
function withTimeout<T>(timeoutInMS = 10_000): Deferred<T> {
const promise = deferred<T>();
const timer = setTimeout(() => {
promise.reject("Timeout");
@ -28,7 +28,7 @@ function withTimeout<T>(timeoutInMS: number): Deferred<T> {
// 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<string> {
const promise = withTimeout<string>(3000);
const promise = withTimeout<string>();
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;