@rulvar/testing 1.27.0 → 1.28.0
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/dist/index.js +22 -13
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -340,20 +340,29 @@ function record(options) {
|
|
|
340
340
|
caps: (model) => adapter.caps(model),
|
|
341
341
|
async *stream(req, signal) {
|
|
342
342
|
const events = [];
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
343
|
+
let thrown = false;
|
|
344
|
+
try {
|
|
345
|
+
for await (const event of adapter.stream(req, signal)) {
|
|
346
|
+
events.push(event);
|
|
347
|
+
yield event;
|
|
348
|
+
}
|
|
349
|
+
} catch (error) {
|
|
350
|
+
thrown = true;
|
|
351
|
+
throw error;
|
|
352
|
+
} finally {
|
|
353
|
+
if (!thrown) {
|
|
354
|
+
const row = {
|
|
355
|
+
adapterId: adapter.id,
|
|
356
|
+
...adapter.provider === void 0 ? {} : { provider: adapter.provider },
|
|
357
|
+
requestHash: requestHash(req),
|
|
358
|
+
request: walkStrings(JSON.parse(JSON.stringify(req)), redact),
|
|
359
|
+
events: walkStrings(JSON.parse(JSON.stringify(events)), redact),
|
|
360
|
+
caps: adapter.caps(req.model),
|
|
361
|
+
model: req.model
|
|
362
|
+
};
|
|
363
|
+
appendFileSync(options.cassette, `${JSON.stringify(row)}\n`, "utf8");
|
|
364
|
+
}
|
|
346
365
|
}
|
|
347
|
-
const row = {
|
|
348
|
-
adapterId: adapter.id,
|
|
349
|
-
...adapter.provider === void 0 ? {} : { provider: adapter.provider },
|
|
350
|
-
requestHash: requestHash(req),
|
|
351
|
-
request: walkStrings(JSON.parse(JSON.stringify(req)), redact),
|
|
352
|
-
events: walkStrings(JSON.parse(JSON.stringify(events)), redact),
|
|
353
|
-
caps: adapter.caps(req.model),
|
|
354
|
-
model: req.model
|
|
355
|
-
};
|
|
356
|
-
appendFileSync(options.cassette, `${JSON.stringify(row)}\n`, "utf8");
|
|
357
366
|
}
|
|
358
367
|
}));
|
|
359
368
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rulvar/testing",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.28.0",
|
|
4
4
|
"description": "Rulvar test harness: createTestEngine, FakeAdapter, VCR cassettes, replay-strict runs, matchers.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"access": "public"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@rulvar/core": "1.
|
|
29
|
+
"@rulvar/core": "1.28.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^22.20.0",
|