chore: replace rimraf with a helper in BrowserFetcher/Connector (#9890)

This commit is contained in:
Alex Rudenko
2023-03-21 13:41:56 +01:00
committed by GitHub
parent 510b36c500
commit 1f76cdda12
9 changed files with 50 additions and 19 deletions

View File

@@ -23,8 +23,9 @@ import {
PuppeteerLaunchOptions,
PuppeteerNode,
} from 'puppeteer-core/internal/node/PuppeteerNode.js';
import {rmSync} from 'puppeteer-core/internal/util/fs.js';
import {getTestState, rmSync} from './mocha-utils.js';
import {getTestState} from './mocha-utils.js';
const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-');

View File

@@ -23,9 +23,10 @@ import {Protocol} from 'devtools-protocol';
import expect from 'expect';
import {BrowserFetcher, TimeoutError} from 'puppeteer';
import {Page} from 'puppeteer-core/internal/api/Page.js';
import {rmSync} from 'puppeteer-core/internal/util/fs.js';
import sinon from 'sinon';
import {getTestState, itOnlyRegularInstall, rmSync} from './mocha-utils.js';
import {getTestState, itOnlyRegularInstall} from './mocha-utils.js';
import utils from './utils.js';
const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-');

View File

@@ -34,6 +34,7 @@ import {
PuppeteerNode,
} from 'puppeteer-core/internal/node/PuppeteerNode.js';
import {isErrorLike} from 'puppeteer-core/internal/util/ErrorLike.js';
import {rmSync} from 'puppeteer-core/internal/util/fs.js';
import sinon from 'sinon';
import {extendExpectWithToBeGolden} from './utils.js';
@@ -331,11 +332,3 @@ export const createTimeout = <T>(
}, n);
});
};
export function rmSync(target: string): void {
fs.rmSync(target, {
force: true,
recursive: true,
maxRetries: 5,
});
}