@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forwardimpact/libmock",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "description": "Shared mocks and test fixtures so every library and service tests the same way.",
5
5
  "keywords": [
6
6
  "test",
@@ -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
- const data = stream.read();
57
- return data ? data.toString() : "";
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
  /**