Skip to content

Commit e9d2295

Browse files
authored
test: Log out envelope item for failing node integration tests (#15532)
While trying to debug the tedious integration, I figured it would be nice to internals of the envelope item when receiving mismatched envelope items. This PR adds the the serialized envelope item to the error being thrown.
1 parent 256d6f4 commit e9d2295

File tree

1 file changed

+9
-3
lines changed
  • dev-packages/node-integration-tests/utils

1 file changed

+9
-3
lines changed

dev-packages/node-integration-tests/utils/runner.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -294,13 +294,17 @@ export function createRunner(...paths: string[]) {
294294
// Catch any error or failed assertions and pass them to done to end the test quickly
295295
try {
296296
if (!expected) {
297-
return;
297+
return;
298298
}
299299

300300
const expectedType = Object.keys(expected)[0];
301301

302302
if (expectedType !== envelopeItemType) {
303-
throw new Error(`Expected envelope item type '${expectedType}' but got '${envelopeItemType}'`);
303+
throw new Error(
304+
`Expected envelope item type '${expectedType}' but got '${envelopeItemType}'. \nItem: ${JSON.stringify(
305+
item,
306+
)}`,
307+
);
304308
}
305309

306310
if ('event' in expected) {
@@ -322,7 +326,9 @@ export function createRunner(...paths: string[]) {
322326
expectClientReport(item[1] as ClientReport, expected.client_report);
323327
expectCallbackCalled();
324328
} else {
325-
throw new Error(`Unhandled expected envelope item type: ${JSON.stringify(expected)}`);
329+
throw new Error(
330+
`Unhandled expected envelope item type: ${JSON.stringify(expected)}\nItem: ${JSON.stringify(item)}`,
331+
);
326332
}
327333
} catch (e) {
328334
complete(e as Error);

0 commit comments

Comments
 (0)