test fix and now it works

This commit is contained in:
snwy
2024-11-07 15:22:36 -08:00
parent 1c5c453fa0
commit 5bcd6bb18a
3 changed files with 12 additions and 12 deletions

View File

@@ -51,6 +51,7 @@ export default [
["ERR_MULTIPLE_CALLBACK", Error, "Error"],
["ERR_METHOD_NOT_IMPLEMENTED", Error, "Error"],
["ERR_STREAM_RELEASE_LOCK", Error, "AbortError"],
["ERR_STREAM_PUSH_AFTER_EOF", Error, "Error"],
// Bun-specific
["ERR_FORMDATA_PARSE_ERROR", TypeError, "TypeError"],

View File

@@ -476,6 +476,7 @@ function readableAddChunkPushByteMode(stream, state, chunk, encoding) {
}
if ((state[kState] & kEnded) !== 0) {
errorOrDestroy(stream, $ERR_STREAM_PUSH_AFTER_EOF("Push after end"));
return false;
}

View File

@@ -22,18 +22,16 @@ test("Duplex with readable false", () => {
duplex.on("end", endHandler);
return new Promise(resolve => {
setImmediate(() => {
expect(errorHandler).toHaveBeenCalledTimes(1);
expect(errorHandler).toHaveBeenCalledWith(
expect.objectContaining({
code: "ERR_STREAM_PUSH_AFTER_EOF",
message: expect.any(String),
}),
);
expect(dataHandler).not.toHaveBeenCalled();
expect(endHandler).not.toHaveBeenCalled();
resolve();
});
expect(errorHandler).toHaveBeenCalledTimes(1);
expect(errorHandler).toHaveBeenCalledWith(
expect.objectContaining({
code: "ERR_STREAM_PUSH_AFTER_EOF",
message: expect.any(String),
}),
);
expect(dataHandler).not.toHaveBeenCalled();
expect(endHandler).not.toHaveBeenCalled();
resolve();
});
});