From 79b5299c5b905215d0b98610777416eb275229ce Mon Sep 17 00:00:00 2001 From: Alex Rudenko Date: Fri, 26 May 2023 08:45:02 +0200 Subject: [PATCH] chore: recover Buffer.concat on errors (#10252) --- test/src/tracing.spec.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test/src/tracing.spec.ts b/test/src/tracing.spec.ts index b9553c4dac3..13f16997cff 100644 --- a/test/src/tracing.spec.ts +++ b/test/src/tracing.spec.ts @@ -125,13 +125,17 @@ describe('Tracing', function () { await page.tracing.start({screenshots: true}); await page.goto(server.PREFIX + '/grid.html'); + const oldBufferConcat = Buffer.concat; - Buffer.concat = () => { - throw 'error'; - }; - const trace = await page.tracing.stop(); - expect(trace).toEqual(undefined); - Buffer.concat = oldBufferConcat; + try { + Buffer.concat = () => { + throw new Error('error'); + }; + const trace = await page.tracing.stop(); + expect(trace).toEqual(undefined); + } finally { + Buffer.concat = oldBufferConcat; + } }); it('should support a buffer without a path', async () => {