chore: remove rimraf (#9775)

This commit is contained in:
jrandolf 2023-03-06 11:33:38 +01:00 committed by GitHub
parent 8bf97181f3
commit 2123f809e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 231 additions and 112 deletions

View File

@ -22,7 +22,7 @@ class BrowserFetcher {
Promise<void>
A promise that resolves when the revision has been removes or throws if the revision has not been downloaded.
A promise that resolves when the revision has been removed or throws if the revision has not been downloaded.
## Remarks

288
package-lock.json generated
View File

@ -31,7 +31,6 @@
"@types/pngjs": "6.0.1",
"@types/progress": "2.0.5",
"@types/proxy-from-env": "1.0.1",
"@types/rimraf": "3.0.2",
"@types/semver": "7.3.13",
"@types/sinon": "10.0.13",
"@types/tar-fs": "2.0.1",
@ -1848,16 +1847,6 @@
"@types/node": "*"
}
},
"node_modules/@types/rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@types/rimraf/-/rimraf-3.0.2.tgz",
"integrity": "sha512-F3OznnSLAUxFrCEu/L5PY8+ny8DtcFRjx7fZZ9bycvXRi3KPTRS9HOitGZwvPg0juRhXFWIeKX58cnX5YqLohQ==",
"dev": true,
"dependencies": {
"@types/glob": "*",
"@types/node": "*"
}
},
"node_modules/@types/semver": {
"version": "7.3.13",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz",
@ -2517,6 +2506,41 @@
"wrap-ansi": "^7.0.0"
}
},
"node_modules/c8/node_modules/glob": {
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"dev": true,
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.1.1",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
},
"engines": {
"node": "*"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/c8/node_modules/rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"dev": true,
"dependencies": {
"glob": "^7.1.3"
},
"bin": {
"rimraf": "bin.js"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/c8/node_modules/yargs": {
"version": "16.2.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
@ -4375,6 +4399,41 @@
"node": "^10.12.0 || >=12.0.0"
}
},
"node_modules/flat-cache/node_modules/glob": {
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"dev": true,
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.1.1",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
},
"engines": {
"node": "*"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/flat-cache/node_modules/rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"dev": true,
"dependencies": {
"glob": "^7.1.3"
},
"bin": {
"rimraf": "bin.js"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/flatted": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.7.tgz",
@ -4682,6 +4741,26 @@
"typescript": ">=3"
}
},
"node_modules/gts/node_modules/glob": {
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"dev": true,
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.1.1",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
},
"engines": {
"node": "*"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/gts/node_modules/meow": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/meow/-/meow-9.0.0.tgz",
@ -4723,6 +4802,21 @@
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
"node_modules/gts/node_modules/rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"dev": true,
"dependencies": {
"glob": "^7.1.3"
},
"bin": {
"rimraf": "bin.js"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/gts/node_modules/type-fest": {
"version": "0.18.1",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz",
@ -5958,6 +6052,7 @@
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"dependencies": {
"brace-expansion": "^1.1.7"
},
@ -7281,39 +7376,6 @@
"node": ">=0.10.0"
}
},
"node_modules/rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"dependencies": {
"glob": "^7.1.3"
},
"bin": {
"rimraf": "bin.js"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/rimraf/node_modules/glob": {
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"dependencies": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.1.1",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
},
"engines": {
"node": "*"
},
"funding": {
"url": "https://github.com/sponsors/isaacs"
}
},
"node_modules/rollup": {
"version": "3.12.1",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.12.1.tgz",
@ -8681,7 +8743,7 @@
"puppeteer-core": "19.7.2"
},
"engines": {
"node": ">=14.1.0"
"node": ">=14.14.0"
}
},
"packages/puppeteer-core": {
@ -8695,7 +8757,6 @@
"extract-zip": "2.0.1",
"https-proxy-agent": "5.0.1",
"proxy-from-env": "1.1.0",
"rimraf": "3.0.2",
"tar-fs": "2.1.1",
"unbzip2-stream": "1.4.3",
"ws": "8.11.0"
@ -8705,7 +8766,7 @@
"parsel-js": "github:jrandolf/parsel"
},
"engines": {
"node": ">=14.1.0"
"node": ">=14.14.0"
},
"peerDependencies": {
"typescript": ">= 4.7.4"
@ -8716,6 +8777,26 @@
}
}
},
"packages/puppeteer-core/node_modules/ws": {
"version": "8.12.1",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.12.1.tgz",
"integrity": "sha512-1qo+M9Ba+xNhPB+YTWUlK6M17brTut5EXbcBaMRN5pH5dFrXz7lzz1ChFSUq3bOUl8yEvSenhHmYUNJxFzdJew==",
"engines": {
"node": ">=10.0.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": ">=5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
}
},
"packages/puppeteer/node_modules/argparse": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
@ -10484,16 +10565,6 @@
"@types/node": "*"
}
},
"@types/rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/@types/rimraf/-/rimraf-3.0.2.tgz",
"integrity": "sha512-F3OznnSLAUxFrCEu/L5PY8+ny8DtcFRjx7fZZ9bycvXRi3KPTRS9HOitGZwvPg0juRhXFWIeKX58cnX5YqLohQ==",
"dev": true,
"requires": {
"@types/glob": "*",
"@types/node": "*"
}
},
"@types/semver": {
"version": "7.3.13",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz",
@ -10946,6 +11017,29 @@
"wrap-ansi": "^7.0.0"
}
},
"glob": {
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.1.1",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"dev": true,
"requires": {
"glob": "^7.1.3"
}
},
"yargs": {
"version": "16.2.0",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
@ -12236,6 +12330,31 @@
"requires": {
"flatted": "^3.1.0",
"rimraf": "^3.0.2"
},
"dependencies": {
"glob": {
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.1.1",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"dev": true,
"requires": {
"glob": "^7.1.3"
}
}
}
},
"flatted": {
@ -12462,6 +12581,20 @@
"write-file-atomic": "^4.0.0"
},
"dependencies": {
"glob": {
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.1.1",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"meow": {
"version": "9.0.0",
"resolved": "https://registry.npmjs.org/meow/-/meow-9.0.0.tgz",
@ -12488,6 +12621,15 @@
"integrity": "sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g==",
"dev": true
},
"rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"dev": true,
"requires": {
"glob": "^7.1.3"
}
},
"type-fest": {
"version": "0.18.1",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.18.1.tgz",
@ -13399,6 +13541,7 @@
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"dev": true,
"requires": {
"brace-expansion": "^1.1.7"
}
@ -14138,10 +14281,16 @@
"mitt": "3.0.0",
"parsel-js": "github:jrandolf/parsel",
"proxy-from-env": "1.1.0",
"rimraf": "3.0.2",
"tar-fs": "2.1.1",
"unbzip2-stream": "1.4.3",
"ws": "8.11.0"
},
"dependencies": {
"ws": {
"version": "https://registry.npmjs.org/ws/-/ws-8.12.1.tgz",
"integrity": "sha512-1qo+M9Ba+xNhPB+YTWUlK6M17brTut5EXbcBaMRN5pH5dFrXz7lzz1ChFSUq3bOUl8yEvSenhHmYUNJxFzdJew==",
"requires": {}
}
}
},
"q": {
@ -14430,29 +14579,6 @@
"integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==",
"dev": true
},
"rimraf": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz",
"integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==",
"requires": {
"glob": "^7.1.3"
},
"dependencies": {
"glob": {
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz",
"integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==",
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.1.1",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
}
}
},
"rollup": {
"version": "3.12.1",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-3.12.1.tgz",

View File

@ -11,7 +11,7 @@
"build:docs": "wireit",
"check:pinned-deps": "tsx tools/ensure-pinned-deps",
"check": "npm run check --workspaces --if-present && run-p check:*",
"clean": "rimraf **/.wireit && npm run clean --workspaces --if-present",
"clean": "rm -rf **/.wireit && npm run clean --workspaces --if-present",
"commitlint": "commitlint --from=HEAD~1",
"debug": "mocha --inspect-brk",
"docs": "run-s build:docs generate:markdown",
@ -133,7 +133,6 @@
"@types/pngjs": "6.0.1",
"@types/progress": "2.0.5",
"@types/proxy-from-env": "1.0.1",
"@types/rimraf": "3.0.2",
"@types/semver": "7.3.13",
"@types/sinon": "10.0.13",
"@types/tar-fs": "2.0.1",

View File

@ -5,7 +5,7 @@
"scripts": {
"build": "wireit",
"build:test": "wireit",
"clean": "tsc --build --clean && rimraf lib",
"clean": "tsc --build --clean && rm -rf lib",
"test": "wireit"
},
"bin": {

View File

@ -5,7 +5,7 @@
"scripts": {
"build:tsc": "wireit",
"build": "wireit",
"clean": "tsc -b --clean && rimraf lib && rimraf test/build",
"clean": "tsc -b --clean && rm -rf lib && rm -rf test/build",
"dev:test": "npm run test --watch",
"dev": "npm run build --watch",
"test": "wireit"

View File

@ -31,7 +31,7 @@
"url": "https://github.com/puppeteer/puppeteer/tree/main/packages/puppeteer-core"
},
"engines": {
"node": ">=14.1.0"
"node": ">=14.14.0"
},
"scripts": {
"build:docs": "wireit",
@ -39,7 +39,7 @@
"build:types": "wireit",
"build": "wireit",
"check": "tsx tools/ensure-correct-devtools-protocol-package",
"clean": "tsc -b --clean && rimraf lib src/generated",
"clean": "tsc -b --clean && rm -rf lib src/generated",
"generate:package-json": "wireit",
"generate:sources": "wireit",
"prepack": "wireit"
@ -138,7 +138,6 @@
"extract-zip": "2.0.1",
"https-proxy-agent": "5.0.1",
"proxy-from-env": "1.1.0",
"rimraf": "3.0.2",
"tar-fs": "2.1.1",
"unbzip2-stream": "1.4.3",
"ws": "8.11.0"

View File

@ -16,7 +16,7 @@
import {exec as execChildProcess} from 'child_process';
import {createReadStream, createWriteStream, existsSync, readdirSync} from 'fs';
import {chmod, mkdir, readdir, unlink} from 'fs/promises';
import {chmod, mkdir, readdir, rm, unlink} from 'fs/promises';
import * as http from 'http';
import * as https from 'https';
import * as os from 'os';
@ -31,7 +31,6 @@ import createHttpsProxyAgent, {
HttpsProxyAgentOptions,
} from 'https-proxy-agent';
import {getProxyForUrl} from 'proxy-from-env';
import removeRecursive from 'rimraf';
import tar from 'tar-fs';
import bzip from 'unbzip2-stream';
@ -404,7 +403,7 @@ export class BrowserFetcher {
* @remarks
* This method is affected by the current `product`.
* @param revision - A revision to remove for the current `product`.
* @returns A promise that resolves when the revision has been removes or
* @returns A promise that resolves when the revision has been removed or
* throws if the revision has not been downloaded.
*/
async remove(revision: string): Promise<void> {
@ -413,9 +412,7 @@ export class BrowserFetcher {
existsSync(folderPath),
`Failed to remove: revision ${revision} is not downloaded`
);
await new Promise(fulfill => {
return removeRecursive(folderPath, fulfill);
});
await rm(folderPath, {recursive: true, force: true});
}
/**

View File

@ -16,12 +16,11 @@
import * as childProcess from 'child_process';
import * as fs from 'fs';
import {rm} from 'fs/promises';
import * as path from 'path';
import * as readline from 'readline';
import {promisify} from 'util';
import removeFolder from 'rimraf';
import type {Connection as BiDiConnection} from '../common/bidi/bidi.js';
import {Connection} from '../common/Connection.js';
import {debug} from '../common/Debug.js';
@ -40,7 +39,6 @@ import {isErrnoException, isErrorLike} from '../util/ErrorLike.js';
import {LaunchOptions} from './LaunchOptions.js';
import {PipeTransport} from './PipeTransport.js';
const removeFolderAsync = promisify(removeFolder);
const renameAsync = promisify(fs.rename);
const unlinkAsync = promisify(fs.unlink);
@ -126,7 +124,7 @@ export class BrowserRunner {
// Cleanup as processes exit.
if (this.#isTempUserDataDir) {
try {
await removeFolderAsync(this.#userDataDir);
await rm(this.#userDataDir, {recursive: true, force: true});
fulfill();
} catch (error) {
debugError(error);
@ -240,7 +238,7 @@ export class BrowserRunner {
// Attempt to remove temporary profile directory to avoid littering.
try {
if (this.#isTempUserDataDir) {
removeFolder.sync(this.#userDataDir);
fs.rmSync(this.#userDataDir, {recursive: true, force: true});
}
} catch (error) {}

View File

@ -31,14 +31,14 @@
"url": "https://github.com/puppeteer/puppeteer/tree/main/packages/puppeteer"
},
"engines": {
"node": ">=14.1.0"
"node": ">=14.14.0"
},
"scripts": {
"build:docs": "wireit",
"build:tsc": "wireit",
"build:types": "wireit",
"build": "wireit",
"clean": "tsc -b --clean && rimraf lib",
"clean": "tsc -b --clean && rm -rf lib",
"generate:package-json": "wireit",
"postinstall": "node install.js",
"prepack": "wireit"

View File

@ -5,7 +5,7 @@
"main": "lib/index.js",
"scripts": {
"build": "wireit",
"clean": "tsc -b --clean && rimraf lib"
"clean": "tsc -b --clean && rm -rf lib"
},
"wireit": {
"build": {

View File

@ -6,7 +6,7 @@
"scripts": {
"build": "wireit",
"build:packages": "wireit",
"clean": "tsc -b --clean && rimraf build",
"clean": "tsc -b --clean && rm -rf build",
"test": "mocha"
},
"wireit": {

View File

@ -4,7 +4,7 @@
"private": true,
"scripts": {
"build": "wireit",
"clean": "tsc -b --clean && rimraf build"
"clean": "tsc -b --clean && rm -rf build"
},
"wireit": {
"build": {

View File

@ -15,6 +15,7 @@
*/
import fs from 'fs';
import {rm} from 'fs/promises';
import os from 'os';
import path from 'path';
import {promisify} from 'util';
@ -24,11 +25,9 @@ import {
PuppeteerLaunchOptions,
PuppeteerNode,
} from 'puppeteer-core/internal/node/PuppeteerNode.js';
import rimraf from 'rimraf';
import {getTestState} from './mocha-utils.js';
const rmAsync = promisify(rimraf);
const mkdtempAsync = promisify(fs.mkdtemp);
const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-');
@ -241,7 +240,7 @@ describe('headful tests', function () {
});
await headlessBrowser.close();
// This might throw. See https://github.com/puppeteer/puppeteer/issues/2778
await rmAsync(userDataDir).catch(() => {});
await rm(userDataDir, {recursive: true, force: true}).catch(() => {});
expect(cookie).toBe('foo=true');
});
// TODO: Support OOOPIF. @see https://github.com/puppeteer/puppeteer/issues/2548

View File

@ -14,6 +14,7 @@
* limitations under the License.
*/
import fs from 'fs';
import {rm} from 'fs/promises';
import os from 'os';
import path from 'path';
import {TLSSocket} from 'tls';
@ -23,15 +24,16 @@ import {Protocol} from 'devtools-protocol';
import expect from 'expect';
import {BrowserFetcher, TimeoutError} from 'puppeteer';
import {Page} from 'puppeteer-core/internal/api/Page.js';
import rimraf from 'rimraf';
import sinon from 'sinon';
import {getTestState, itOnlyRegularInstall} from './mocha-utils.js';
import utils from './utils.js';
const rmAsync = (filename: string) => {
return rm(filename, {force: true, recursive: true});
};
const mkdtempAsync = promisify(fs.mkdtemp);
const readFileAsync = promisify(fs.readFile);
const rmAsync = promisify(rimraf);
const statAsync = promisify(fs.stat);
const writeFileAsync = promisify(fs.writeFile);

View File

@ -34,7 +34,6 @@ import {
} from 'puppeteer-core/internal/node/PuppeteerNode.js';
import {isErrorLike} from 'puppeteer-core/internal/util/ErrorLike.js';
import puppeteer from 'puppeteer/lib/cjs/puppeteer/puppeteer.js';
import rimraf from 'rimraf';
import sinon from 'sinon';
import {extendExpectWithToBeGolden} from './utils.js';
@ -134,7 +133,7 @@ const setupGoldenAssertions = (): void => {
const GOLDEN_DIR = path.join(__dirname, `../golden-${suffix}`);
const OUTPUT_DIR = path.join(__dirname, `../output-${suffix}`);
if (fs.existsSync(OUTPUT_DIR)) {
rimraf.sync(OUTPUT_DIR);
fs.rmSync(OUTPUT_DIR, {recursive: true, force: true});
}
extendExpectWithToBeGolden(GOLDEN_DIR, OUTPUT_DIR);
};