Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions lib/internal/test_runner/reporter/v8-serializer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ const { serializeError } = require('internal/error_serdes');


module.exports = async function* v8Reporter(source) {
const serializer = new DefaultSerializer();
serializer.writeHeader();
const headerLength = TypedArrayPrototypeGetLength(serializer.releaseBuffer());
const headerSerializer = new DefaultSerializer();
headerSerializer.writeHeader();
const headerLength = TypedArrayPrototypeGetLength(headerSerializer.releaseBuffer());

for await (const item of source) {
const serializer = new DefaultSerializer();
const originalError = item.data.details?.error;
if (originalError) {
// Error is overridden with a serialized version, so that it can be
Expand Down
9 changes: 9 additions & 0 deletions test/parallel/test-runner-v8-deserializer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ describe('v8 deserializer', common.mustCall(() => {
assert.deepStrictEqual(reported, [reportedDiagnosticEvent]);
});

it('should serialize a repeated object as independent messages', async () => {
const repeatedChunks = await toArray(serializer([diagnosticEvent, diagnosticEvent]));
const reported = await collectReported(repeatedChunks);
assert.deepStrictEqual(reported, [
reportedDiagnosticEvent,
reportedDiagnosticEvent,
]);
});

it('should deserialize a serialized chunk after non-serialized chunk', async () => {
const reported = await collectReported([Buffer.concat([Buffer.from('unknown'), ...chunks])]);
assert.deepStrictEqual(reported, [
Expand Down
Loading