We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pipeline mock fails when node:stream/promise pipeline is used.
node:stream/promise
The first test passes. For the second test, the await pipeline(...) fails. The error is not catched.
await pipeline(...)
// Import Node.js Dependencies import { describe, it, afterEach } from "node:test"; import { pipeline } from "node:stream/promises"; import stream, { PassThrough, Readable } from "node:stream"; import assert from "node:assert"; import timers from "node:timers/promises"; // Import Third-Party Dependencies import undici, { MockAgent } from "undici"; describe("undici.pipeline", async() => { let kMockAgent: MockAgent; afterEach(async() => { await kMockAgent.close(); }); it("OK : stream.pipeline", async() => { kMockAgent = new MockAgent(); kMockAgent.disableNetConnect(); undici.setGlobalDispatcher(kMockAgent); kMockAgent .get("https://boz.com") .intercept({ method: "POST", path: "/" }) .reply(200, "Bar"); const readable = Readable.from("Some text.".repeat(10_000)); const request = undici.pipeline( "https://boz.com", { method: "POST" }, ({ body }) => body ); stream.pipeline(readable, request, new PassThrough(), () => void 0); await timers.setTimeout(100); assert.ok(1); }); it("KO : stream/promises.pipeline", async() => { kMockAgent = new MockAgent(); kMockAgent.disableNetConnect(); undici.setGlobalDispatcher(kMockAgent); kMockAgent .get("https://boz.com") .intercept({ method: "POST", path: "/" }) .reply(200, "Bar"); const readable = Readable.from("Some text.".repeat(10_000)); const request = undici.pipeline( "https://boz.com", { method: "POST" }, ({ body }) => body ); try { await pipeline(readable, request, new PassThrough()); } catch (error) { console.error(error); } assert.ok(1); }); });
stream/promises.pipeline should work in the same way as stream/pipeline ?
stream/promises.pipeline
stream/pipeline
Node 20.x Undici 6.6.2
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Bug Description
Pipeline mock fails when
node:stream/promise
pipeline is used.Reproducible By
The first test passes. For the second test, the
await pipeline(...)
fails. The error is not catched.Expected Behavior
stream/promises.pipeline
should work in the same way asstream/pipeline
?Logs & Screenshots
Environment
Node 20.x
Undici 6.6.2
The text was updated successfully, but these errors were encountered: