@forwardimpact/libmock 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/fixture/eval.js +10 -2
package/package.json
CHANGED
package/src/fixture/eval.js
CHANGED
|
@@ -49,12 +49,20 @@ export function createTextBlockMsg(text) {
|
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* Reads a PassThrough / Readable stream to a single string.
|
|
52
|
+
*
|
|
53
|
+
* Drains every buffered chunk. A single `read()` returns only what the
|
|
54
|
+
* runtime happens to hold in one chunk, so it truncates a multi-write
|
|
55
|
+
* stream under bun while it looks complete under node.
|
|
56
|
+
*
|
|
52
57
|
* @param {import("node:stream").Readable} stream
|
|
53
58
|
* @returns {string}
|
|
54
59
|
*/
|
|
55
60
|
export function collectStream(stream) {
|
|
56
|
-
|
|
57
|
-
|
|
61
|
+
let out = "";
|
|
62
|
+
for (let chunk = stream.read(); chunk !== null; chunk = stream.read()) {
|
|
63
|
+
out += chunk.toString();
|
|
64
|
+
}
|
|
65
|
+
return out;
|
|
58
66
|
}
|
|
59
67
|
|
|
60
68
|
/**
|