@forwardimpact/libmock 0.1.16 → 0.1.18
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 +2 -2
- package/src/fixture/eval.js +10 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forwardimpact/libmock",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"description": "Shared mocks and test fixtures so every library and service tests the same way.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"test",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"test": "bun test test/*.test.js"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@grpc/grpc-js": "^1.14.
|
|
36
|
+
"@grpc/grpc-js": "^1.14.5"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@forwardimpact/libtype": "*"
|
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
|
/**
|