mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 20:29:11 +00:00
fix(ext/node): export promises
from stream (#30427)
Some checks are pending
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
Some checks are pending
ci / test release windows-x86_64 (push) Blocked by required conditions
ci / build libs (push) Blocked by required conditions
ci / test release macos-x86_64 (push) Blocked by required conditions
ci / test debug windows-x86_64 (push) Blocked by required conditions
ci / pre-build (push) Waiting to run
ci / test debug linux-aarch64 (push) Blocked by required conditions
ci / test release linux-aarch64 (push) Blocked by required conditions
ci / test debug macos-aarch64 (push) Blocked by required conditions
ci / test release macos-aarch64 (push) Blocked by required conditions
ci / bench release linux-x86_64 (push) Blocked by required conditions
ci / lint debug linux-x86_64 (push) Blocked by required conditions
ci / lint debug macos-x86_64 (push) Blocked by required conditions
ci / lint debug windows-x86_64 (push) Blocked by required conditions
ci / test debug linux-x86_64 (push) Blocked by required conditions
ci / test release linux-x86_64 (push) Blocked by required conditions
ci / test debug macos-x86_64 (push) Blocked by required conditions
ci / publish canary (push) Blocked by required conditions
Closes #30423
This commit is contained in:
parent
5c79bc7300
commit
a694cae55d
3 changed files with 23 additions and 2 deletions
|
@ -173,6 +173,7 @@ export {
|
||||||
getDefaultHighWaterMark,
|
getDefaultHighWaterMark,
|
||||||
PassThrough,
|
PassThrough,
|
||||||
pipeline,
|
pipeline,
|
||||||
|
promises,
|
||||||
Readable,
|
Readable,
|
||||||
setDefaultHighWaterMark,
|
setDefaultHighWaterMark,
|
||||||
Stream,
|
Stream,
|
||||||
|
|
|
@ -3,7 +3,12 @@
|
||||||
import { assert, assertEquals } from "@std/assert";
|
import { assert, assertEquals } from "@std/assert";
|
||||||
import { fromFileUrl, relative } from "@std/path";
|
import { fromFileUrl, relative } from "@std/path";
|
||||||
import { finished, pipeline } from "node:stream/promises";
|
import { finished, pipeline } from "node:stream/promises";
|
||||||
import { getDefaultHighWaterMark, Stream, Writable } from "node:stream";
|
import {
|
||||||
|
getDefaultHighWaterMark,
|
||||||
|
promises,
|
||||||
|
Stream,
|
||||||
|
Writable,
|
||||||
|
} from "node:stream";
|
||||||
import { TextEncoderStream } from "node:stream/web";
|
import { TextEncoderStream } from "node:stream/web";
|
||||||
import { createReadStream, createWriteStream } from "node:fs";
|
import { createReadStream, createWriteStream } from "node:fs";
|
||||||
import { EventEmitter } from "node:events";
|
import { EventEmitter } from "node:events";
|
||||||
|
@ -78,3 +83,18 @@ Deno.test("Writable toWeb", async () => {
|
||||||
|
|
||||||
await finished(nodeWritable);
|
await finished(nodeWritable);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// https://github.com/denoland/deno/issues/30423
|
||||||
|
Deno.test("exported `promises` from node:stream works", async () => {
|
||||||
|
const stream = new ReadableStream({
|
||||||
|
start(controller) {
|
||||||
|
controller.enqueue("asd");
|
||||||
|
controller.close();
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const promise = promises.finished(stream as unknown as NodeJS.ReadableStream);
|
||||||
|
for await (const chunk of stream) {
|
||||||
|
assertEquals(chunk, "asd");
|
||||||
|
}
|
||||||
|
await promise;
|
||||||
|
});
|
||||||
|
|
|
@ -197,7 +197,7 @@
|
||||||
"ext:deno_node/repl.ts": "../ext/node/polyfills/repl.ts",
|
"ext:deno_node/repl.ts": "../ext/node/polyfills/repl.ts",
|
||||||
"node:stream": "../ext/node/polyfills/stream.ts",
|
"node:stream": "../ext/node/polyfills/stream.ts",
|
||||||
"node:stream/consumers": "../ext/node/polyfills/stream/consumers.mjs",
|
"node:stream/consumers": "../ext/node/polyfills/stream/consumers.mjs",
|
||||||
"node:stream/promises": "../ext/node/polyfills/stream/promises.mjs",
|
"node:stream/promises": "../ext/node/polyfills/stream/promises.js",
|
||||||
"node:stream/web": "../ext/node/polyfills/stream/web.ts",
|
"node:stream/web": "../ext/node/polyfills/stream/web.ts",
|
||||||
"node:string_decoder": "../ext/node/polyfills/string_decoder.ts",
|
"node:string_decoder": "../ext/node/polyfills/string_decoder.ts",
|
||||||
"node:sys": "../ext/node/polyfills/sys.ts",
|
"node:sys": "../ext/node/polyfills/sys.ts",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue