mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
test: remove Buffer.concat overwrite (#11876)
This commit is contained in:
parent
3b43b1fa07
commit
86c3988e26
@ -209,7 +209,7 @@ export async function getReadableAsBuffer(
|
||||
readable: ReadableStream<Uint8Array>,
|
||||
path?: string
|
||||
): Promise<Buffer | null> {
|
||||
const buffers = [];
|
||||
const buffers: Uint8Array[] = [];
|
||||
const reader = readable.getReader();
|
||||
if (path) {
|
||||
const fs = await importFSPromises();
|
||||
|
@ -1521,18 +1521,6 @@
|
||||
"parameters": ["cdp", "firefox"],
|
||||
"expectations": ["FAIL"]
|
||||
},
|
||||
{
|
||||
"testIdPattern": "[browsercontext.spec] BrowserContext window.open should use parent tab context",
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
"parameters": ["chrome", "webDriverBiDi"],
|
||||
"expectations": ["PASS"]
|
||||
},
|
||||
{
|
||||
"testIdPattern": "[browsercontext.spec] BrowserContext window.open should use parent tab context",
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
"parameters": ["firefox", "webDriverBiDi"],
|
||||
"expectations": ["PASS"]
|
||||
},
|
||||
{
|
||||
"testIdPattern": "[CDPSession.spec] Target.createCDPSession should be able to detach session",
|
||||
"platforms": ["darwin", "linux", "win32"],
|
||||
|
@ -8,6 +8,8 @@ import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
import expect from 'expect';
|
||||
import * as utils from 'puppeteer-core/internal/common/util.js';
|
||||
import sinon from 'sinon';
|
||||
|
||||
import {launch} from './mocha-utils.js';
|
||||
|
||||
@ -113,16 +115,26 @@ describe('Tracing', function () {
|
||||
await page.tracing.start({screenshots: true});
|
||||
await page.goto(server.PREFIX + '/grid.html');
|
||||
|
||||
const oldBufferConcat = Buffer.concat;
|
||||
try {
|
||||
Buffer.concat = () => {
|
||||
throw new Error('error');
|
||||
};
|
||||
const trace = await page.tracing.stop();
|
||||
expect(trace).toEqual(undefined);
|
||||
} finally {
|
||||
Buffer.concat = oldBufferConcat;
|
||||
}
|
||||
const oldGetReadableAsBuffer = utils.getReadableAsBuffer;
|
||||
sinon.stub(utils, 'getReadableAsBuffer').callsFake(() => {
|
||||
return oldGetReadableAsBuffer({
|
||||
getReader() {
|
||||
return {
|
||||
done: false,
|
||||
read() {
|
||||
if (!this.done) {
|
||||
this.done = true;
|
||||
return {done: false, value: 42};
|
||||
}
|
||||
return {done: true};
|
||||
},
|
||||
};
|
||||
},
|
||||
} as unknown as ReadableStream);
|
||||
});
|
||||
|
||||
const trace = await page.tracing.stop();
|
||||
expect(trace).toEqual(undefined);
|
||||
});
|
||||
|
||||
it('should support a buffer without a path', async () => {
|
||||
|
Loading…
Reference in New Issue
Block a user