diff --git a/tests/unit/command_test.ts b/tests/unit/command_test.ts index cbb1c4921c..770a568c49 100644 --- a/tests/unit/command_test.ts +++ b/tests/unit/command_test.ts @@ -59,7 +59,13 @@ Deno.test( const command = new Deno.Command(Deno.execPath(), { args: [ "eval", - "if (new TextDecoder().decode(await Deno.readAll(Deno.stdin)) !== 'hello') throw new Error('Expected \\'hello\\'')", + ` + const buffer = new Uint8Array(5); + await Deno.stdin.read(buffer); + if (new TextDecoder().decode(buffer) !== "hello") { + throw new Error('Expected \\'hello\\'') + } + `, ], stdin: "piped", stdout: "null", @@ -214,7 +220,13 @@ Deno.test( const command = new Deno.Command(Deno.execPath(), { args: [ "eval", - "if (new TextDecoder().decode(await Deno.readAll(Deno.stdin)) !== 'hello') throw new Error('Expected \\'hello\\'')", + ` + const buffer = new Uint8Array(5); + await Deno.stdin.read(buffer); + if (new TextDecoder().decode(buffer) !== "hello") { + throw new Error('Expected \\'hello\\'') + } + `, ], stdin: "piped", stdout: "null", diff --git a/tests/unit/process_test.ts b/tests/unit/process_test.ts index 0cc4e99aaf..040c6ee197 100644 --- a/tests/unit/process_test.ts +++ b/tests/unit/process_test.ts @@ -220,7 +220,13 @@ Deno.test( cmd: [ Deno.execPath(), "eval", - "if (new TextDecoder().decode(await Deno.readAll(Deno.stdin)) !== 'hello') throw new Error('Expected \\'hello\\'')", + ` + const buffer = new Uint8Array(5); + await Deno.stdin.read(buffer); + if (new TextDecoder().decode(buffer) !== "hello") { + throw new Error('Expected \\'hello\\'') + } + `, ], stdin: "piped", }); @@ -402,7 +408,13 @@ Deno.test( cmd: [ Deno.execPath(), "eval", - "if (new TextDecoder().decode(await Deno.readAll(Deno.stdin)) !== 'hello') throw new Error('Expected \\'hello\\'')", + ` + const buffer = new Uint8Array(5); + await Deno.stdin.read(buffer); + if (new TextDecoder().decode(buffer) !== "hello") { + throw new Error('Expected \\'hello\\'') + } + `, ], stdin: file.rid, });