Skip to content

Commit

Permalink
chore(deps): update dependency p-timeout to v6 (#5393)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: Lewis Thorley <[email protected]>
  • Loading branch information
3 people authored Apr 25, 2024
1 parent fd70ac4 commit d74af71
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 40 deletions.
40 changes: 11 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
15 changes: 9 additions & 6 deletions tests/integration/utils/dev-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -49,6 +49,9 @@ interface DevServerOptions {
serve?: boolean
}

// 240 seconds
const SERVER_START_TIMEOUT = 24e4

const startServer = async ({
args = [],
context = 'dev',
Expand Down Expand Up @@ -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<DevServer> => {
Expand All @@ -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 <T>(
options: DevServerOptions,
testHandler: (server: DevServer) => Promise<T>,
expectFailure = false,
): Promise<T> => {
let server: DevServer | undefined = undefined
let server: DevServer | undefined
try {
server = await startDevServer(options, expectFailure)
return await testHandler(server)
Expand Down
7 changes: 4 additions & 3 deletions tests/integration/utils/process.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: () => {},
},
)
}
5 changes: 4 additions & 1 deletion tools/e2e/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
})
}

/**
Expand Down

2 comments on commit d74af71

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📊 Benchmark results

  • Dependency count: 1,345
  • Package size: 313 MB
  • Number of ts-expect-error directives: 1,001

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📊 Benchmark results

  • Dependency count: 1,345
  • Package size: 313 MB
  • Number of ts-expect-error directives: 1,001

Please sign in to comment.