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>,
|
readable: ReadableStream<Uint8Array>,
|
||||||
path?: string
|
path?: string
|
||||||
): Promise<Buffer | null> {
|
): Promise<Buffer | null> {
|
||||||
const buffers = [];
|
const buffers: Uint8Array[] = [];
|
||||||
const reader = readable.getReader();
|
const reader = readable.getReader();
|
||||||
if (path) {
|
if (path) {
|
||||||
const fs = await importFSPromises();
|
const fs = await importFSPromises();
|
||||||
|
@ -1521,18 +1521,6 @@
|
|||||||
"parameters": ["cdp", "firefox"],
|
"parameters": ["cdp", "firefox"],
|
||||||
"expectations": ["FAIL"]
|
"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",
|
"testIdPattern": "[CDPSession.spec] Target.createCDPSession should be able to detach session",
|
||||||
"platforms": ["darwin", "linux", "win32"],
|
"platforms": ["darwin", "linux", "win32"],
|
||||||
|
@ -8,6 +8,8 @@ import fs from 'fs';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
import expect from 'expect';
|
import expect from 'expect';
|
||||||
|
import * as utils from 'puppeteer-core/internal/common/util.js';
|
||||||
|
import sinon from 'sinon';
|
||||||
|
|
||||||
import {launch} from './mocha-utils.js';
|
import {launch} from './mocha-utils.js';
|
||||||
|
|
||||||
@ -113,16 +115,26 @@ describe('Tracing', function () {
|
|||||||
await page.tracing.start({screenshots: true});
|
await page.tracing.start({screenshots: true});
|
||||||
await page.goto(server.PREFIX + '/grid.html');
|
await page.goto(server.PREFIX + '/grid.html');
|
||||||
|
|
||||||
const oldBufferConcat = Buffer.concat;
|
const oldGetReadableAsBuffer = utils.getReadableAsBuffer;
|
||||||
try {
|
sinon.stub(utils, 'getReadableAsBuffer').callsFake(() => {
|
||||||
Buffer.concat = () => {
|
return oldGetReadableAsBuffer({
|
||||||
throw new Error('error');
|
getReader() {
|
||||||
};
|
return {
|
||||||
const trace = await page.tracing.stop();
|
done: false,
|
||||||
expect(trace).toEqual(undefined);
|
read() {
|
||||||
} finally {
|
if (!this.done) {
|
||||||
Buffer.concat = oldBufferConcat;
|
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 () => {
|
it('should support a buffer without a path', async () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user