chore: remove unused code and dep (#11705)

This commit is contained in:
Nikolay Vitkov 2024-01-19 14:03:29 +01:00 committed by GitHub
parent 07889b5bb3
commit 6a28525fc9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 11 additions and 51 deletions

19
package-lock.json generated
View File

@ -24,7 +24,6 @@
"@types/sinon": "17.0.3",
"@typescript-eslint/eslint-plugin": "6.19.0",
"@typescript-eslint/parser": "6.19.0",
"cross-env": "7.0.3",
"esbuild": "0.19.11",
"eslint": "8.56.0",
"eslint-config-prettier": "9.1.0",
@ -3100,24 +3099,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/cross-env": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz",
"integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==",
"dev": true,
"dependencies": {
"cross-spawn": "^7.0.1"
},
"bin": {
"cross-env": "src/bin/cross-env.js",
"cross-env-shell": "src/bin/cross-env-shell.js"
},
"engines": {
"node": ">=10.14",
"npm": ">=6",
"yarn": ">=1"
}
},
"node_modules/cross-fetch": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-4.0.0.tgz",

View File

@ -117,7 +117,7 @@
]
},
"test": {
"command": "cross-env PUPPETEER_DEFERRED_PROMISE_DEBUG_TIMEOUT=20000 npx ./tools/mocha-runner --min-tests 1003",
"command": "npx ./tools/mocha-runner --min-tests 1003",
"dependencies": [
"./test:build",
"./tools/mocha-runner:build"
@ -139,7 +139,6 @@
"@types/sinon": "17.0.3",
"@typescript-eslint/eslint-plugin": "6.19.0",
"@typescript-eslint/parser": "6.19.0",
"cross-env": "7.0.3",
"esbuild": "0.19.11",
"eslint-config-prettier": "9.1.0",
"eslint-import-resolver-typescript": "3.6.1",

View File

@ -1,6 +1,7 @@
module.exports = {
logLevel: 'debug',
spec: 'test/build/**/*.spec.js',
require: ['./test/build/mocha-utils.js'],
exit: !!process.env.CI,
reporter: 'spec',
timeout: 10_000,

View File

@ -67,7 +67,7 @@
]
},
"test": {
"command": "node tools/downloadTestBrowsers.mjs && cross-env DEBUG=puppeteer:* mocha",
"command": "node tools/downloadTestBrowsers.mjs && mocha",
"files": [
".mocharc.cjs"
],

View File

@ -0,0 +1,8 @@
import debug from 'debug';
export const mochaHooks = {
async beforeAll(): Promise<void> {
// Enable logging for Debug
debug.enable('puppeteer:*');
},
};

View File

@ -8,12 +8,3 @@
* @internal
*/
export const isNode = !!(typeof process !== 'undefined' && process.version);
/**
* @internal
*/
export const DEFERRED_PROMISE_DEBUG_TIMEOUT =
typeof process !== 'undefined' &&
typeof process.env['PUPPETEER_DEFERRED_PROMISE_DEBUG_TIMEOUT'] !== 'undefined'
? Number(process.env['PUPPETEER_DEFERRED_PROMISE_DEBUG_TIMEOUT'])
: -1;

View File

@ -1,19 +0,0 @@
import {DEFERRED_PROMISE_DEBUG_TIMEOUT} from '../environment.js';
import {Deferred} from './Deferred.js';
/**
* Creates and returns a deferred promise using DEFERRED_PROMISE_DEBUG_TIMEOUT
* if it's specified or a normal deferred promise otherwise.
*
* @internal
*/
export function createDebuggableDeferred<T>(message: string): Deferred<T> {
if (DEFERRED_PROMISE_DEBUG_TIMEOUT > 0) {
return Deferred.create({
message,
timeout: DEFERRED_PROMISE_DEBUG_TIMEOUT,
});
}
return Deferred.create();
}

View File

@ -5,7 +5,6 @@
*/
export * from './assert.js';
export * from './DebuggableDeferred.js';
export * from './Deferred.js';
export * from './ErrorLike.js';
export * from './AsyncIterableUtil.js';