mirror of
https://github.com/denoland/deno.git
synced 2025-09-28 21:24:48 +00:00
refactor: replace deferred()
from std/async
with Promise.withResolvers()
(#21234)
Closes #21041 --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
This commit is contained in:
parent
0ffcb46e0f
commit
616354e76c
35 changed files with 952 additions and 1020 deletions
|
@ -13,7 +13,6 @@ import {
|
|||
assertThrows,
|
||||
} from "../../../test_util/std/testing/asserts.ts";
|
||||
import { stripColor } from "../../../test_util/std/fmt/colors.ts";
|
||||
import { deferred } from "../../../test_util/std/async/deferred.ts";
|
||||
import * as path from "../../../test_util/std/path/mod.ts";
|
||||
import { delay } from "../../../test_util/std/async/delay.ts";
|
||||
|
||||
|
@ -368,7 +367,7 @@ Deno.test({
|
|||
// stdin resource is present before the test starts.
|
||||
sanitizeResources: false,
|
||||
async fn() {
|
||||
const promise = deferred();
|
||||
const { promise, resolve } = Promise.withResolvers<void>();
|
||||
const expected = ["foo", "bar", null, "end"];
|
||||
const data: (string | null)[] = [];
|
||||
|
||||
|
@ -385,7 +384,7 @@ Deno.test({
|
|||
process.stdin.push("bar");
|
||||
process.nextTick(() => {
|
||||
process.stdin.push(null);
|
||||
promise.resolve();
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue