diff options
author | Casper Beyer <caspervonb@pm.me> | 2020-12-17 22:01:47 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-17 15:01:47 +0100 |
commit | 55dc467b419b8e5897b1c832b04d63e383253d84 (patch) | |
tree | d4bbbe9637eed4e367eb2359735b9ad62b0181cb | |
parent | 825293737004cbf94638458f77fa13fd1b07aef2 (diff) |
test(cli): ensure await all on stdout does not deadlock (#8802)
-rw-r--r-- | cli/tests/integration_tests.rs | 5 | ||||
-rw-r--r-- | cli/tests/stdout_write_all.out | 3 | ||||
-rw-r--r-- | cli/tests/stdout_write_all.ts | 8 |
3 files changed, 16 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 2f23e2dee..302e808fa 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -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", diff --git a/cli/tests/stdout_write_all.out b/cli/tests/stdout_write_all.out new file mode 100644 index 000000000..49a6d64e9 --- /dev/null +++ b/cli/tests/stdout_write_all.out @@ -0,0 +1,3 @@ +done +done +complete diff --git a/cli/tests/stdout_write_all.ts b/cli/tests/stdout_write_all.ts new file mode 100644 index 000000000..c82a0ca7d --- /dev/null +++ b/cli/tests/stdout_write_all.ts @@ -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")); |