From d74af713903137acb94d547e1b7ee149e6567610 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 25 Apr 2024 12:37:36 +0000 Subject: [PATCH] chore(deps): update dependency p-timeout to v6 (#5393) * chore(deps): update dependency p-timeout to v6 * chore: update pTimeout to new version * chore: lint * chore: run format * chore: run format --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Sarah Etter Co-authored-by: Lewis Thorley --- package-lock.json | 40 ++++++++------------------- package.json | 2 +- tests/integration/utils/dev-server.ts | 15 ++++++---- tests/integration/utils/process.js | 7 +++-- tools/e2e/setup.js | 5 +++- 5 files changed, 29 insertions(+), 40 deletions(-) diff --git a/package-lock.json b/package-lock.json index d8fefb3389b..ebcdeaa9ec6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -155,7 +155,7 @@ "is-ci": "3.0.1", "mock-fs": "5.2.0", "nock": "13.5.4", - "p-timeout": "4.1.0", + "p-timeout": "6.1.2", "serialize-javascript": "6.0.2", "sinon": "14.0.2", "strip-ansi": "7.1.0", @@ -19049,12 +19049,14 @@ } }, "node_modules/p-timeout": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-4.1.0.tgz", - "integrity": "sha512-+/wmHtzJuWii1sXn3HCuH/FTwGhrp4tmJTxSKJbfS+vkipci6osxXM5mY0jUiRzWKMTgUT8l7HFbeSwZAynqHw==", - "dev": true, + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-6.1.2.tgz", + "integrity": "sha512-UbD77BuZ9Bc9aABo74gfXhNvzC9Tx7SxtHSh1fxvx3jTLLYvmVhiQZZrJzqqU0jKbN32kb5VOKiLEQI/3bIjgQ==", "engines": { - "node": ">=10" + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/p-try": { @@ -19080,17 +19082,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/p-wait-for/node_modules/p-timeout": { - "version": "6.1.2", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-6.1.2.tgz", - "integrity": "sha512-UbD77BuZ9Bc9aABo74gfXhNvzC9Tx7SxtHSh1fxvx3jTLLYvmVhiQZZrJzqqU0jKbN32kb5VOKiLEQI/3bIjgQ==", - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/package-json": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/package-json/-/package-json-8.1.0.tgz", @@ -24959,7 +24950,6 @@ } }, "tools/lint-rules": { - "name": "eslint-plugin-workspace", "dev": true } }, @@ -38351,10 +38341,9 @@ } }, "p-timeout": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-4.1.0.tgz", - "integrity": "sha512-+/wmHtzJuWii1sXn3HCuH/FTwGhrp4tmJTxSKJbfS+vkipci6osxXM5mY0jUiRzWKMTgUT8l7HFbeSwZAynqHw==", - "dev": true + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-6.1.2.tgz", + "integrity": "sha512-UbD77BuZ9Bc9aABo74gfXhNvzC9Tx7SxtHSh1fxvx3jTLLYvmVhiQZZrJzqqU0jKbN32kb5VOKiLEQI/3bIjgQ==" }, "p-try": { "version": "1.0.0", @@ -38368,13 +38357,6 @@ "integrity": "sha512-lwx6u1CotQYPVju77R+D0vFomni/AqRfqLmqQ8hekklqZ6gAY9rONh7lBQ0uxWMkC2AuX9b2DVAl8To0NyP1JA==", "requires": { "p-timeout": "^6.0.0" - }, - "dependencies": { - "p-timeout": { - "version": "6.1.2", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-6.1.2.tgz", - "integrity": "sha512-UbD77BuZ9Bc9aABo74gfXhNvzC9Tx7SxtHSh1fxvx3jTLLYvmVhiQZZrJzqqU0jKbN32kb5VOKiLEQI/3bIjgQ==" - } } }, "package-json": { diff --git a/package.json b/package.json index 546f51311a6..e394a2158fc 100644 --- a/package.json +++ b/package.json @@ -211,7 +211,7 @@ "is-ci": "3.0.1", "mock-fs": "5.2.0", "nock": "13.5.4", - "p-timeout": "4.1.0", + "p-timeout": "6.1.2", "serialize-javascript": "6.0.2", "sinon": "14.0.2", "strip-ansi": "7.1.0", diff --git a/tests/integration/utils/dev-server.ts b/tests/integration/utils/dev-server.ts index f7d9c46ee98..81eb02e139b 100644 --- a/tests/integration/utils/dev-server.ts +++ b/tests/integration/utils/dev-server.ts @@ -11,7 +11,7 @@ import { killProcess } from './process.js' export const getExecaOptions = ({ cwd, env }) => { // Unused vars here are in order to omit LANg and LC_ALL from envs - // eslint-disable-next-line no-unused-vars + const { LANG, LC_ALL, ...baseEnv } = process.env return { @@ -49,6 +49,9 @@ interface DevServerOptions { serve?: boolean } +// 240 seconds +const SERVER_START_TIMEOUT = 24e4 + const startServer = async ({ args = [], context = 'dev', @@ -148,7 +151,10 @@ const startServer = async ({ ps.catch((error) => !selfKilled && reject(error)) }) - return await pTimeout(serverPromise, SERVER_START_TIMEOUT, () => ({ timeout: true, output: outputBuffer.join('') })) + return await pTimeout(serverPromise, { + milliseconds: SERVER_START_TIMEOUT, + fallback: () => ({ timeout: true, output: outputBuffer.join('') }), + }) } export const startDevServer = async (options: DevServerOptions, expectFailure: boolean): Promise => { @@ -175,15 +181,12 @@ export const startDevServer = async (options: DevServerOptions, expectFailure: b throw new Error('this code should be unreachable') } -// 240 seconds -const SERVER_START_TIMEOUT = 24e4 - export const withDevServer = async ( options: DevServerOptions, testHandler: (server: DevServer) => Promise, expectFailure = false, ): Promise => { - let server: DevServer | undefined = undefined + let server: DevServer | undefined try { server = await startDevServer(options, expectFailure) return await testHandler(server) diff --git a/tests/integration/utils/process.js b/tests/integration/utils/process.js index 031011fc5cf..8326b2c73a7 100644 --- a/tests/integration/utils/process.js +++ b/tests/integration/utils/process.js @@ -7,8 +7,9 @@ export const killProcess = async (ps) => { kill(ps.pid) await pTimeout( ps.catch(() => {}), - PROCESS_EXIT_TIMEOUT, - // don't reject on timeout - () => {}, + { + milliseconds: PROCESS_EXIT_TIMEOUT, + fallback: () => {}, + }, ) } diff --git a/tools/e2e/setup.js b/tools/e2e/setup.js index 09056c9dd03..8ccc6ee3d39 100644 --- a/tools/e2e/setup.js +++ b/tools/e2e/setup.js @@ -89,7 +89,10 @@ export const startRegistry = async () => { const startPort = Math.floor(Math.random() * END_PORT_RANGE) + START_PORT_RANGE const freePort = await getPort({ host: 'localhost', port: startPort }) - return await pTimeout(runVerdaccio(config, freePort), VERDACCIO_TIMEOUT_MILLISECONDS, 'Starting Verdaccio timed out') + return await pTimeout(runVerdaccio(config, freePort), { + milliseconds: VERDACCIO_TIMEOUT_MILLISECONDS, + fallback: 'Starting Verdaccio timed out', + }) } /**