1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-22 06:09:25 -05:00

test(cli): ensure await all on stdout does not deadlock (#8802)

This commit is contained in:
Casper Beyer 2020-12-17 22:01:47 +08:00 committed by GitHub
parent 8252937370
commit 55dc467b41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 0 deletions

View file

@ -2105,6 +2105,11 @@ fn deno_test_no_color() {
assert!(out.contains("test result: FAILED. 1 passed; 1 failed; 1 ignored; 0 measured; 0 filtered out"));
}
itest!(stdout_write_all {
args: "run --quiet stdout_write_all.ts",
output: "stdout_write_all.out",
});
itest!(_001_hello {
args: "run --reload 001_hello.js",
output: "001_hello.js.out",

View file

@ -0,0 +1,3 @@
done
done
complete

View file

@ -0,0 +1,8 @@
const encoder = new TextEncoder();
const pending = [
Deno.stdout.write(encoder.encode("done\n")),
Deno.stdout.write(encoder.encode("done\n")),
];
await Promise.all(pending);
await Deno.stdout.write(encoder.encode("complete\n"));